]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/commitdiff
Merge branch 'arm-next' of git://git.xilinx.com/linux-xlnx into next/dt
authorArnd Bergmann <arnd@arndb.de>
Fri, 16 Nov 2012 16:47:11 +0000 (17:47 +0100)
committerArnd Bergmann <arnd@arndb.de>
Fri, 16 Nov 2012 16:47:11 +0000 (17:47 +0100)
From Michal Simek <michal.simek@xilinx.com>:

These are based on previous patches (arm-soc zynq/cleanup branch).
The branch is still based on rc3 but I have also tried to merged it
with the v3.7-rc5 and there is no issue.

* 'arm-next' of git://git.xilinx.com/linux-xlnx:
  ARM: zynq: add clk binding support to the ttc
  ARM: zynq: use zynq clk bindings
  clk: Add support for fundamental zynq clks
  ARM: zynq: dts: split up device tree
  ARM: zynq: Allow UART1 to be used as DEBUG_LL console.
  ARM: zynq: dts: add description of the second uart
  ARM: zynq: move arm-specific sys_timer out of ttc
  zynq: move static peripheral mappings
  zynq: remove use of CLKDEV_LOOKUP
  zynq: use pl310 device tree bindings
  zynq: use GIC device tree bindings

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1023 files changed:
Documentation/arm64/memory.txt
Documentation/devicetree/bindings/arm/omap/counter.txt [new file with mode: 0644]
Documentation/devicetree/bindings/arm/omap/timer.txt [new file with mode: 0644]
Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
Documentation/devicetree/bindings/clock/imx25-clock.txt [new file with mode: 0644]
Documentation/devicetree/bindings/i2c/fsl-imx-i2c.txt
Documentation/devicetree/bindings/i2c/trivial-devices.txt
Documentation/devicetree/bindings/input/touchscreen/bu21013.txt [new file with mode: 0644]
Documentation/devicetree/bindings/input/touchscreen/egalax-ts.txt [new file with mode: 0644]
Documentation/devicetree/bindings/usb/am33xx-usb.txt
Documentation/hwmon/fam15h_power
MAINTAINERS
Makefile
arch/arm/Kconfig
arch/arm/Kconfig.debug
arch/arm/Makefile
arch/arm/boot/dts/Makefile
arch/arm/boot/dts/am335x-bone.dts
arch/arm/boot/dts/am335x-evm.dts
arch/arm/boot/dts/am335x-evmsk.dts [new file with mode: 0644]
arch/arm/boot/dts/am33xx.dtsi
arch/arm/boot/dts/ccu9540.dts [new file with mode: 0644]
arch/arm/boot/dts/dbx5x0.dtsi
arch/arm/boot/dts/href.dtsi [new file with mode: 0644]
arch/arm/boot/dts/hrefprev60.dts [new file with mode: 0644]
arch/arm/boot/dts/hrefv60plus.dts
arch/arm/boot/dts/imx25-karo-tx25.dts [new file with mode: 0644]
arch/arm/boot/dts/imx25.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx27-apf27.dts [new file with mode: 0644]
arch/arm/boot/dts/imx27.dtsi
arch/arm/boot/dts/imx51.dtsi
arch/arm/boot/dts/imx53.dtsi
arch/arm/boot/dts/imx6q.dtsi
arch/arm/boot/dts/omap2.dtsi
arch/arm/boot/dts/omap2420.dtsi
arch/arm/boot/dts/omap2430.dtsi
arch/arm/boot/dts/omap3-beagle-xm.dts
arch/arm/boot/dts/omap3-beagle.dts [new file with mode: 0644]
arch/arm/boot/dts/omap3.dtsi
arch/arm/boot/dts/omap4-panda-a4.dts [new file with mode: 0644]
arch/arm/boot/dts/omap4-panda-es.dts [moved from arch/arm/boot/dts/omap4-pandaES.dts with 70% similarity]
arch/arm/boot/dts/omap4-panda.dts
arch/arm/boot/dts/omap4-sdp-es23plus.dts [new file with mode: 0644]
arch/arm/boot/dts/omap4-sdp.dts
arch/arm/boot/dts/omap4-var-som.dts [moved from arch/arm/boot/dts/omap4-var_som.dts with 100% similarity]
arch/arm/boot/dts/omap4.dtsi
arch/arm/boot/dts/omap5-evm.dts
arch/arm/boot/dts/omap5.dtsi
arch/arm/boot/dts/samsung_k3pe0e000b.dtsi [new file with mode: 0644]
arch/arm/boot/dts/snowball.dts
arch/arm/boot/dts/stuib.dtsi [new file with mode: 0644]
arch/arm/boot/dts/twl4030.dtsi
arch/arm/boot/dts/twl6030.dtsi
arch/arm/configs/imx_v4_v5_defconfig
arch/arm/configs/imx_v6_v7_defconfig
arch/arm/configs/u8500_defconfig
arch/arm/include/asm/io.h
arch/arm/include/asm/sched_clock.h
arch/arm/include/asm/vfpmacros.h
arch/arm/include/debug/imx.S [moved from arch/arm/plat-mxc/include/mach/debug-macro.S with 59% similarity]
arch/arm/include/uapi/asm/hwcap.h
arch/arm/kernel/sched_clock.c
arch/arm/mach-imx/3ds_debugboard.c [moved from arch/arm/plat-mxc/3ds_debugboard.c with 99% similarity]
arch/arm/mach-imx/3ds_debugboard.h [moved from arch/arm/plat-mxc/include/mach/3ds_debugboard.h with 100% similarity]
arch/arm/mach-imx/Kconfig
arch/arm/mach-imx/Makefile
arch/arm/mach-imx/avic.c [moved from arch/arm/plat-mxc/avic.c with 98% similarity]
arch/arm/mach-imx/board-mx31lilly.h [moved from arch/arm/plat-mxc/include/mach/board-mx31lilly.h with 100% similarity]
arch/arm/mach-imx/board-mx31lite.h [moved from arch/arm/plat-mxc/include/mach/board-mx31lite.h with 100% similarity]
arch/arm/mach-imx/board-mx31moboard.h [moved from arch/arm/plat-mxc/include/mach/board-mx31moboard.h with 100% similarity]
arch/arm/mach-imx/board-pcm038.h [moved from arch/arm/plat-mxc/include/mach/board-pcm038.h with 100% similarity]
arch/arm/mach-imx/clk-imx1.c
arch/arm/mach-imx/clk-imx21.c
arch/arm/mach-imx/clk-imx25.c
arch/arm/mach-imx/clk-imx27.c
arch/arm/mach-imx/clk-imx31.c
arch/arm/mach-imx/clk-imx35.c
arch/arm/mach-imx/clk-imx51-imx53.c
arch/arm/mach-imx/clk-imx6q.c
arch/arm/mach-imx/clk-pllv1.c
arch/arm/mach-imx/common.h [moved from arch/arm/plat-mxc/include/mach/common.h with 98% similarity]
arch/arm/mach-imx/cpu-imx25.c
arch/arm/mach-imx/cpu-imx27.c
arch/arm/mach-imx/cpu-imx31.c
arch/arm/mach-imx/cpu-imx35.c
arch/arm/mach-imx/cpu-imx5.c
arch/arm/mach-imx/cpu.c [moved from arch/arm/plat-mxc/cpu.c with 97% similarity]
arch/arm/mach-imx/cpu_op-mx51.c
arch/arm/mach-imx/cpufreq.c [moved from arch/arm/plat-mxc/cpufreq.c with 99% similarity]
arch/arm/mach-imx/cpuidle.c [moved from arch/arm/plat-mxc/cpuidle.c with 100% similarity]
arch/arm/mach-imx/cpuidle.h [moved from arch/arm/plat-mxc/include/mach/cpuidle.h with 100% similarity]
arch/arm/mach-imx/devices-imx1.h
arch/arm/mach-imx/devices-imx21.h
arch/arm/mach-imx/devices-imx25.h
arch/arm/mach-imx/devices-imx27.h
arch/arm/mach-imx/devices-imx31.h
arch/arm/mach-imx/devices-imx35.h
arch/arm/mach-imx/devices-imx50.h
arch/arm/mach-imx/devices-imx51.h
arch/arm/mach-imx/devices/Kconfig [moved from arch/arm/plat-mxc/devices/Kconfig with 100% similarity]
arch/arm/mach-imx/devices/Makefile [moved from arch/arm/plat-mxc/devices/Makefile with 98% similarity]
arch/arm/mach-imx/devices/devices-common.h [moved from arch/arm/plat-mxc/include/mach/devices-common.h with 97% similarity]
arch/arm/mach-imx/devices/devices.c [moved from arch/arm/plat-mxc/devices.c with 92% similarity]
arch/arm/mach-imx/devices/platform-ahci-imx.c [moved from arch/arm/plat-mxc/devices/platform-ahci-imx.c with 98% similarity]
arch/arm/mach-imx/devices/platform-fec.c [moved from arch/arm/plat-mxc/devices/platform-fec.c with 97% similarity]
arch/arm/mach-imx/devices/platform-flexcan.c [moved from arch/arm/plat-mxc/devices/platform-flexcan.c with 96% similarity]
arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c [moved from arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c with 96% similarity]
arch/arm/mach-imx/devices/platform-gpio-mxc.c [moved from arch/arm/plat-mxc/devices/platform-gpio-mxc.c with 96% similarity]
arch/arm/mach-imx/devices/platform-gpio_keys.c [moved from arch/arm/plat-mxc/devices/platform-gpio_keys.c with 94% similarity]
arch/arm/mach-imx/devices/platform-imx-dma.c [moved from arch/arm/plat-mxc/devices/platform-imx-dma.c with 63% similarity]
arch/arm/mach-imx/devices/platform-imx-fb.c [moved from arch/arm/plat-mxc/devices/platform-imx-fb.c with 79% similarity]
arch/arm/mach-imx/devices/platform-imx-i2c.c [moved from arch/arm/plat-mxc/devices/platform-imx-i2c.c with 76% similarity]
arch/arm/mach-imx/devices/platform-imx-keypad.c [moved from arch/arm/plat-mxc/devices/platform-imx-keypad.c with 97% similarity]
arch/arm/mach-imx/devices/platform-imx-ssi.c [moved from arch/arm/plat-mxc/devices/platform-imx-ssi.c with 98% similarity]
arch/arm/mach-imx/devices/platform-imx-uart.c [moved from arch/arm/plat-mxc/devices/platform-imx-uart.c with 98% similarity]
arch/arm/mach-imx/devices/platform-imx2-wdt.c [moved from arch/arm/plat-mxc/devices/platform-imx2-wdt.c with 97% similarity]
arch/arm/mach-imx/devices/platform-imx21-hcd.c [moved from arch/arm/plat-mxc/devices/platform-imx21-hcd.c with 94% similarity]
arch/arm/mach-imx/devices/platform-imx27-coda.c [moved from arch/arm/plat-mxc/devices/platform-imx27-coda.c with 93% similarity]
arch/arm/mach-imx/devices/platform-imx_udc.c [moved from arch/arm/plat-mxc/devices/platform-imx_udc.c with 96% similarity]
arch/arm/mach-imx/devices/platform-imxdi_rtc.c [moved from arch/arm/plat-mxc/devices/platform-imxdi_rtc.c with 94% similarity]
arch/arm/mach-imx/devices/platform-ipu-core.c [moved from arch/arm/plat-mxc/devices/platform-ipu-core.c with 98% similarity]
arch/arm/mach-imx/devices/platform-mx1-camera.c [moved from arch/arm/plat-mxc/devices/platform-mx1-camera.c with 94% similarity]
arch/arm/mach-imx/devices/platform-mx2-camera.c [moved from arch/arm/plat-mxc/devices/platform-mx2-camera.c with 83% similarity]
arch/arm/mach-imx/devices/platform-mxc-ehci.c [moved from arch/arm/plat-mxc/devices/platform-mxc-ehci.c with 97% similarity]
arch/arm/mach-imx/devices/platform-mxc-mmc.c [moved from arch/arm/plat-mxc/devices/platform-mxc-mmc.c with 76% similarity]
arch/arm/mach-imx/devices/platform-mxc_nand.c [moved from arch/arm/plat-mxc/devices/platform-mxc_nand.c with 74% similarity]
arch/arm/mach-imx/devices/platform-mxc_pwm.c [moved from arch/arm/plat-mxc/devices/platform-mxc_pwm.c with 97% similarity]
arch/arm/mach-imx/devices/platform-mxc_rnga.c [moved from arch/arm/plat-mxc/devices/platform-mxc_rnga.c with 95% similarity]
arch/arm/mach-imx/devices/platform-mxc_rtc.c [moved from arch/arm/plat-mxc/devices/platform-mxc_rtc.c with 77% similarity]
arch/arm/mach-imx/devices/platform-mxc_w1.c [moved from arch/arm/plat-mxc/devices/platform-mxc_w1.c with 95% similarity]
arch/arm/mach-imx/devices/platform-pata_imx.c [moved from arch/arm/plat-mxc/devices/platform-pata_imx.c with 96% similarity]
arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c [moved from arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c with 98% similarity]
arch/arm/mach-imx/devices/platform-spi_imx.c [moved from arch/arm/plat-mxc/devices/platform-spi_imx.c with 98% similarity]
arch/arm/mach-imx/ehci-imx25.c
arch/arm/mach-imx/ehci-imx27.c
arch/arm/mach-imx/ehci-imx31.c
arch/arm/mach-imx/ehci-imx35.c
arch/arm/mach-imx/ehci-imx5.c
arch/arm/mach-imx/epit.c [moved from arch/arm/plat-mxc/epit.c with 99% similarity]
arch/arm/mach-imx/eukrea-baseboards.h [moved from arch/arm/plat-mxc/include/mach/eukrea-baseboards.h with 100% similarity]
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c
arch/arm/mach-imx/hardware.h [moved from arch/arm/plat-mxc/include/mach/hardware.h with 94% similarity]
arch/arm/mach-imx/hotplug.c
arch/arm/mach-imx/iim.h [moved from arch/arm/plat-mxc/include/mach/iim.h with 100% similarity]
arch/arm/mach-imx/imx25-dt.c [new file with mode: 0644]
arch/arm/mach-imx/imx27-dt.c
arch/arm/mach-imx/imx31-dt.c
arch/arm/mach-imx/imx51-dt.c
arch/arm/mach-imx/include/mach/dma-mx1-mx2.h [deleted file]
arch/arm/mach-imx/iomux-imx31.c
arch/arm/mach-imx/iomux-mx1.h [moved from arch/arm/plat-mxc/include/mach/iomux-mx1.h with 99% similarity]
arch/arm/mach-imx/iomux-mx21.h [moved from arch/arm/plat-mxc/include/mach/iomux-mx21.h with 99% similarity]
arch/arm/mach-imx/iomux-mx25.h [moved from arch/arm/plat-mxc/include/mach/iomux-mx25.h with 99% similarity]
arch/arm/mach-imx/iomux-mx27.h [moved from arch/arm/plat-mxc/include/mach/iomux-mx27.h with 99% similarity]
arch/arm/mach-imx/iomux-mx2x.h [moved from arch/arm/plat-mxc/include/mach/iomux-mx2x.h with 100% similarity]
arch/arm/mach-imx/iomux-mx3.h [moved from arch/arm/plat-mxc/include/mach/iomux-mx3.h with 100% similarity]
arch/arm/mach-imx/iomux-mx35.h [moved from arch/arm/plat-mxc/include/mach/iomux-mx35.h with 99% similarity]
arch/arm/mach-imx/iomux-mx50.h [moved from arch/arm/plat-mxc/include/mach/iomux-mx50.h with 99% similarity]
arch/arm/mach-imx/iomux-mx51.h [moved from arch/arm/plat-mxc/include/mach/iomux-mx51.h with 99% similarity]
arch/arm/mach-imx/iomux-v1.c [moved from arch/arm/plat-mxc/iomux-v1.c with 98% similarity]
arch/arm/mach-imx/iomux-v1.h [moved from arch/arm/plat-mxc/include/mach/iomux-v1.h with 100% similarity]
arch/arm/mach-imx/iomux-v3.c [moved from arch/arm/plat-mxc/iomux-v3.c with 97% similarity]
arch/arm/mach-imx/iomux-v3.h [moved from arch/arm/plat-mxc/include/mach/iomux-v3.h with 100% similarity]
arch/arm/mach-imx/iram.h [moved from arch/arm/plat-mxc/include/mach/iram.h with 100% similarity]
arch/arm/mach-imx/iram_alloc.c [moved from arch/arm/plat-mxc/iram_alloc.c with 98% similarity]
arch/arm/mach-imx/irq-common.c [moved from arch/arm/plat-mxc/irq-common.c with 100% similarity]
arch/arm/mach-imx/irq-common.h [moved from arch/arm/plat-mxc/irq-common.h with 94% similarity]
arch/arm/mach-imx/lluart.c
arch/arm/mach-imx/mach-apf9328.c
arch/arm/mach-imx/mach-armadillo5x0.c
arch/arm/mach-imx/mach-bug.c
arch/arm/mach-imx/mach-cpuimx27.c
arch/arm/mach-imx/mach-cpuimx35.c
arch/arm/mach-imx/mach-cpuimx51sd.c
arch/arm/mach-imx/mach-eukrea_cpuimx25.c
arch/arm/mach-imx/mach-imx27_visstrim_m10.c
arch/arm/mach-imx/mach-imx27ipcam.c
arch/arm/mach-imx/mach-imx27lite.c
arch/arm/mach-imx/mach-imx53.c
arch/arm/mach-imx/mach-imx6q.c
arch/arm/mach-imx/mach-kzm_arm11_01.c
arch/arm/mach-imx/mach-mx1ads.c
arch/arm/mach-imx/mach-mx21ads.c
arch/arm/mach-imx/mach-mx25_3ds.c
arch/arm/mach-imx/mach-mx27_3ds.c
arch/arm/mach-imx/mach-mx27ads.c
arch/arm/mach-imx/mach-mx31_3ds.c
arch/arm/mach-imx/mach-mx31ads.c
arch/arm/mach-imx/mach-mx31lilly.c
arch/arm/mach-imx/mach-mx31lite.c
arch/arm/mach-imx/mach-mx31moboard.c
arch/arm/mach-imx/mach-mx35_3ds.c
arch/arm/mach-imx/mach-mx50_rdp.c
arch/arm/mach-imx/mach-mx51_3ds.c
arch/arm/mach-imx/mach-mx51_babbage.c
arch/arm/mach-imx/mach-mxt_td60.c
arch/arm/mach-imx/mach-pca100.c
arch/arm/mach-imx/mach-pcm037.c
arch/arm/mach-imx/mach-pcm037_eet.c
arch/arm/mach-imx/mach-pcm038.c
arch/arm/mach-imx/mach-pcm043.c
arch/arm/mach-imx/mach-qong.c
arch/arm/mach-imx/mach-scb9328.c
arch/arm/mach-imx/mach-vpr200.c
arch/arm/mach-imx/mm-imx1.c
arch/arm/mach-imx/mm-imx21.c
arch/arm/mach-imx/mm-imx25.c
arch/arm/mach-imx/mm-imx27.c
arch/arm/mach-imx/mm-imx3.c
arch/arm/mach-imx/mm-imx5.c
arch/arm/mach-imx/mx1.h [moved from arch/arm/plat-mxc/include/mach/mx1.h with 100% similarity]
arch/arm/mach-imx/mx21.h [moved from arch/arm/plat-mxc/include/mach/mx21.h with 100% similarity]
arch/arm/mach-imx/mx25.h [moved from arch/arm/plat-mxc/include/mach/mx25.h with 100% similarity]
arch/arm/mach-imx/mx27.h [moved from arch/arm/plat-mxc/include/mach/mx27.h with 100% similarity]
arch/arm/mach-imx/mx2x.h [moved from arch/arm/plat-mxc/include/mach/mx2x.h with 100% similarity]
arch/arm/mach-imx/mx31.h [moved from arch/arm/plat-mxc/include/mach/mx31.h with 100% similarity]
arch/arm/mach-imx/mx31lilly-db.c
arch/arm/mach-imx/mx31lite-db.c
arch/arm/mach-imx/mx31moboard-devboard.c
arch/arm/mach-imx/mx31moboard-marxbot.c
arch/arm/mach-imx/mx31moboard-smartbot.c
arch/arm/mach-imx/mx35.h [moved from arch/arm/plat-mxc/include/mach/mx35.h with 100% similarity]
arch/arm/mach-imx/mx3x.h [moved from arch/arm/plat-mxc/include/mach/mx3x.h with 100% similarity]
arch/arm/mach-imx/mx50.h [moved from arch/arm/plat-mxc/include/mach/mx50.h with 100% similarity]
arch/arm/mach-imx/mx51.h [moved from arch/arm/plat-mxc/include/mach/mx51.h with 100% similarity]
arch/arm/mach-imx/mx53.h [moved from arch/arm/plat-mxc/include/mach/mx53.h with 100% similarity]
arch/arm/mach-imx/mx6q.h [moved from arch/arm/plat-mxc/include/mach/mx6q.h with 100% similarity]
arch/arm/mach-imx/mxc.h [moved from arch/arm/plat-mxc/include/mach/mxc.h with 100% similarity]
arch/arm/mach-imx/pcm970-baseboard.c
arch/arm/mach-imx/platsmp.c
arch/arm/mach-imx/pm-imx27.c
arch/arm/mach-imx/pm-imx3.c
arch/arm/mach-imx/pm-imx5.c
arch/arm/mach-imx/pm-imx6q.c
arch/arm/mach-imx/ssi-fiq-ksym.c [moved from arch/arm/plat-mxc/ssi-fiq-ksym.c with 100% similarity]
arch/arm/mach-imx/ssi-fiq.S [moved from arch/arm/plat-mxc/ssi-fiq.S with 100% similarity]
arch/arm/mach-imx/system.c [moved from arch/arm/plat-mxc/system.c with 97% similarity]
arch/arm/mach-imx/time.c [moved from arch/arm/plat-mxc/time.c with 99% similarity]
arch/arm/mach-imx/tzic.c [moved from arch/arm/plat-mxc/tzic.c with 98% similarity]
arch/arm/mach-imx/ulpi.c [moved from arch/arm/plat-mxc/ulpi.c with 99% similarity]
arch/arm/mach-imx/ulpi.h [moved from arch/arm/plat-mxc/include/mach/ulpi.h with 100% similarity]
arch/arm/mach-omap1/Makefile
arch/arm/mach-omap1/board-ams-delta.c
arch/arm/mach-omap1/board-fsample.c
arch/arm/mach-omap1/board-generic.c
arch/arm/mach-omap1/board-h2-mmc.c
arch/arm/mach-omap1/board-h2.c
arch/arm/mach-omap1/board-h3-mmc.c
arch/arm/mach-omap1/board-h3.c
arch/arm/mach-omap1/board-htcherald.c
arch/arm/mach-omap1/board-innovator.c
arch/arm/mach-omap1/board-nokia770.c
arch/arm/mach-omap1/board-osk.c
arch/arm/mach-omap1/board-palmte.c
arch/arm/mach-omap1/board-palmtt.c
arch/arm/mach-omap1/board-palmz71.c
arch/arm/mach-omap1/board-perseus2.c
arch/arm/mach-omap1/board-sx1-mmc.c
arch/arm/mach-omap1/board-sx1.c
arch/arm/mach-omap1/board-voiceblue.c
arch/arm/mach-omap1/clock.c
arch/arm/mach-omap1/clock.h
arch/arm/mach-omap1/clock_data.c
arch/arm/mach-omap1/common.h
arch/arm/mach-omap1/devices.c
arch/arm/mach-omap1/dma.c
arch/arm/mach-omap1/dma.h [new file with mode: 0644]
arch/arm/mach-omap1/flash.c
arch/arm/mach-omap1/fpga.c
arch/arm/mach-omap1/fpga.h [new file with mode: 0644]
arch/arm/mach-omap1/gpio15xx.c
arch/arm/mach-omap1/gpio16xx.c
arch/arm/mach-omap1/gpio7xx.c
arch/arm/mach-omap1/i2c.c
arch/arm/mach-omap1/id.c
arch/arm/mach-omap1/include/mach/debug-macro.S
arch/arm/mach-omap1/include/mach/entry-macro.S
arch/arm/mach-omap1/include/mach/gpio.h [deleted file]
arch/arm/mach-omap1/include/mach/hardware.h
arch/arm/mach-omap1/include/mach/memory.h
arch/arm/mach-omap1/include/mach/omap1510.h
arch/arm/mach-omap1/include/mach/serial.h [new file with mode: 0644]
arch/arm/mach-omap1/include/mach/soc.h [new file with mode: 0644]
arch/arm/mach-omap1/include/mach/tc.h [moved from arch/arm/plat-omap/include/plat/tc.h with 100% similarity]
arch/arm/mach-omap1/include/mach/uncompress.h
arch/arm/mach-omap1/io.c
arch/arm/mach-omap1/iomap.h
arch/arm/mach-omap1/irq.c
arch/arm/mach-omap1/lcd_dma.c
arch/arm/mach-omap1/mcbsp.c
arch/arm/mach-omap1/mmc.h [new file with mode: 0644]
arch/arm/mach-omap1/opp_data.c
arch/arm/mach-omap1/pm.c
arch/arm/mach-omap1/pm_bus.c
arch/arm/mach-omap1/reset.c
arch/arm/mach-omap1/serial.c
arch/arm/mach-omap1/sleep.S
arch/arm/mach-omap1/soc.h [new file with mode: 0644]
arch/arm/mach-omap1/sram-init.c [new file with mode: 0644]
arch/arm/mach-omap1/sram.h [new file with mode: 0644]
arch/arm/mach-omap1/timer32k.c
arch/arm/mach-omap1/usb.c
arch/arm/mach-omap2/Makefile
arch/arm/mach-omap2/am33xx.h
arch/arm/mach-omap2/am35xx-emac.c
arch/arm/mach-omap2/board-2430sdp.c
arch/arm/mach-omap2/board-3430sdp.c
arch/arm/mach-omap2/board-3630sdp.c
arch/arm/mach-omap2/board-4430sdp.c
arch/arm/mach-omap2/board-am3517crane.c
arch/arm/mach-omap2/board-am3517evm.c
arch/arm/mach-omap2/board-apollon.c
arch/arm/mach-omap2/board-cm-t35.c
arch/arm/mach-omap2/board-cm-t3517.c
arch/arm/mach-omap2/board-devkit8000.c
arch/arm/mach-omap2/board-flash.c
arch/arm/mach-omap2/board-flash.h
arch/arm/mach-omap2/board-generic.c
arch/arm/mach-omap2/board-h4.c
arch/arm/mach-omap2/board-igep0020.c
arch/arm/mach-omap2/board-ldp.c
arch/arm/mach-omap2/board-n8x0.c
arch/arm/mach-omap2/board-omap3beagle.c
arch/arm/mach-omap2/board-omap3evm.c
arch/arm/mach-omap2/board-omap3logic.c
arch/arm/mach-omap2/board-omap3pandora.c
arch/arm/mach-omap2/board-omap3stalker.c
arch/arm/mach-omap2/board-omap3touchbook.c
arch/arm/mach-omap2/board-omap4panda.c
arch/arm/mach-omap2/board-overo.c
arch/arm/mach-omap2/board-rm680.c
arch/arm/mach-omap2/board-rx51-peripherals.c
arch/arm/mach-omap2/board-rx51.c
arch/arm/mach-omap2/board-ti8168evm.c
arch/arm/mach-omap2/board-zoom-debugboard.c
arch/arm/mach-omap2/board-zoom-display.c
arch/arm/mach-omap2/board-zoom-peripherals.c
arch/arm/mach-omap2/board-zoom.c
arch/arm/mach-omap2/board-zoom.h [moved from arch/arm/mach-omap2/include/mach/board-zoom.h with 100% similarity]
arch/arm/mach-omap2/clkt2xxx_apll.c
arch/arm/mach-omap2/clkt2xxx_dpll.c
arch/arm/mach-omap2/clkt2xxx_dpllcore.c
arch/arm/mach-omap2/clkt2xxx_osc.c
arch/arm/mach-omap2/clkt2xxx_sys.c
arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
arch/arm/mach-omap2/clkt34xx_dpll3m2.c
arch/arm/mach-omap2/clkt_clksel.c
arch/arm/mach-omap2/clkt_dpll.c
arch/arm/mach-omap2/clkt_iclk.c
arch/arm/mach-omap2/clock.c
arch/arm/mach-omap2/clock.h
arch/arm/mach-omap2/clock2420_data.c
arch/arm/mach-omap2/clock2430.c
arch/arm/mach-omap2/clock2430_data.c
arch/arm/mach-omap2/clock2xxx.c
arch/arm/mach-omap2/clock2xxx.h
arch/arm/mach-omap2/clock33xx_data.c
arch/arm/mach-omap2/clock34xx.c
arch/arm/mach-omap2/clock3517.c
arch/arm/mach-omap2/clock36xx.c
arch/arm/mach-omap2/clock3xxx.c
arch/arm/mach-omap2/clock3xxx_data.c
arch/arm/mach-omap2/clock44xx_data.c
arch/arm/mach-omap2/clockdomain.c
arch/arm/mach-omap2/clockdomain.h
arch/arm/mach-omap2/clockdomain2xxx_3xxx.c [deleted file]
arch/arm/mach-omap2/clockdomain33xx.c [deleted file]
arch/arm/mach-omap2/clockdomain44xx.c [deleted file]
arch/arm/mach-omap2/clockdomains2420_data.c
arch/arm/mach-omap2/clockdomains2430_data.c
arch/arm/mach-omap2/clockdomains3xxx_data.c
arch/arm/mach-omap2/cm-regbits-24xx.h
arch/arm/mach-omap2/cm.h
arch/arm/mach-omap2/cm2xxx.c [new file with mode: 0644]
arch/arm/mach-omap2/cm2xxx.h [new file with mode: 0644]
arch/arm/mach-omap2/cm2xxx_3xxx.h
arch/arm/mach-omap2/cm33xx.c
arch/arm/mach-omap2/cm3xxx.c [moved from arch/arm/mach-omap2/cm2xxx_3xxx.c with 67% similarity]
arch/arm/mach-omap2/cm3xxx.h [new file with mode: 0644]
arch/arm/mach-omap2/cm_common.c [new file with mode: 0644]
arch/arm/mach-omap2/cminst44xx.c
arch/arm/mach-omap2/cminst44xx.h
arch/arm/mach-omap2/common-board-devices.c
arch/arm/mach-omap2/common-board-devices.h
arch/arm/mach-omap2/common.c
arch/arm/mach-omap2/common.h
arch/arm/mach-omap2/control.c
arch/arm/mach-omap2/control.h
arch/arm/mach-omap2/cpuidle34xx.c
arch/arm/mach-omap2/devices.c
arch/arm/mach-omap2/display.c
arch/arm/mach-omap2/dma.c
arch/arm/mach-omap2/dma.h [new file with mode: 0644]
arch/arm/mach-omap2/dpll3xxx.c
arch/arm/mach-omap2/dpll44xx.c
arch/arm/mach-omap2/drm.c
arch/arm/mach-omap2/dsp.c
arch/arm/mach-omap2/gpio.c
arch/arm/mach-omap2/gpmc-nand.c
arch/arm/mach-omap2/gpmc-nand.h [new file with mode: 0644]
arch/arm/mach-omap2/gpmc-onenand.c
arch/arm/mach-omap2/gpmc-onenand.h [new file with mode: 0644]
arch/arm/mach-omap2/gpmc-smc91x.c
arch/arm/mach-omap2/gpmc-smsc911x.c
arch/arm/mach-omap2/gpmc.c
arch/arm/mach-omap2/gpmc.h [moved from arch/arm/plat-omap/include/plat/gpmc.h with 67% similarity]
arch/arm/mach-omap2/hdq1w.c
arch/arm/mach-omap2/hdq1w.h
arch/arm/mach-omap2/hsmmc.c
arch/arm/mach-omap2/hwspinlock.c
arch/arm/mach-omap2/i2c.c
arch/arm/mach-omap2/i2c.h [new file with mode: 0644]
arch/arm/mach-omap2/id.c
arch/arm/mach-omap2/include/mach/debug-macro.S
arch/arm/mach-omap2/include/mach/gpio.h [deleted file]
arch/arm/mach-omap2/include/mach/serial.h [moved from arch/arm/plat-omap/include/plat/serial.h with 81% similarity]
arch/arm/mach-omap2/include/mach/uncompress.h
arch/arm/mach-omap2/io.c
arch/arm/mach-omap2/mcbsp.c
arch/arm/mach-omap2/mmc.h [new file with mode: 0644]
arch/arm/mach-omap2/msdi.c
arch/arm/mach-omap2/mux.c
arch/arm/mach-omap2/omap-mpuss-lowpower.c
arch/arm/mach-omap2/omap-pm-noop.c [moved from arch/arm/plat-omap/omap-pm-noop.c with 98% similarity]
arch/arm/mach-omap2/omap-pm.h [moved from arch/arm/plat-omap/include/plat/omap-pm.h with 100% similarity]
arch/arm/mach-omap2/omap-secure.c
arch/arm/mach-omap2/omap-secure.h
arch/arm/mach-omap2/omap2-restart.c [new file with mode: 0644]
arch/arm/mach-omap2/omap3-restart.c [new file with mode: 0644]
arch/arm/mach-omap2/omap4-common.c
arch/arm/mach-omap2/omap_device.c [moved from arch/arm/plat-omap/omap_device.c with 99% similarity]
arch/arm/mach-omap2/omap_device.h [moved from arch/arm/plat-omap/include/plat/omap_device.h with 99% similarity]
arch/arm/mach-omap2/omap_hwmod.c
arch/arm/mach-omap2/omap_hwmod.h [moved from arch/arm/plat-omap/include/plat/omap_hwmod.h with 99% similarity]
arch/arm/mach-omap2/omap_hwmod_2420_data.c
arch/arm/mach-omap2/omap_hwmod_2430_data.c
arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c
arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
arch/arm/mach-omap2/omap_hwmod_33xx_data.c
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
arch/arm/mach-omap2/omap_hwmod_44xx_data.c
arch/arm/mach-omap2/omap_hwmod_common_data.c
arch/arm/mach-omap2/omap_hwmod_common_data.h
arch/arm/mach-omap2/omap_opp_data.h
arch/arm/mach-omap2/omap_phy_internal.c
arch/arm/mach-omap2/omap_twl.c
arch/arm/mach-omap2/opp.c
arch/arm/mach-omap2/opp3xxx_data.c
arch/arm/mach-omap2/pm-debug.c
arch/arm/mach-omap2/pm.c
arch/arm/mach-omap2/pm24xx.c
arch/arm/mach-omap2/pm34xx.c
arch/arm/mach-omap2/pm44xx.c
arch/arm/mach-omap2/pmu.c
arch/arm/mach-omap2/powerdomain.c
arch/arm/mach-omap2/powerdomain.h
arch/arm/mach-omap2/powerdomain2xxx_3xxx.c [deleted file]
arch/arm/mach-omap2/powerdomain33xx.c [deleted file]
arch/arm/mach-omap2/powerdomain44xx.c [deleted file]
arch/arm/mach-omap2/powerdomains2xxx_data.c
arch/arm/mach-omap2/prcm-common.h
arch/arm/mach-omap2/prcm.c [deleted file]
arch/arm/mach-omap2/prcm_mpu44xx.c
arch/arm/mach-omap2/prcm_mpu44xx.h
arch/arm/mach-omap2/prm-regbits-24xx.h
arch/arm/mach-omap2/prm-regbits-34xx.h
arch/arm/mach-omap2/prm.h
arch/arm/mach-omap2/prm2xxx.c [new file with mode: 0644]
arch/arm/mach-omap2/prm2xxx.h [new file with mode: 0644]
arch/arm/mach-omap2/prm2xxx_3xxx.c
arch/arm/mach-omap2/prm2xxx_3xxx.h
arch/arm/mach-omap2/prm33xx.c
arch/arm/mach-omap2/prm3xxx.c [new file with mode: 0644]
arch/arm/mach-omap2/prm3xxx.h [new file with mode: 0644]
arch/arm/mach-omap2/prm44xx.c
arch/arm/mach-omap2/prm44xx.h
arch/arm/mach-omap2/prm_common.c
arch/arm/mach-omap2/prminst44xx.h
arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h
arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h
arch/arm/mach-omap2/sdram-nokia.c
arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h
arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h
arch/arm/mach-omap2/sdrc.c
arch/arm/mach-omap2/sdrc.h
arch/arm/mach-omap2/sdrc2xxx.c
arch/arm/mach-omap2/serial.c
arch/arm/mach-omap2/serial.h [new file with mode: 0644]
arch/arm/mach-omap2/sleep34xx.S
arch/arm/mach-omap2/soc.h
arch/arm/mach-omap2/sr_device.c
arch/arm/mach-omap2/sram.c [new file with mode: 0644]
arch/arm/mach-omap2/sram.h [new file with mode: 0644]
arch/arm/mach-omap2/sram242x.S
arch/arm/mach-omap2/sram243x.S
arch/arm/mach-omap2/sram34xx.S
arch/arm/mach-omap2/ti81xx.h
arch/arm/mach-omap2/timer.c
arch/arm/mach-omap2/twl-common.c
arch/arm/mach-omap2/usb-host.c
arch/arm/mach-omap2/usb-musb.c
arch/arm/mach-omap2/usb-tusb6010.c
arch/arm/mach-omap2/usb.h [new file with mode: 0644]
arch/arm/mach-omap2/wd_timer.c
arch/arm/mach-omap2/wd_timer.h
arch/arm/mach-ux500/board-mop500-stuib.c
arch/arm/mach-ux500/board-mop500.c
arch/arm/mach-ux500/board-mop500.h
arch/arm/mach-ux500/cpu-db8500.c
arch/arm/mach-ux500/cpu.c
arch/arm/mm/alignment.c
arch/arm/plat-mxc/Kconfig [deleted file]
arch/arm/plat-mxc/Makefile [deleted file]
arch/arm/plat-mxc/include/mach/irqs.h [deleted file]
arch/arm/plat-mxc/include/mach/timex.h [deleted file]
arch/arm/plat-mxc/include/mach/uncompress.h [deleted file]
arch/arm/plat-omap/Makefile
arch/arm/plat-omap/clock.c [deleted file]
arch/arm/plat-omap/common.c [deleted file]
arch/arm/plat-omap/counter_32k.c
arch/arm/plat-omap/debug-devices.c
arch/arm/plat-omap/debug-leds.c
arch/arm/plat-omap/dma.c
arch/arm/plat-omap/dmtimer.c
arch/arm/plat-omap/fb.c
arch/arm/plat-omap/i2c.c
arch/arm/plat-omap/include/plat-omap/dma-omap.h [moved from arch/arm/plat-omap/include/plat/dma.h with 60% similarity]
arch/arm/plat-omap/include/plat/clkdev_omap.h [deleted file]
arch/arm/plat-omap/include/plat/clock.h [deleted file]
arch/arm/plat-omap/include/plat/common.h [deleted file]
arch/arm/plat-omap/include/plat/counter-32k.h [new file with mode: 0644]
arch/arm/plat-omap/include/plat/cpu.h
arch/arm/plat-omap/include/plat/debug-devices.h [moved from arch/arm/mach-omap2/debug-devices.h with 54% similarity]
arch/arm/plat-omap/include/plat/dma-44xx.h [deleted file]
arch/arm/plat-omap/include/plat/dmtimer.h
arch/arm/plat-omap/include/plat/fpga.h [deleted file]
arch/arm/plat-omap/include/plat/i2c.h
arch/arm/plat-omap/include/plat/multi.h [deleted file]
arch/arm/plat-omap/include/plat/omap-secure.h [deleted file]
arch/arm/plat-omap/include/plat/prcm.h [deleted file]
arch/arm/plat-omap/include/plat/sdrc.h [deleted file]
arch/arm/plat-omap/include/plat/sram.h
arch/arm/plat-omap/include/plat/uncompress.h [deleted file]
arch/arm/plat-omap/include/plat/usb.h [deleted file]
arch/arm/plat-omap/sram.c
arch/arm/plat-omap/sram.h [deleted file]
arch/arm/vfp/vfpmodule.c
arch/arm/xen/enlighten.c
arch/arm/xen/hypercall.S
arch/arm64/Kconfig
arch/arm64/include/asm/elf.h
arch/arm64/include/asm/fpsimd.h
arch/arm64/include/asm/io.h
arch/arm64/include/asm/processor.h
arch/arm64/include/asm/unistd.h
arch/arm64/kernel/perf_event.c
arch/arm64/kernel/process.c
arch/arm64/kernel/smp.c
arch/arm64/mm/init.c
arch/frv/Kconfig
arch/frv/boot/Makefile
arch/frv/include/asm/unistd.h
arch/frv/kernel/entry.S
arch/frv/kernel/process.c
arch/frv/mb93090-mb00/pci-dma-nommu.c
arch/h8300/include/asm/cache.h
arch/s390/include/asm/cio.h
arch/s390/include/asm/pgtable.h
arch/s390/kernel/sclp.S
arch/s390/lib/uaccess_pt.c
arch/s390/mm/gup.c
arch/sparc/Kconfig
arch/sparc/crypto/Makefile
arch/sparc/crypto/aes_glue.c
arch/sparc/crypto/camellia_glue.c
arch/sparc/crypto/crc32c_glue.c
arch/sparc/crypto/des_glue.c
arch/sparc/crypto/md5_glue.c
arch/sparc/crypto/sha1_glue.c
arch/sparc/crypto/sha256_glue.c
arch/sparc/crypto/sha512_glue.c
arch/sparc/include/asm/atomic_64.h
arch/sparc/include/asm/backoff.h
arch/sparc/include/asm/compat.h
arch/sparc/include/asm/processor_64.h
arch/sparc/include/asm/prom.h
arch/sparc/include/asm/thread_info_64.h
arch/sparc/include/asm/ttable.h
arch/sparc/include/uapi/asm/unistd.h
arch/sparc/kernel/entry.h
arch/sparc/kernel/leon_kernel.c
arch/sparc/kernel/perf_event.c
arch/sparc/kernel/process_64.c
arch/sparc/kernel/ptrace_64.c
arch/sparc/kernel/setup_64.c
arch/sparc/kernel/sys_sparc_64.c
arch/sparc/kernel/systbls_32.S
arch/sparc/kernel/systbls_64.S
arch/sparc/kernel/unaligned_64.c
arch/sparc/kernel/visemul.c
arch/sparc/kernel/vmlinux.lds.S
arch/sparc/kernel/winfixup.S
arch/sparc/lib/atomic_64.S
arch/sparc/lib/ksyms.c
arch/sparc/math-emu/math_64.c
arch/x86/include/asm/xen/hypercall.h
arch/x86/include/asm/xen/hypervisor.h
arch/x86/kvm/x86.c
arch/x86/xen/mmu.c
arch/xtensa/Kconfig
arch/xtensa/include/asm/io.h
arch/xtensa/include/asm/processor.h
arch/xtensa/include/asm/syscall.h
arch/xtensa/include/asm/unistd.h
arch/xtensa/include/uapi/asm/unistd.h
arch/xtensa/kernel/entry.S
arch/xtensa/kernel/process.c
arch/xtensa/kernel/syscall.c
arch/xtensa/kernel/xtensa_ksyms.c
block/Kconfig
block/blk-cgroup.c
block/blk-core.c
crypto/cryptd.c
drivers/acpi/video.c
drivers/base/platform.c
drivers/block/Kconfig
drivers/block/cciss.c
drivers/block/floppy.c
drivers/block/loop.c
drivers/block/mtip32xx/mtip32xx.c
drivers/block/mtip32xx/mtip32xx.h
drivers/block/xen-blkback/common.h
drivers/block/xen-blkback/xenbus.c
drivers/bluetooth/hci_ldisc.c
drivers/char/hw_random/omap-rng.c
drivers/cpufreq/powernow-k8.c
drivers/crypto/omap-aes.c
drivers/crypto/omap-sham.c
drivers/dma/imx-dma.c
drivers/dma/imx-sdma.c
drivers/dma/ipu/ipu_idmac.c
drivers/dma/ipu/ipu_irq.c
drivers/dma/omap-dma.c
drivers/gpio/Kconfig
drivers/gpio/gpio-74x164.c
drivers/gpio/gpio-mvebu.c
drivers/gpio/gpio-omap.c
drivers/gpio/gpio-timberdale.c
drivers/gpio/gpiolib.c
drivers/gpu/drm/drm_fops.c
drivers/gpu/drm/exynos/Kconfig
drivers/gpu/drm/exynos/exynos_drm_connector.c
drivers/gpu/drm/exynos/exynos_drm_encoder.c
drivers/gpu/drm/exynos/exynos_mixer.c
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/intel_crt.c
drivers/gpu/drm/i915/intel_overlay.c
drivers/gpu/drm/i915/intel_panel.c
drivers/gpu/drm/i915/intel_sdvo.c
drivers/gpu/drm/i915/intel_sdvo_regs.h
drivers/gpu/drm/nouveau/core/core/mm.c
drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
drivers/gpu/drm/nouveau/core/engine/graph/nv40.c
drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c
drivers/gpu/drm/nouveau/core/include/core/mm.h
drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c
drivers/gpu/drm/nouveau/core/subdev/i2c/base.c
drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c
drivers/gpu/drm/nouveau/nouveau_connector.c
drivers/gpu/drm/nouveau/nouveau_display.c
drivers/gpu/drm/nouveau/nouveau_drm.c
drivers/gpu/drm/nouveau/nouveau_drm.h
drivers/gpu/drm/nouveau/nouveau_irq.c
drivers/gpu/drm/nouveau/nv04_dac.c
drivers/gpu/drm/nouveau/nv04_dfp.c
drivers/gpu/drm/nouveau/nv04_tv.c
drivers/gpu/drm/radeon/atombios_crtc.c
drivers/gpu/drm/radeon/evergreen.c
drivers/gpu/drm/radeon/evergreen_cs.c
drivers/gpu/drm/radeon/evergreend.h
drivers/gpu/drm/radeon/radeon_atpx_handler.c
drivers/gpu/drm/radeon/radeon_connectors.c
drivers/gpu/drm/radeon/radeon_legacy_crtc.c
drivers/gpu/drm/radeon/radeon_legacy_encoders.c
drivers/gpu/drm/radeon/si.c
drivers/gpu/drm/radeon/sid.h
drivers/gpu/drm/udl/udl_drv.h
drivers/gpu/drm/udl/udl_fb.c
drivers/gpu/drm/udl/udl_transfer.c
drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
drivers/hid/hid-apple.c
drivers/hid/hid-core.c
drivers/hid/hid-ids.h
drivers/hid/hid-microsoft.c
drivers/hid/hid-multitouch.c
drivers/hid/hidraw.c
drivers/hwmon/asb100.c
drivers/hwmon/fam15h_power.c
drivers/hwmon/gpio-fan.c
drivers/hwmon/w83627ehf.c
drivers/hwmon/w83627hf.c
drivers/hwmon/w83781d.c
drivers/hwmon/w83791d.c
drivers/hwmon/w83792d.c
drivers/hwmon/w83l786ng.c
drivers/i2c/Makefile
drivers/i2c/busses/Kconfig
drivers/i2c/busses/Makefile
drivers/i2c/busses/i2c-i801.c
drivers/i2c/busses/i2c-imx.c
drivers/i2c/busses/i2c-mxs.c
drivers/i2c/busses/i2c-nomadik.c
drivers/i2c/busses/i2c-tegra.c
drivers/i2c/i2c-stub.c [moved from drivers/i2c/busses/i2c-stub.c with 75% similarity]
drivers/input/keyboard/Kconfig
drivers/input/keyboard/pxa27x_keypad.c
drivers/input/misc/xen-kbdfront.c
drivers/input/mouse/bcm5974.c
drivers/input/tablet/wacom_sys.c
drivers/input/tablet/wacom_wac.c
drivers/input/touchscreen/Kconfig
drivers/input/touchscreen/egalax_ts.c
drivers/input/touchscreen/tsc40.c
drivers/isdn/Kconfig
drivers/isdn/i4l/Kconfig
drivers/isdn/i4l/isdn_common.c
drivers/md/faulty.c
drivers/md/raid1.c
drivers/md/raid10.c
drivers/media/platform/omap/omap_vout.c
drivers/media/platform/omap/omap_vout_vrfb.c
drivers/media/platform/omap/omap_voutdef.h
drivers/media/platform/omap3isp/isphist.c
drivers/media/platform/omap3isp/ispstat.h
drivers/media/platform/omap3isp/ispvideo.c
drivers/media/platform/soc_camera/mx2_camera.c
drivers/media/platform/soc_camera/mx3_camera.c
drivers/media/platform/soc_camera/omap1_camera.c
drivers/media/rc/ir-rx51.c
drivers/mfd/menelaus.c
drivers/mfd/omap-usb-host.c
drivers/mfd/omap-usb-tll.c
drivers/mfd/omap-usb.h [new file with mode: 0644]
drivers/mmc/host/dw_mmc-exynos.c
drivers/mmc/host/dw_mmc-pltfm.c
drivers/mmc/host/dw_mmc-pltfm.h
drivers/mmc/host/dw_mmc.c
drivers/mmc/host/mxcmmc.c
drivers/mmc/host/omap.c
drivers/mmc/host/omap_hsmmc.c
drivers/mmc/host/sdhci-dove.c
drivers/mmc/host/sdhci-of-esdhc.c
drivers/mmc/host/sdhci-pci.c
drivers/mmc/host/sdhci-pltfm.c
drivers/mmc/host/sdhci-s3c.c
drivers/mmc/host/sdhci.c
drivers/mmc/host/sdhci.h
drivers/mmc/host/sh_mmcif.c
drivers/mtd/nand/mxc_nand.c
drivers/mtd/nand/omap2.c
drivers/mtd/onenand/omap2.c
drivers/net/bonding/bond_sysfs.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
drivers/net/ethernet/freescale/gianfar.c
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
drivers/net/ethernet/jme.c
drivers/net/ethernet/marvell/skge.c
drivers/net/ethernet/micrel/ksz884x.c
drivers/net/ethernet/nxp/lpc_eth.c
drivers/net/ethernet/realtek/r8169.c
drivers/net/ethernet/xilinx/xilinx_axienet_main.c
drivers/net/phy/mdio-bitbang.c
drivers/net/usb/cdc_eem.c
drivers/net/usb/smsc95xx.c
drivers/net/usb/usbnet.c
drivers/net/vmxnet3/vmxnet3_drv.c
drivers/net/vxlan.c
drivers/net/wireless/ath/ath9k/xmit.c
drivers/net/wireless/b43legacy/pio.c
drivers/net/wireless/rt2x00/rt2800lib.c
drivers/pci/bus.c
drivers/pci/pci-driver.c
drivers/pci/pci-sysfs.c
drivers/pci/pci.c
drivers/pci/pci.h
drivers/pci/pcie/aer/aerdrv_core.c
drivers/pci/pcie/portdrv_core.c
drivers/pci/proc.c
drivers/pcmcia/omap_cf.c
drivers/pinctrl/Kconfig
drivers/pinctrl/spear/pinctrl-spear.c
drivers/pinctrl/spear/pinctrl-spear1310.c
drivers/pinctrl/spear/pinctrl-spear1340.c
drivers/pinctrl/spear/pinctrl-spear320.c
drivers/pinctrl/spear/pinctrl-spear3xx.h
drivers/rtc/rtc-mxc.c
drivers/s390/cio/css.h
drivers/s390/cio/device.c
drivers/s390/cio/idset.c
drivers/scsi/qla2xxx/qla_mid.c
drivers/scsi/qla2xxx/qla_target.c
drivers/scsi/qla2xxx/qla_target.h
drivers/scsi/qla2xxx/tcm_qla2xxx.c
drivers/scsi/qla2xxx/tcm_qla2xxx.h
drivers/scsi/qlogicpti.c
drivers/staging/tidspbridge/include/dspbridge/host_os.h
drivers/target/iscsi/iscsi_target.c
drivers/target/iscsi/iscsi_target_core.h
drivers/target/iscsi/iscsi_target_login.c
drivers/target/iscsi/iscsi_target_util.c
drivers/target/iscsi/iscsi_target_util.h
drivers/target/target_core_configfs.c
drivers/target/target_core_device.c
drivers/target/target_core_sbc.c
drivers/target/target_core_spc.c
drivers/target/target_core_tmr.c
drivers/target/target_core_transport.c
drivers/thermal/exynos_thermal.c
drivers/thermal/rcar_thermal.c
drivers/tty/n_tty.c
drivers/tty/pty.c
drivers/tty/serial/8250/8250.c
drivers/tty/serial/8250/8250.h
drivers/tty/serial/8250/8250_early.c
drivers/tty/serial/samsung.c
drivers/tty/tty_audit.c
drivers/tty/tty_buffer.c
drivers/tty/tty_io.c
drivers/tty/tty_ldisc.c
drivers/tty/tty_port.c
drivers/tty/vt/selection.c
drivers/usb/gadget/omap_udc.c
drivers/usb/gadget/u_ether.c
drivers/usb/host/ehci-mxc.c
drivers/usb/host/ehci-omap.c
drivers/usb/host/ohci-omap.c
drivers/usb/host/ohci-omap3.c
drivers/usb/musb/am35x.c
drivers/usb/musb/musb_dsps.c
drivers/usb/musb/omap2430.h
drivers/usb/musb/tusb6010_omap.c
drivers/video/imxfb.c
drivers/video/mx3fb.c
drivers/video/omap/lcd_inn1510.c
drivers/video/omap/lcdc.c
drivers/video/omap/omapfb_main.c
drivers/video/omap/sossi.c
drivers/video/omap2/dss/core.c
drivers/video/omap2/dss/dispc.c
drivers/video/omap2/dss/dss.c
drivers/video/omap2/dss/dss_features.c
drivers/video/omap2/dss/dss_features.h
drivers/video/omap2/dss/hdmi.c
drivers/video/omap2/omapfb/omapfb-ioctl.c
drivers/video/omap2/omapfb/omapfb-main.c
drivers/video/omap2/omapfb/omapfb-sysfs.c
drivers/video/omap2/vrfb.c
drivers/video/xen-fbfront.c
drivers/virtio/virtio.c
drivers/watchdog/imx2_wdt.c
drivers/watchdog/omap_wdt.c
drivers/xen/Makefile
drivers/xen/events.c
drivers/xen/fallback.c [new file with mode: 0644]
drivers/xen/gntdev.c
drivers/xen/xenbus/xenbus_dev_frontend.c
fs/bio.c
fs/ceph/export.c
fs/cifs/cifsacl.c
fs/cifs/dir.c
fs/devpts/inode.c
fs/eventpoll.c
fs/ext4/ialloc.c
fs/file.c
fs/gfs2/file.c
fs/gfs2/lops.c
fs/gfs2/quota.c
fs/gfs2/rgrp.c
fs/gfs2/super.c
fs/gfs2/trans.c
fs/nfs/dns_resolve.c
fs/nfs/inode.c
fs/nfs/internal.h
fs/nfs/mount_clnt.c
fs/nfs/namespace.c
fs/nfs/nfs4namespace.c
fs/nfs/nfs4proc.c
fs/nfs/pnfs.c
fs/nfs/super.c
fs/nfs/unlink.c
fs/notify/fanotify/fanotify.c
fs/xfs/xfs_alloc.c
fs/xfs/xfs_alloc.h
fs/xfs/xfs_alloc_btree.c
fs/xfs/xfs_bmap.c
fs/xfs/xfs_bmap.h
fs/xfs/xfs_buf_item.c
fs/xfs/xfs_fsops.c
fs/xfs/xfs_ialloc.c
fs/xfs/xfs_inode.c
fs/xfs/xfs_ioctl.c
fs/xfs/xfs_iomap.c
fs/xfs/xfs_log.c
fs/xfs/xfs_log_recover.c
include/linux/devpts_fs.h
include/linux/dma/ipu-dma.h [moved from arch/arm/plat-mxc/include/mach/ipu.h with 97% similarity]
include/linux/hashtable.h [new file with mode: 0644]
include/linux/kvm_host.h
include/linux/mfd/menelaus.h [moved from arch/arm/plat-omap/include/plat/menelaus.h with 96% similarity]
include/linux/mmc/dw_mmc.h
include/linux/mmc/sdhci.h
include/linux/of_address.h
include/linux/platform_data/asoc-imx-ssi.h
include/linux/platform_data/dma-imx.h
include/linux/platform_data/gpio-omap.h
include/linux/platform_data/leds-omap.h [moved from arch/arm/plat-omap/include/plat/led.h with 91% similarity]
include/linux/platform_data/mmc-omap.h [moved from arch/arm/plat-omap/include/plat/mmc.h with 80% similarity]
include/linux/platform_data/mtd-nand-omap2.h
include/linux/platform_data/mtd-onenand-omap2.h
include/linux/platform_data/omap-wd-timer.h [new file with mode: 0644]
include/linux/platform_data/usb-omap.h [new file with mode: 0644]
include/linux/ptp_clock_kernel.h
include/linux/raid/Kbuild
include/linux/raid/md_u.h
include/linux/tty.h
include/linux/tty_flip.h
include/net/cfg80211.h
include/sound/core.h
include/trace/events/xen.h
include/uapi/linux/eventpoll.h
include/uapi/linux/raid/Kbuild
include/uapi/linux/raid/md_p.h [moved from include/linux/raid/md_p.h with 100% similarity]
include/uapi/linux/raid/md_u.h [new file with mode: 0644]
include/video/omapdss.h
include/video/omapvrfb.h [moved from arch/arm/plat-omap/include/plat/vrfb.h with 95% similarity]
include/xen/hvm.h
init/main.c
kernel/module.c
kernel/printk.c
mm/vmscan.c
net/ceph/messenger.c
net/core/dev.c
net/core/rtnetlink.c
net/ipv4/inet_diag.c
net/ipv4/netfilter/iptable_nat.c
net/ipv4/tcp_illinois.c
net/ipv4/tcp_input.c
net/ipv4/tcp_metrics.c
net/ipv6/ip6_gre.c
net/ipv6/ndisc.c
net/ipv6/netfilter/ip6table_nat.c
net/ipv6/netfilter/nf_conntrack_reasm.c
net/l2tp/l2tp_eth.c
net/mac80211/ibss.c
net/mac80211/rx.c
net/mac80211/util.c
net/netfilter/nf_conntrack_h323_main.c
net/sched/sch_qfq.c
net/sctp/socket.c
net/sunrpc/backchannel_rqst.c
net/tipc/handler.c
net/wireless/core.c
net/wireless/reg.c
net/wireless/util.c
scripts/Makefile.modinst
scripts/checkpatch.pl
sound/core/compress_offload.c
sound/core/control.c
sound/core/hwdep.c
sound/core/init.c
sound/core/oss/mixer_oss.c
sound/core/oss/pcm_oss.c
sound/core/pcm.c
sound/core/pcm_native.c
sound/core/rawmidi.c
sound/core/sound.c
sound/core/sound_oss.c
sound/i2c/other/ak4113.c
sound/i2c/other/ak4114.c
sound/i2c/other/ak4117.c
sound/pci/es1968.c
sound/pci/hda/hda_intel.c
sound/pci/hda/patch_analog.c
sound/pci/hda/patch_cirrus.c
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_sigmatel.c
sound/pci/hda/patch_via.c
sound/pci/ice1712/ice1724.c
sound/pci/rme9652/hdspm.c
sound/soc/codecs/cs42l52.c
sound/soc/codecs/wm8994.c
sound/soc/fsl/imx-pcm-fiq.c
sound/soc/fsl/imx-ssi.c
sound/soc/omap/am3517evm.c
sound/soc/omap/n810.c
sound/soc/omap/omap-dmic.c
sound/soc/omap/omap-pcm.c
sound/soc/omap/osk5912.c
sound/soc/omap/sdp3430.c
sound/soc/omap/zoom2.c
sound/usb/card.c
sound/usb/card.h
sound/usb/endpoint.c
sound/usb/endpoint.h
sound/usb/mixer.c
sound/usb/mixer_quirks.c
sound/usb/pcm.c
sound/usb/proc.c
sound/usb/stream.c
sound/usb/usbaudio.h
tools/testing/selftests/Makefile
tools/testing/selftests/epoll/Makefile [deleted file]
tools/testing/selftests/epoll/test_epoll.c [deleted file]

index dbbdcbba75a34005ced4edea51e7a9a308aec1e6..4110cca96bd608f1b9d246d31fd482f503c2c5b4 100644 (file)
@@ -27,17 +27,17 @@ Start                       End                     Size            Use
 -----------------------------------------------------------------------
 0000000000000000       0000007fffffffff         512GB          user
 
-ffffff8000000000       ffffffbbfffcffff        ~240GB          vmalloc
+ffffff8000000000       ffffffbbfffeffff        ~240GB          vmalloc
 
-ffffffbbfffd0000       ffffffbcfffdffff          64KB          [guard page]
+ffffffbbffff0000       ffffffbbffffffff          64KB          [guard page]
 
-ffffffbbfffe0000       ffffffbcfffeffff          64KB          PCI I/O space
+ffffffbc00000000       ffffffbdffffffff           8GB          vmemmap
 
-ffffffbbffff0000       ffffffbcffffffff          64KB          [guard page]
+ffffffbe00000000       ffffffbffbbfffff          ~8GB          [guard, future vmmemap]
 
-ffffffbc00000000       ffffffbdffffffff           8GB          vmemmap
+ffffffbffbe00000       ffffffbffbe0ffff          64KB          PCI I/O space
 
-ffffffbe00000000       ffffffbffbffffff          ~8GB          [guard, future vmmemap]
+ffffffbbffff0000       ffffffbcffffffff          ~2MB          [guard]
 
 ffffffbffc000000       ffffffbfffffffff          64MB          modules
 
diff --git a/Documentation/devicetree/bindings/arm/omap/counter.txt b/Documentation/devicetree/bindings/arm/omap/counter.txt
new file mode 100644 (file)
index 0000000..5bd8aa0
--- /dev/null
@@ -0,0 +1,15 @@
+OMAP Counter-32K bindings
+
+Required properties:
+- compatible:  Must be "ti,omap-counter32k" for OMAP controllers
+- reg:         Contains timer register address range (base address and length)
+- ti,hwmods:   Name of the hwmod associated to the counter, which is typically
+               "counter_32k"
+
+Example:
+
+counter32k: counter@4a304000 {
+       compatible = "ti,omap-counter32k";
+       reg = <0x4a304000 0x20>;
+       ti,hwmods = "counter_32k";
+};
diff --git a/Documentation/devicetree/bindings/arm/omap/timer.txt b/Documentation/devicetree/bindings/arm/omap/timer.txt
new file mode 100644 (file)
index 0000000..8732d4d
--- /dev/null
@@ -0,0 +1,31 @@
+OMAP Timer bindings
+
+Required properties:
+- compatible:          Must be "ti,omap2-timer" for OMAP2+ controllers.
+- reg:                 Contains timer register address range (base address and
+                       length).
+- interrupts:          Contains the interrupt information for the timer. The
+                       format is being dependent on which interrupt controller
+                       the OMAP device uses.
+- ti,hwmods:           Name of the hwmod associated to the timer, "timer<X>",
+                       where <X> is the instance number of the timer from the
+                       HW spec.
+
+Optional properties:
+- ti,timer-alwon:      Indicates the timer is in an alway-on power domain.
+- ti,timer-dsp:                Indicates the timer can interrupt the on-chip DSP in
+                       addition to the ARM CPU.
+- ti,timer-pwm:        Indicates the timer can generate a PWM output.
+- ti,timer-secure:     Indicates the timer is reserved on a secure OMAP device
+                       and therefore cannot be used by the kernel.
+
+Example:
+
+timer12: timer@48304000 {
+       compatible = "ti,omap2-timer";
+       reg = <0x48304000 0x400>;
+       interrupts = <95>;
+       ti,hwmods = "timer12"
+       ti,timer-alwon;
+       ti,timer-secure;
+};
index d2fe064a828b7d453d45876f66039e4a121f1a7c..63dd8051521c32d3674db1044ab75d01535ee074 100644 (file)
@@ -2,9 +2,27 @@
 
 properties:
 - compatible : Should be "ti,omap-ocp2scp"
+- reg : Address and length of the register set for the device
 - #address-cells, #size-cells : Must be present if the device has sub-nodes
 - ranges : the child address space are mapped 1:1 onto the parent address space
 - ti,hwmods : must be "ocp2scp_usb_phy"
 
 Sub-nodes:
 All the devices connected to ocp2scp are described using sub-node to ocp2scp
+
+ocp2scp@4a0ad000 {
+       compatible = "ti,omap-ocp2scp";
+       reg = <0x4a0ad000 0x1f>;
+       #address-cells = <1>;
+       #size-cells = <1>;
+       ranges;
+       ti,hwmods = "ocp2scp_usb_phy";
+
+       subnode1 {
+       ...
+       };
+
+       subnode2 {
+       ...
+       };
+};
diff --git a/Documentation/devicetree/bindings/clock/imx25-clock.txt b/Documentation/devicetree/bindings/clock/imx25-clock.txt
new file mode 100644 (file)
index 0000000..c2a3525
--- /dev/null
@@ -0,0 +1,162 @@
+* Clock bindings for Freescale i.MX25
+
+Required properties:
+- compatible: Should be "fsl,imx25-ccm"
+- reg: Address and length of the register set
+- interrupts: Should contain CCM interrupt
+- #clock-cells: Should be <1>
+
+The clock consumer should specify the desired clock by having the clock
+ID in its "clocks" phandle cell.  The following is a full list of i.MX25
+clocks and IDs.
+
+       Clock                   ID
+       ---------------------------
+       dummy                   0
+       osc                     1
+       mpll                    2
+       upll                    3
+       mpll_cpu_3_4            4
+       cpu_sel                 5
+       cpu                     6
+       ahb                     7
+       usb_div                 8
+       ipg                     9
+       per0_sel                10
+       per1_sel                11
+       per2_sel                12
+       per3_sel                13
+       per4_sel                14
+       per5_sel                15
+       per6_sel                16
+       per7_sel                17
+       per8_sel                18
+       per9_sel                19
+       per10_sel               20
+       per11_sel               21
+       per12_sel               22
+       per13_sel               23
+       per14_sel               24
+       per15_sel               25
+       per0                    26
+       per1                    27
+       per2                    28
+       per3                    29
+       per4                    30
+       per5                    31
+       per6                    32
+       per7                    33
+       per8                    34
+       per9                    35
+       per10                   36
+       per11                   37
+       per12                   38
+       per13                   39
+       per14                   40
+       per15                   41
+       csi_ipg_per             42
+       epit_ipg_per            43
+       esai_ipg_per            44
+       esdhc1_ipg_per          45
+       esdhc2_ipg_per          46
+       gpt_ipg_per             47
+       i2c_ipg_per             48
+       lcdc_ipg_per            49
+       nfc_ipg_per             50
+       owire_ipg_per           51
+       pwm_ipg_per             52
+       sim1_ipg_per            53
+       sim2_ipg_per            54
+       ssi1_ipg_per            55
+       ssi2_ipg_per            56
+       uart_ipg_per            57
+       ata_ahb                 58
+       reserved                59
+       csi_ahb                 60
+       emi_ahb                 61
+       esai_ahb                62
+       esdhc1_ahb              63
+       esdhc2_ahb              64
+       fec_ahb                 65
+       lcdc_ahb                66
+       rtic_ahb                67
+       sdma_ahb                68
+       slcdc_ahb               69
+       usbotg_ahb              70
+       reserved                71
+       reserved                72
+       reserved                73
+       reserved                74
+       can1_ipg                75
+       can2_ipg                76
+       csi_ipg                 77
+       cspi1_ipg               78
+       cspi2_ipg               79
+       cspi3_ipg               80
+       dryice_ipg              81
+       ect_ipg                 82
+       epit1_ipg               83
+       epit2_ipg               84
+       reserved                85
+       esdhc1_ipg              86
+       esdhc2_ipg              87
+       fec_ipg                 88
+       reserved                89
+       reserved                90
+       reserved                91
+       gpt1_ipg                92
+       gpt2_ipg                93
+       gpt3_ipg                94
+       gpt4_ipg                95
+       reserved                96
+       reserved                97
+       reserved                98
+       iim_ipg                 99
+       reserved                100
+       reserved                101
+       kpp_ipg                 102
+       lcdc_ipg                103
+       reserved                104
+       pwm1_ipg                105
+       pwm2_ipg                106
+       pwm3_ipg                107
+       pwm4_ipg                108
+       rngb_ipg                109
+       reserved                110
+       scc_ipg                 111
+       sdma_ipg                112
+       sim1_ipg                113
+       sim2_ipg                114
+       slcdc_ipg               115
+       spba_ipg                116
+       ssi1_ipg                117
+       ssi2_ipg                118
+       tsc_ipg                 119
+       uart1_ipg               120
+       uart2_ipg               121
+       uart3_ipg               122
+       uart4_ipg               123
+       uart5_ipg               124
+       reserved                125
+       wdt_ipg                 126
+
+Examples:
+
+clks: ccm@53f80000 {
+       compatible = "fsl,imx25-ccm";
+       reg = <0x53f80000 0x4000>;
+       interrupts = <31>;
+       clock-output-names = ...
+                       "uart_ipg",
+                       "uart_serial",
+                       ...;
+};
+
+uart1: serial@43f90000 {
+       compatible = "fsl,imx25-uart", "fsl,imx21-uart";
+       reg = <0x43f90000 0x4000>;
+       interrupts = <45>;
+       clocks = <&clks 79>, <&clks 50>;
+       clock-names = "ipg", "per";
+       status = "disabled";
+};
index f3cf43b66f7e0e45da4402e6181a8487e0f26329..3614242e77321d376b9411c2f3a6168408315605 100644 (file)
@@ -12,13 +12,13 @@ Optional properties:
 Examples:
 
 i2c@83fc4000 { /* I2C2 on i.MX51 */
-       compatible = "fsl,imx51-i2c", "fsl,imx1-i2c";
+       compatible = "fsl,imx51-i2c", "fsl,imx21-i2c";
        reg = <0x83fc4000 0x4000>;
        interrupts = <63>;
 };
 
 i2c@70038000 { /* HS-I2C on i.MX51 */
-       compatible = "fsl,imx51-i2c", "fsl,imx1-i2c";
+       compatible = "fsl,imx51-i2c", "fsl,imx21-i2c";
        reg = <0x70038000 0x4000>;
        interrupts = <64>;
        clock-frequency = <400000>;
index 2f5322b119ebdb6116ff4c5c9b20e50a1b5fae88..446859fcdca4c55066c92920cb0f5cd240f346d6 100644 (file)
@@ -55,5 +55,7 @@ st-micro,24c256               i2c serial eeprom  (24cxx)
 stm,m41t00             Serial Access TIMEKEEPER
 stm,m41t62             Serial real-time clock (RTC) with alarm
 stm,m41t80             M41T80 - SERIAL ACCESS RTC WITH ALARMS
+taos,tsl2550           Ambient Light Sensor with SMBUS/Two Wire Serial Interface
 ti,tsc2003             I2C Touch-Screen Controller
 ti,tmp102              Low Power Digital Temperature Sensor with SMBUS/Two Wire Serial Interface
+ti,tmp275              Digital Temperature Sensor
diff --git a/Documentation/devicetree/bindings/input/touchscreen/bu21013.txt b/Documentation/devicetree/bindings/input/touchscreen/bu21013.txt
new file mode 100644 (file)
index 0000000..ca5a2c8
--- /dev/null
@@ -0,0 +1,28 @@
+* Rohm BU21013 Touch Screen
+
+Required properties:
+ - compatible              : "rohm,bu21013_tp"
+ - reg                     :  I2C device address
+
+Optional properties:
+ - touch-gpio              : GPIO pin registering a touch event
+ - <supply_name>-supply    : Phandle to a regulator supply
+ - rohm,touch-max-x        : Maximum outward permitted limit in the X axis
+ - rohm,touch-max-y        : Maximum outward permitted limit in the Y axis
+ - rohm,flip-x             : Flip touch coordinates on the X axis
+ - rohm,flip-y             : Flip touch coordinates on the Y axis
+
+Example:
+
+       i2c@80110000 {
+               bu21013_tp@0x5c {
+                       compatible = "rohm,bu21013_tp";
+                       reg = <0x5c>;
+                       touch-gpio = <&gpio2 20 0x4>;
+                       avdd-supply = <&ab8500_ldo_aux1_reg>;
+
+                       rohm,touch-max-x = <384>;
+                       rohm,touch-max-y = <704>;
+                       rohm,flip-y;
+               };
+       };
diff --git a/Documentation/devicetree/bindings/input/touchscreen/egalax-ts.txt b/Documentation/devicetree/bindings/input/touchscreen/egalax-ts.txt
new file mode 100644 (file)
index 0000000..df70318
--- /dev/null
@@ -0,0 +1,19 @@
+* EETI eGalax Multiple Touch Controller
+
+Required properties:
+- compatible: must be "eeti,egalax_ts"
+- reg: i2c slave address
+- interrupt-parent: the phandle for the interrupt controller
+- interrupts: touch controller interrupt
+- wakeup-gpios: the gpio pin to be used for waking up the controller
+  as well as uased as irq pin
+
+Example:
+
+       egalax_ts@04 {
+               compatible = "eeti,egalax_ts";
+               reg = <0x04>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <9 2>;
+               wakeup-gpios = <&gpio1 9 0>;
+       };
index ca8fa56e9f03e6d5f6ad4a0f35885e9fb4fa66ed..707c1a2dae06dc9d5ee2c27c35a8129dfb30a9c0 100644 (file)
@@ -1,5 +1,7 @@
 AM33XX MUSB GLUE
  - compatible : Should be "ti,musb-am33xx"
+ - reg : offset and length of register sets, first usbss, then for musb instances
+ - interrupts : usbss, musb instance interrupts in order
  - ti,hwmods : must be "usb_otg_hs"
  - multipoint : Should be "1" indicating the musb controller supports
    multipoint. This is a MUSB configuration-specific setting.
@@ -12,3 +14,22 @@ AM33XX MUSB GLUE
    represents PERIPHERAL.
  - power : Should be "250". This signifies the controller can supply upto
    500mA when operating in host mode.
+
+Example:
+
+usb@47400000  {
+       compatible = "ti,musb-am33xx";
+       reg = <0x47400000 0x1000        /* usbss */
+              0x47401000 0x800         /* musb instance 0 */
+              0x47401800 0x800>;       /* musb instance 1 */
+       interrupts = <17                /* usbss */
+                     18                /* musb instance 0 */
+                     19>;              /* musb instance 1 */
+       multipoint = <1>;
+       num-eps = <16>;
+       ram-bits = <12>;
+       port0-mode = <3>;
+       port1-mode = <3>;
+       power = <250>;
+       ti,hwmods = "usb_otg_hs";
+};
index a92918e0bd6946f760af42cd984a28ee0e2db642..80654813d04afdf1e76d8388c8c51a1fb31ae825 100644 (file)
@@ -10,7 +10,7 @@ Supported chips:
   BIOS and Kernel Developer's Guide (BKDG) For AMD Family 15h Processors
     (not yet published)
 
-Author: Andreas Herrmann <andreas.herrmann3@amd.com>
+Author: Andreas Herrmann <herrmann.der.user@googlemail.com>
 
 Description
 -----------
index 1fa907441f8f44694ad7d3c5848805e42ee32fa4..99199e63f3497d67e8dfb4a10c7d206229ec4de3 100644 (file)
@@ -503,7 +503,7 @@ F:  include/linux/altera_uart.h
 F:     include/linux/altera_jtaguart.h
 
 AMD FAM15H PROCESSOR POWER MONITORING DRIVER
-M:     Andreas Herrmann <andreas.herrmann3@amd.com>
+M:     Andreas Herrmann <herrmann.der.user@googlemail.com>
 L:     lm-sensors@lm-sensors.org
 S:     Maintained
 F:     Documentation/hwmon/fam15h_power
@@ -797,7 +797,6 @@ L:  linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:     Maintained
 T:     git git://git.pengutronix.de/git/imx/linux-2.6.git
 F:     arch/arm/mach-imx/
-F:     arch/arm/plat-mxc/
 F:     arch/arm/configs/imx*_defconfig
 
 ARM/FREESCALE IMX6
@@ -2507,6 +2506,7 @@ M:        Joonyoung Shim <jy0922.shim@samsung.com>
 M:     Seung-Woo Kim <sw0312.kim@samsung.com>
 M:     Kyungmin Park <kyungmin.park@samsung.com>
 L:     dri-devel@lists.freedesktop.org
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git
 S:     Supported
 F:     drivers/gpu/drm/exynos
 F:     include/drm/exynos*
@@ -5647,7 +5647,7 @@ S:        Maintained
 F:     drivers/pinctrl/spear/
 
 PKTCDVD DRIVER
-M:     Peter Osterlund <petero2@telia.com>
+M:     Jiri Kosina <jkosina@suse.cz>
 S:     Maintained
 F:     drivers/block/pktcdvd.c
 F:     include/linux/pktcdvd.h
index 42d0e56818ea8d5f9f7b713ca6b1ba7436dbf8b4..6edac73ee1baeebd107c4a6ccfdbc4bd84330aaa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 3
 PATCHLEVEL = 7
 SUBLEVEL = 0
-EXTRAVERSION = -rc3
+EXTRAVERSION = -rc5
 NAME = Terrified Chipmunk
 
 # *DOCUMENTATION*
index ccfe0ab8c87702076afaf621963c730e1d34be3f..23252783e93f37bbdd78bb7bf3fa92a10b027ccd 100644 (file)
@@ -433,19 +433,6 @@ config ARCH_FOOTBRIDGE
          Support for systems based on the DC21285 companion chip
          ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder.
 
-config ARCH_MXC
-       bool "Freescale MXC/iMX-based"
-       select ARCH_REQUIRE_GPIOLIB
-       select CLKDEV_LOOKUP
-       select CLKSRC_MMIO
-       select GENERIC_CLOCKEVENTS
-       select GENERIC_IRQ_CHIP
-       select MULTI_IRQ_HANDLER
-       select SPARSE_IRQ
-       select USE_OF
-       help
-         Support for Freescale MXC/iMX-based family of processors
-
 config ARCH_MXS
        bool "Freescale MXS-based"
        select ARCH_REQUIRE_GPIOLIB
@@ -937,7 +924,6 @@ config ARCH_OMAP
        select CLKSRC_MMIO
        select GENERIC_CLOCKEVENTS
        select HAVE_CLK
-       select NEED_MACH_GPIO_H
        help
          Support for TI's OMAP platform (OMAP1/2/3/4).
 
@@ -1058,7 +1044,7 @@ source "arch/arm/mach-msm/Kconfig"
 
 source "arch/arm/mach-mv78xx0/Kconfig"
 
-source "arch/arm/plat-mxc/Kconfig"
+source "arch/arm/mach-imx/Kconfig"
 
 source "arch/arm/mach-mxs/Kconfig"
 
index 7754d51f2b19fc3f3be91355771de8b4569a7cef..5bbfcf0d35e0b59f868b8811c693e326590bc96d 100644 (file)
@@ -429,6 +429,14 @@ endchoice
 config DEBUG_LL_INCLUDE
        string
        default "debug/icedcc.S" if DEBUG_ICEDCC
+       default "debug/imx.S" if DEBUG_IMX1_UART || \
+                                DEBUG_IMX25_UART || \
+                                DEBUG_IMX21_IMX27_UART || \
+                                DEBUG_IMX31_IMX35_UART || \
+                                DEBUG_IMX51_UART || \
+                                DEBUG_IMX50_IMX53_UART ||\
+                                DEBUG_IMX6Q_UART2 || \
+                                DEBUG_IMX6Q_UART4
        default "debug/highbank.S" if DEBUG_HIGHBANK_UART
        default "debug/mvebu.S" if DEBUG_MVEBU_UART
        default "debug/picoxcell.S" if DEBUG_PICOXCELL_UART
index 554cfac414295fc15f3d3d2f9737a906b4ba1212..97252d86a7014d47ff00cb896d594e0364d68132 100644 (file)
@@ -196,7 +196,6 @@ machine-$(CONFIG_ARCH_ZYNQ)         += zynq
 
 # Platform directory name.  This list is sorted alphanumerically
 # by CONFIG_* macro name.
-plat-$(CONFIG_ARCH_MXC)                += mxc
 plat-$(CONFIG_ARCH_OMAP)       += omap
 plat-$(CONFIG_ARCH_S3C64XX)    += samsung
 plat-$(CONFIG_PLAT_IOP)                += iop
index 76ed11e68f72e379d4469db470bcb8bdc722a5f0..23b178389eb797185d79300def7e435d9f904e51 100644 (file)
@@ -63,15 +63,17 @@ dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \
        imx28-m28evk.dtb \
        imx28-tx28.dtb
 dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \
+       omap3-beagle.dtb \
        omap3-beagle-xm.dtb \
        omap3-evm.dtb \
        omap3-tobi.dtb \
        omap4-panda.dtb \
-       omap4-pandaES.dtb \
-       omap4-var_som.dtb \
+       omap4-panda-es.dtb \
+       omap4-var-som.dtb \
        omap4-sdp.dtb \
        omap5-evm.dtb \
        am335x-evm.dtb \
+       am335x-evmsk.dtb \
        am335x-bone.dtb
 dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb
 dtb-$(CONFIG_ARCH_U8500) += snowball.dtb
index c634f87e230e110422f246e9228a6a26cbbcb6cb..2c338889df1bd308e8e76da28148a0434a830ca0 100644 (file)
        model = "TI AM335x BeagleBone";
        compatible = "ti,am335x-bone", "ti,am33xx";
 
+       cpus {
+               cpu@0 {
+                       cpu0-supply = <&dcdc2_reg>;
+               };
+       };
+
        memory {
                device_type = "memory";
                reg = <0x80000000 0x10000000>; /* 256 MB */
        };
 
+       am33xx_pinmux: pinmux@44e10800 {
+               pinctrl-names = "default";
+               pinctrl-0 = <&user_leds_s0>;
+
+               user_leds_s0: user_leds_s0 {
+                       pinctrl-single,pins = <
+                               0x54 0x7        /* gpmc_a5.gpio1_21, OUTPUT | MODE7 */
+                               0x58 0x17       /* gpmc_a6.gpio1_22, OUTPUT_PULLUP | MODE7 */
+                               0x5c 0x7        /* gpmc_a7.gpio1_23, OUTPUT | MODE7 */
+                               0x60 0x17       /* gpmc_a8.gpio1_24, OUTPUT_PULLUP | MODE7 */
+                       >;
+               };
+       };
+
        ocp {
                uart1: serial@44e09000 {
                        status = "okay";
 
                };
        };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led@2 {
+                       label = "beaglebone:green:heartbeat";
+                       gpios = <&gpio2 21 0>;
+                       linux,default-trigger = "heartbeat";
+                       default-state = "off";
+               };
+
+               led@3 {
+                       label = "beaglebone:green:mmc0";
+                       gpios = <&gpio2 22 0>;
+                       linux,default-trigger = "mmc0";
+                       default-state = "off";
+               };
+
+               led@4 {
+                       label = "beaglebone:green:usr2";
+                       gpios = <&gpio2 23 0>;
+                       default-state = "off";
+               };
+
+               led@5 {
+                       label = "beaglebone:green:usr3";
+                       gpios = <&gpio2 24 0>;
+                       default-state = "off";
+               };
+       };
 };
 
 /include/ "tps65217.dtsi"
index 185d6325a458856768dde864a8c6f9921d9fd88f..9f65f17ebdf8f10452e28048a9c7a7af5a8e455c 100644 (file)
        model = "TI AM335x EVM";
        compatible = "ti,am335x-evm", "ti,am33xx";
 
+       cpus {
+               cpu@0 {
+                       cpu0-supply = <&vdd1_reg>;
+               };
+       };
+
        memory {
                device_type = "memory";
                reg = <0x80000000 0x10000000>; /* 256 MB */
        };
 
+       am33xx_pinmux: pinmux@44e10800 {
+               pinctrl-names = "default";
+               pinctrl-0 = <&matrix_keypad_s0 &volume_keys_s0>;
+
+               matrix_keypad_s0: matrix_keypad_s0 {
+                       pinctrl-single,pins = <
+                               0x54 0x7        /* gpmc_a5.gpio1_21, OUTPUT | MODE7 */
+                               0x58 0x7        /* gpmc_a6.gpio1_22, OUTPUT | MODE7 */
+                               0x64 0x27       /* gpmc_a9.gpio1_25, INPUT | MODE7 */
+                               0x68 0x27       /* gpmc_a10.gpio1_26, INPUT | MODE7 */
+                               0x6c 0x27       /* gpmc_a11.gpio1_27, INPUT | MODE7 */
+                       >;
+               };
+
+               volume_keys_s0: volume_keys_s0 {
+                       pinctrl-single,pins = <
+                               0x150 0x27      /* spi0_sclk.gpio0_2, INPUT | MODE7 */
+                               0x154 0x27      /* spi0_d0.gpio0_3, INPUT | MODE7 */
+                       >;
+               };
+       };
+
        ocp {
                uart1: serial@44e09000 {
                        status = "okay";
                                reg = <0x2d>;
                        };
                };
+
+               i2c2: i2c@4802a000 {
+                       status = "okay";
+                       clock-frequency = <100000>;
+
+                       lis331dlh: lis331dlh@18 {
+                               compatible = "st,lis331dlh", "st,lis3lv02d";
+                               reg = <0x18>;
+                               Vdd-supply = <&lis3_reg>;
+                               Vdd_IO-supply = <&lis3_reg>;
+
+                               st,click-single-x;
+                               st,click-single-y;
+                               st,click-single-z;
+                               st,click-thresh-x = <10>;
+                               st,click-thresh-y = <10>;
+                               st,click-thresh-z = <10>;
+                               st,irq1-click;
+                               st,irq2-click;
+                               st,wakeup-x-lo;
+                               st,wakeup-x-hi;
+                               st,wakeup-y-lo;
+                               st,wakeup-y-hi;
+                               st,wakeup-z-lo;
+                               st,wakeup-z-hi;
+                               st,min-limit-x = <120>;
+                               st,min-limit-y = <120>;
+                               st,min-limit-z = <140>;
+                               st,max-limit-x = <550>;
+                               st,max-limit-y = <550>;
+                               st,max-limit-z = <750>;
+                       };
+
+                       tsl2550: tsl2550@39 {
+                               compatible = "taos,tsl2550";
+                               reg = <0x39>;
+                       };
+
+                       tmp275: tmp275@48 {
+                               compatible = "ti,tmp275";
+                               reg = <0x48>;
+                       };
+               };
        };
 
        vbat: fixedregulator@0 {
                regulator-max-microvolt = <5000000>;
                regulator-boot-on;
        };
+
+       lis3_reg: fixedregulator@1 {
+               compatible = "regulator-fixed";
+               regulator-name = "lis3_reg";
+               regulator-boot-on;
+       };
+
+       matrix_keypad: matrix_keypad@0 {
+               compatible = "gpio-matrix-keypad";
+               debounce-delay-ms = <5>;
+               col-scan-delay-us = <2>;
+
+               row-gpios = <&gpio2 25 0        /* Bank1, pin25 */
+                            &gpio2 26 0        /* Bank1, pin26 */
+                            &gpio2 27 0>;      /* Bank1, pin27 */
+
+               col-gpios = <&gpio2 21 0        /* Bank1, pin21 */
+                            &gpio2 22 0>;      /* Bank1, pin22 */
+
+               linux,keymap = <0x0000008b      /* MENU */
+                               0x0100009e      /* BACK */
+                               0x02000069      /* LEFT */
+                               0x0001006a      /* RIGHT */
+                               0x0101001c      /* ENTER */
+                               0x0201006c>;    /* DOWN */
+       };
+
+       gpio_keys: volume_keys@0 {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               autorepeat;
+
+               switch@9 {
+                       label = "volume-up";
+                       linux,code = <115>;
+                       gpios = <&gpio1 2 1>;
+                       gpio-key,wakeup;
+               };
+
+               switch@10 {
+                       label = "volume-down";
+                       linux,code = <114>;
+                       gpios = <&gpio1 3 1>;
+                       gpio-key,wakeup;
+               };
+       };
 };
 
 /include/ "tps65910.dtsi"
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
new file mode 100644 (file)
index 0000000..f5a6162
--- /dev/null
@@ -0,0 +1,250 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/*
+ * AM335x Starter Kit
+ * http://www.ti.com/tool/tmdssk3358
+ */
+
+/dts-v1/;
+
+/include/ "am33xx.dtsi"
+
+/ {
+       model = "TI AM335x EVM-SK";
+       compatible = "ti,am335x-evmsk", "ti,am33xx";
+
+       cpus {
+               cpu@0 {
+                       cpu0-supply = <&vdd1_reg>;
+               };
+       };
+
+       memory {
+               device_type = "memory";
+               reg = <0x80000000 0x10000000>; /* 256 MB */
+       };
+
+       am33xx_pinmux: pinmux@44e10800 {
+               pinctrl-names = "default";
+               pinctrl-0 = <&user_leds_s0 &gpio_keys_s0>;
+
+               user_leds_s0: user_leds_s0 {
+                       pinctrl-single,pins = <
+                               0x10 0x7        /* gpmc_ad4.gpio1_4, OUTPUT | MODE7 */
+                               0x14 0x7        /* gpmc_ad5.gpio1_5, OUTPUT | MODE7 */
+                               0x18 0x7        /* gpmc_ad6.gpio1_6, OUTPUT | MODE7 */
+                               0x1c 0x7        /* gpmc_ad7.gpio1_7, OUTPUT | MODE7 */
+                       >;
+               };
+
+               gpio_keys_s0: gpio_keys_s0 {
+                       pinctrl-single,pins = <
+                               0x94 0x27       /* gpmc_oen_ren.gpio2_3, INPUT | MODE7 */
+                               0x90 0x27       /* gpmc_advn_ale.gpio2_2, INPUT | MODE7 */
+                               0x70 0x27       /* gpmc_wait0.gpio0_30, INPUT | MODE7 */
+                               0x9c 0x27       /* gpmc_ben0_cle.gpio2_5, INPUT | MODE7 */
+                       >;
+               };
+       };
+
+       ocp {
+               uart1: serial@44e09000 {
+                       status = "okay";
+               };
+
+               i2c1: i2c@44e0b000 {
+                       status = "okay";
+                       clock-frequency = <400000>;
+
+                       tps: tps@2d {
+                               reg = <0x2d>;
+                       };
+
+                       lis331dlh: lis331dlh@18 {
+                               compatible = "st,lis331dlh", "st,lis3lv02d";
+                               reg = <0x18>;
+                               Vdd-supply = <&lis3_reg>;
+                               Vdd_IO-supply = <&lis3_reg>;
+
+                               st,click-single-x;
+                               st,click-single-y;
+                               st,click-single-z;
+                               st,click-thresh-x = <10>;
+                               st,click-thresh-y = <10>;
+                               st,click-thresh-z = <10>;
+                               st,irq1-click;
+                               st,irq2-click;
+                               st,wakeup-x-lo;
+                               st,wakeup-x-hi;
+                               st,wakeup-y-lo;
+                               st,wakeup-y-hi;
+                               st,wakeup-z-lo;
+                               st,wakeup-z-hi;
+                               st,min-limit-x = <120>;
+                               st,min-limit-y = <120>;
+                               st,min-limit-z = <140>;
+                               st,max-limit-x = <550>;
+                               st,max-limit-y = <550>;
+                               st,max-limit-z = <750>;
+                       };
+               };
+       };
+
+       vbat: fixedregulator@0 {
+               compatible = "regulator-fixed";
+               regulator-name = "vbat";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-boot-on;
+       };
+
+       lis3_reg: fixedregulator@1 {
+               compatible = "regulator-fixed";
+               regulator-name = "lis3_reg";
+               regulator-boot-on;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led@1 {
+                       label = "evmsk:green:usr0";
+                       gpios = <&gpio2 4 0>;
+                       default-state = "off";
+               };
+
+               led@2 {
+                       label = "evmsk:green:usr1";
+                       gpios = <&gpio2 5 0>;
+                       default-state = "off";
+               };
+
+               led@3 {
+                       label = "evmsk:green:mmc0";
+                       gpios = <&gpio2 6 0>;
+                       linux,default-trigger = "mmc0";
+                       default-state = "off";
+               };
+
+               led@4 {
+                       label = "evmsk:green:heartbeat";
+                       gpios = <&gpio2 7 0>;
+                       linux,default-trigger = "heartbeat";
+                       default-state = "off";
+               };
+       };
+
+       gpio_buttons: gpio_buttons@0 {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               switch@1 {
+                       label = "button0";
+                       linux,code = <0x100>;
+                       gpios = <&gpio3 3 0>;
+               };
+
+               switch@2 {
+                       label = "button1";
+                       linux,code = <0x101>;
+                       gpios = <&gpio3 2 0>;
+               };
+
+               switch@3 {
+                       label = "button2";
+                       linux,code = <0x102>;
+                       gpios = <&gpio1 30 0>;
+                       gpio-key,wakeup;
+               };
+
+               switch@4 {
+                       label = "button3";
+                       linux,code = <0x103>;
+                       gpios = <&gpio3 5 0>;
+               };
+       };
+};
+
+/include/ "tps65910.dtsi"
+
+&tps {
+       vcc1-supply = <&vbat>;
+       vcc2-supply = <&vbat>;
+       vcc3-supply = <&vbat>;
+       vcc4-supply = <&vbat>;
+       vcc5-supply = <&vbat>;
+       vcc6-supply = <&vbat>;
+       vcc7-supply = <&vbat>;
+       vccio-supply = <&vbat>;
+
+       regulators {
+               vrtc_reg: regulator@0 {
+                       regulator-always-on;
+               };
+
+               vio_reg: regulator@1 {
+                       regulator-always-on;
+               };
+
+               vdd1_reg: regulator@2 {
+                       /* VDD_MPU voltage limits 0.95V - 1.26V with +/-4% tolerance */
+                       regulator-name = "vdd_mpu";
+                       regulator-min-microvolt = <912500>;
+                       regulator-max-microvolt = <1312500>;
+                       regulator-boot-on;
+                       regulator-always-on;
+               };
+
+               vdd2_reg: regulator@3 {
+                       /* VDD_CORE voltage limits 0.95V - 1.1V with +/-4% tolerance */
+                       regulator-name = "vdd_core";
+                       regulator-min-microvolt = <912500>;
+                       regulator-max-microvolt = <1150000>;
+                       regulator-boot-on;
+                       regulator-always-on;
+               };
+
+               vdd3_reg: regulator@4 {
+                       regulator-always-on;
+               };
+
+               vdig1_reg: regulator@5 {
+                       regulator-always-on;
+               };
+
+               vdig2_reg: regulator@6 {
+                       regulator-always-on;
+               };
+
+               vpll_reg: regulator@7 {
+                       regulator-always-on;
+               };
+
+               vdac_reg: regulator@8 {
+                       regulator-always-on;
+               };
+
+               vaux1_reg: regulator@9 {
+                       regulator-always-on;
+               };
+
+               vaux2_reg: regulator@10 {
+                       regulator-always-on;
+               };
+
+               vaux33_reg: regulator@11 {
+                       regulator-always-on;
+               };
+
+               vmmc_reg: regulator@12 {
+                       regulator-always-on;
+               };
+       };
+};
index bb31bff0199830e989ef39259a89b20b4eb5b4a5..20a3f29a6bfeaf9a81b4c988b64dbe8ab3aa16cb 100644 (file)
@@ -12,6 +12,7 @@
 
 / {
        compatible = "ti,am33xx";
+       interrupt-parent = <&intc>;
 
        aliases {
                serial0 = &uart1;
        cpus {
                cpu@0 {
                        compatible = "arm,cortex-a8";
+
+                       /*
+                        * To consider voltage drop between PMIC and SoC,
+                        * tolerance value is reduced to 2% from 4% and
+                        * voltage value is increased as a precaution.
+                        */
+                       operating-points = <
+                               /* kHz    uV */
+                               720000  1285000
+                               600000  1225000
+                               500000  1125000
+                               275000  1125000
+                       >;
+                       voltage-tolerance = <2>; /* 2 percentage */
+                       clock-latency = <300000>; /* From omap-cpufreq driver */
                };
        };
 
                };
        };
 
+       am33xx_pinmux: pinmux@44e10800 {
+               compatible = "pinctrl-single";
+               reg = <0x44e10800 0x0238>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-single,register-width = <32>;
+               pinctrl-single,function-mask = <0x7f>;
+       };
+
        /*
         * XXX: Use a flat representation of the AM33XX interconnect.
         * The real AM33XX interconnect network is quite complex.Since
@@ -70,7 +95,6 @@
                        interrupt-controller;
                        #interrupt-cells = <1>;
                        reg = <0x44e07000 0x1000>;
-                       interrupt-parent = <&intc>;
                        interrupts = <96>;
                };
 
                        interrupt-controller;
                        #interrupt-cells = <1>;
                        reg = <0x4804c000 0x1000>;
-                       interrupt-parent = <&intc>;
                        interrupts = <98>;
                };
 
                        interrupt-controller;
                        #interrupt-cells = <1>;
                        reg = <0x481ac000 0x1000>;
-                       interrupt-parent = <&intc>;
                        interrupts = <32>;
                };
 
                        interrupt-controller;
                        #interrupt-cells = <1>;
                        reg = <0x481ae000 0x1000>;
-                       interrupt-parent = <&intc>;
                        interrupts = <62>;
                };
 
                        ti,hwmods = "uart1";
                        clock-frequency = <48000000>;
                        reg = <0x44e09000 0x2000>;
-                       interrupt-parent = <&intc>;
                        interrupts = <72>;
                        status = "disabled";
                };
                        ti,hwmods = "uart2";
                        clock-frequency = <48000000>;
                        reg = <0x48022000 0x2000>;
-                       interrupt-parent = <&intc>;
                        interrupts = <73>;
                        status = "disabled";
                };
                        ti,hwmods = "uart3";
                        clock-frequency = <48000000>;
                        reg = <0x48024000 0x2000>;
-                       interrupt-parent = <&intc>;
                        interrupts = <74>;
                        status = "disabled";
                };
                        ti,hwmods = "uart4";
                        clock-frequency = <48000000>;
                        reg = <0x481a6000 0x2000>;
-                       interrupt-parent = <&intc>;
                        interrupts = <44>;
                        status = "disabled";
                };
                        ti,hwmods = "uart5";
                        clock-frequency = <48000000>;
                        reg = <0x481a8000 0x2000>;
-                       interrupt-parent = <&intc>;
                        interrupts = <45>;
                        status = "disabled";
                };
                        ti,hwmods = "uart6";
                        clock-frequency = <48000000>;
                        reg = <0x481aa000 0x2000>;
-                       interrupt-parent = <&intc>;
                        interrupts = <46>;
                        status = "disabled";
                };
                        #size-cells = <0>;
                        ti,hwmods = "i2c1";
                        reg = <0x44e0b000 0x1000>;
-                       interrupt-parent = <&intc>;
                        interrupts = <70>;
                        status = "disabled";
                };
                        #size-cells = <0>;
                        ti,hwmods = "i2c2";
                        reg = <0x4802a000 0x1000>;
-                       interrupt-parent = <&intc>;
                        interrupts = <71>;
                        status = "disabled";
                };
                        #size-cells = <0>;
                        ti,hwmods = "i2c3";
                        reg = <0x4819c000 0x1000>;
-                       interrupt-parent = <&intc>;
                        interrupts = <30>;
                        status = "disabled";
                };
                        compatible = "ti,omap3-wdt";
                        ti,hwmods = "wd_timer2";
                        reg = <0x44e35000 0x1000>;
-                       interrupt-parent = <&intc>;
                        interrupts = <91>;
                };
+
+               dcan0: d_can@481cc000 {
+                       compatible = "bosch,d_can";
+                       ti,hwmods = "d_can0";
+                       reg = <0x481cc000 0x2000>;
+                       interrupts = <52>;
+                       status = "disabled";
+               };
+
+               dcan1: d_can@481d0000 {
+                       compatible = "bosch,d_can";
+                       ti,hwmods = "d_can1";
+                       reg = <0x481d0000 0x2000>;
+                       interrupts = <55>;
+                       status = "disabled";
+               };
+
+               timer1: timer@44e31000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x44e31000 0x400>;
+                       interrupts = <67>;
+                       ti,hwmods = "timer1";
+                       ti,timer-alwon;
+               };
+
+               timer2: timer@48040000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48040000 0x400>;
+                       interrupts = <68>;
+                       ti,hwmods = "timer2";
+               };
+
+               timer3: timer@48042000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48042000 0x400>;
+                       interrupts = <69>;
+                       ti,hwmods = "timer3";
+               };
+
+               timer4: timer@48044000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48044000 0x400>;
+                       interrupts = <92>;
+                       ti,hwmods = "timer4";
+                       ti,timer-pwm;
+               };
+
+               timer5: timer@48046000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48046000 0x400>;
+                       interrupts = <93>;
+                       ti,hwmods = "timer5";
+                       ti,timer-pwm;
+               };
+
+               timer6: timer@48048000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48048000 0x400>;
+                       interrupts = <94>;
+                       ti,hwmods = "timer6";
+                       ti,timer-pwm;
+               };
+
+               timer7: timer@4804a000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4804a000 0x400>;
+                       interrupts = <95>;
+                       ti,hwmods = "timer7";
+                       ti,timer-pwm;
+               };
+
+               rtc@44e3e000 {
+                       compatible = "ti,da830-rtc";
+                       reg = <0x44e3e000 0x1000>;
+                       interrupts = <75
+                                     76>;
+                       ti,hwmods = "rtc";
+               };
+
+               spi0: spi@48030000 {
+                       compatible = "ti,omap4-mcspi";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x48030000 0x400>;
+                       interrupt = <65>;
+                       ti,spi-num-cs = <2>;
+                       ti,hwmods = "spi0";
+                       status = "disabled";
+               };
+
+               spi1: spi@481a0000 {
+                       compatible = "ti,omap4-mcspi";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x481a0000 0x400>;
+                       interrupt = <125>;
+                       ti,spi-num-cs = <2>;
+                       ti,hwmods = "spi1";
+                       status = "disabled";
+               };
+
+               usb@47400000 {
+                       compatible = "ti,musb-am33xx";
+                       reg = <0x47400000 0x1000        /* usbss */
+                              0x47401000 0x800         /* musb instance 0 */
+                              0x47401800 0x800>;       /* musb instance 1 */
+                       interrupts = <17                /* usbss */
+                                     18                /* musb instance 0 */
+                                     19>;              /* musb instance 1 */
+                       multipoint = <1>;
+                       num-eps = <16>;
+                       ram-bits = <12>;
+                       port0-mode = <3>;
+                       port1-mode = <3>;
+                       power = <250>;
+                       ti,hwmods = "usb_otg_hs";
+               };
        };
 };
diff --git a/arch/arm/boot/dts/ccu9540.dts b/arch/arm/boot/dts/ccu9540.dts
new file mode 100644 (file)
index 0000000..0430546
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2012 ST-Ericsson AB
+ *
+ * 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/ "dbx5x0.dtsi"
+
+/ {
+       model = "ST-Ericsson CCU9540 platform with Device Tree";
+       compatible = "st-ericsson,ccu9540", "st-ericsson,u9540";
+
+       memory {
+               reg = <0x00000000 0x20000000>;
+       };
+
+       soc-u9500 {
+               uart@80120000 {
+                       status = "okay";
+               };
+
+               uart@80121000 {
+                       status = "okay";
+               };
+
+               uart@80007000 {
+                       status = "okay";
+               };
+
+               // External Micro SD slot
+               sdi0_per1@80126000 {
+                       arm,primecell-periphid = <0x10480180>;
+                       max-frequency = <100000000>;
+                       bus-width = <4>;
+                       mmc-cap-sd-highspeed;
+                       mmc-cap-mmc-highspeed;
+                       vmmc-supply = <&ab8500_ldo_aux3_reg>;
+
+                       cd-gpios  = <&gpio7 6 0x4>; // 230
+                       cd-inverted;
+
+                       status = "okay";
+               };
+
+
+               // WLAN SDIO channel
+               sdi1_per2@80118000 {
+                       arm,primecell-periphid = <0x10480180>;
+                       max-frequency = <50000000>;
+                       bus-width = <4>;
+
+                       status = "okay";
+               };
+
+               // On-board eMMC
+               sdi4_per2@80114000 {
+                       arm,primecell-periphid = <0x10480180>;
+                       max-frequency = <100000000>;
+                       bus-width = <8>;
+                       mmc-cap-mmc-highspeed;
+                       vmmc-supply = <&ab8500_ldo_aux2_reg>;
+
+                       status = "okay";
+               };
+       };
+};
index 4b0e0ca08f40d3d81b90be09b8cce47b9b225fac..7ce45fc461fbcdf28d5d3b1a5b322db1e893f485 100644 (file)
                                // DB8500_REGULATOR_VAPE
                                db8500_vape_reg: db8500_vape {
                                        regulator-compatible = "db8500_vape";
-                                       regulator-name = "db8500-vape";
                                        regulator-always-on;
                                };
 
                                // DB8500_REGULATOR_VARM
                                db8500_varm_reg: db8500_varm {
                                        regulator-compatible = "db8500_varm";
-                                       regulator-name = "db8500-varm";
                                };
 
                                // DB8500_REGULATOR_VMODEM
                                db8500_vmodem_reg: db8500_vmodem {
                                        regulator-compatible = "db8500_vmodem";
-                                       regulator-name = "db8500-vmodem";
                                };
 
                                // DB8500_REGULATOR_VPLL
                                db8500_vpll_reg: db8500_vpll {
                                        regulator-compatible = "db8500_vpll";
-                                       regulator-name = "db8500-vpll";
                                };
 
                                // DB8500_REGULATOR_VSMPS1
                                db8500_vsmps1_reg: db8500_vsmps1 {
                                        regulator-compatible = "db8500_vsmps1";
-                                       regulator-name = "db8500-vsmps1";
                                };
 
                                // DB8500_REGULATOR_VSMPS2
                                db8500_vsmps2_reg: db8500_vsmps2 {
                                        regulator-compatible = "db8500_vsmps2";
-                                       regulator-name = "db8500-vsmps2";
                                };
 
                                // DB8500_REGULATOR_VSMPS3
                                db8500_vsmps3_reg: db8500_vsmps3 {
                                        regulator-compatible = "db8500_vsmps3";
-                                       regulator-name = "db8500-vsmps3";
                                };
 
                                // DB8500_REGULATOR_VRF1
                                db8500_vrf1_reg: db8500_vrf1 {
                                        regulator-compatible = "db8500_vrf1";
-                                       regulator-name = "db8500-vrf1";
                                };
 
                                // DB8500_REGULATOR_SWITCH_SVAMMDSP
                                db8500_sva_mmdsp_reg: db8500_sva_mmdsp {
                                        regulator-compatible = "db8500_sva_mmdsp";
-                                       regulator-name = "db8500-sva-mmdsp";
                                };
 
                                // DB8500_REGULATOR_SWITCH_SVAMMDSPRET
                                db8500_sva_mmdsp_ret_reg: db8500_sva_mmdsp_ret {
                                        regulator-compatible = "db8500_sva_mmdsp_ret";
-                                       regulator-name = "db8500-sva-mmdsp-ret";
                                };
 
                                // DB8500_REGULATOR_SWITCH_SVAPIPE
                                db8500_sva_pipe_reg: db8500_sva_pipe {
                                        regulator-compatible = "db8500_sva_pipe";
-                                       regulator-name = "db8500_sva_pipe";
                                };
 
                                // DB8500_REGULATOR_SWITCH_SIAMMDSP
                                db8500_sia_mmdsp_reg: db8500_sia_mmdsp {
                                        regulator-compatible = "db8500_sia_mmdsp";
-                                       regulator-name = "db8500_sia_mmdsp";
                                };
 
                                // DB8500_REGULATOR_SWITCH_SIAMMDSPRET
                                db8500_sia_mmdsp_ret_reg: db8500_sia_mmdsp_ret {
-                                       regulator-name = "db8500-sia-mmdsp-ret";
                                };
 
                                // DB8500_REGULATOR_SWITCH_SIAPIPE
                                db8500_sia_pipe_reg: db8500_sia_pipe {
                                        regulator-compatible = "db8500_sia_pipe";
-                                       regulator-name = "db8500-sia-pipe";
                                };
 
                                // DB8500_REGULATOR_SWITCH_SGA
                                db8500_sga_reg: db8500_sga {
                                        regulator-compatible = "db8500_sga";
-                                       regulator-name = "db8500-sga";
                                        vin-supply = <&db8500_vape_reg>;
                                };
 
                                // DB8500_REGULATOR_SWITCH_B2R2_MCDE
                                db8500_b2r2_mcde_reg: db8500_b2r2_mcde {
                                        regulator-compatible = "db8500_b2r2_mcde";
-                                       regulator-name = "db8500-b2r2-mcde";
                                        vin-supply = <&db8500_vape_reg>;
                                };
 
                                // DB8500_REGULATOR_SWITCH_ESRAM12
                                db8500_esram12_reg: db8500_esram12 {
                                        regulator-compatible = "db8500_esram12";
-                                       regulator-name = "db8500-esram12";
                                };
 
                                // DB8500_REGULATOR_SWITCH_ESRAM12RET
                                db8500_esram12_ret_reg: db8500_esram12_ret {
                                        regulator-compatible = "db8500_esram12_ret";
-                                       regulator-name = "db8500-esram12-ret";
                                };
 
                                // DB8500_REGULATOR_SWITCH_ESRAM34
                                db8500_esram34_reg: db8500_esram34 {
                                        regulator-compatible = "db8500_esram34";
-                                       regulator-name = "db8500-esram34";
                                };
 
                                // DB8500_REGULATOR_SWITCH_ESRAM34RET
                                db8500_esram34_ret_reg: db8500_esram34_ret {
                                        regulator-compatible = "db8500_esram34_ret";
-                                       regulator-name = "db8500-esram34-ret";
                                };
                        };
 
                                        // supplies to the display/camera
                                        ab8500_ldo_aux1_reg: ab8500_ldo_aux1 {
                                                regulator-compatible = "ab8500_ldo_aux1";
-                                               regulator-name = "V-DISPLAY";
                                                regulator-min-microvolt = <2500000>;
                                                regulator-max-microvolt = <2900000>;
                                                regulator-boot-on;
                                        // supplies to the on-board eMMC
                                        ab8500_ldo_aux2_reg: ab8500_ldo_aux2 {
                                                regulator-compatible = "ab8500_ldo_aux2";
-                                               regulator-name = "V-eMMC1";
                                                regulator-min-microvolt = <1100000>;
                                                regulator-max-microvolt = <3300000>;
                                        };
                                        // supply for VAUX3; SDcard slots
                                        ab8500_ldo_aux3_reg: ab8500_ldo_aux3 {
                                                regulator-compatible = "ab8500_ldo_aux3";
-                                               regulator-name = "V-MMC-SD";
                                                regulator-min-microvolt = <1100000>;
                                                regulator-max-microvolt = <3300000>;
                                        };
                                        // supply for v-intcore12; VINTCORE12 LDO
                                        ab8500_ldo_initcore_reg: ab8500_ldo_initcore {
                                                regulator-compatible = "ab8500_ldo_initcore";
-                                               regulator-name = "V-INTCORE";
                                        };
 
                                        // supply for tvout; gpadc; TVOUT LDO
                                        ab8500_ldo_tvout_reg: ab8500_ldo_tvout {
                                                regulator-compatible = "ab8500_ldo_tvout";
-                                               regulator-name = "V-TVOUT";
                                        };
 
                                        // supply for ab8500-usb; USB LDO
                                        ab8500_ldo_usb_reg: ab8500_ldo_usb {
                                                regulator-compatible = "ab8500_ldo_usb";
-                                               regulator-name = "dummy";
                                        };
 
                                        // supply for ab8500-vaudio; VAUDIO LDO
                                        ab8500_ldo_audio_reg: ab8500_ldo_audio {
                                                regulator-compatible = "ab8500_ldo_audio";
-                                               regulator-name = "V-AUD";
                                        };
 
                                        // supply for v-anamic1 VAMic1-LDO
                                        ab8500_ldo_anamic1_reg: ab8500_ldo_anamic1 {
                                                regulator-compatible = "ab8500_ldo_anamic1";
-                                               regulator-name = "V-AMIC1";
                                        };
 
                                        // supply for v-amic2; VAMIC2 LDO; reuse constants for AMIC1
                                        ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 {
                                                regulator-compatible = "ab8500_ldo_amamic2";
-                                               regulator-name = "V-AMIC2";
                                        };
 
                                        // supply for v-dmic; VDMIC LDO
                                        ab8500_ldo_dmic_reg: ab8500_ldo_dmic {
                                                regulator-compatible = "ab8500_ldo_dmic";
-                                               regulator-name = "V-DMIC";
                                        };
 
                                        // supply for U8500 CSI/DSI; VANA LDO
                                        ab8500_ldo_ana_reg: ab8500_ldo_ana {
                                                regulator-compatible = "ab8500_ldo_ana";
-                                               regulator-name = "V-CSI/DSI";
                                        };
                                };
                        };
                        status = "disabled";
                };
 
-               sdi@80126000 {
+               sdi0_per1@80126000 {
                        compatible = "arm,pl18x", "arm,primecell";
                        reg = <0x80126000 0x1000>;
                        interrupts = <0 60 0x4>;
                        status = "disabled";
                };
 
-               sdi@80118000 {
+               sdi1_per2@80118000 {
                        compatible = "arm,pl18x", "arm,primecell";
                        reg = <0x80118000 0x1000>;
                        interrupts = <0 50 0x4>;
                        status = "disabled";
                };
 
-               sdi@80005000 {
+               sdi2_per3@80005000 {
                        compatible = "arm,pl18x", "arm,primecell";
                        reg = <0x80005000 0x1000>;
                        interrupts = <0 41 0x4>;
                        status = "disabled";
                };
 
-               sdi@80119000 {
+               sdi3_per2@80119000 {
                        compatible = "arm,pl18x", "arm,primecell";
                        reg = <0x80119000 0x1000>;
                        interrupts = <0 59 0x4>;
                        status = "disabled";
                };
 
-               sdi@80114000 {
+               sdi4_per2@80114000 {
                        compatible = "arm,pl18x", "arm,primecell";
                        reg = <0x80114000 0x1000>;
                        interrupts = <0 99 0x4>;
                        status = "disabled";
                };
 
-               sdi@80008000 {
+               sdi5_per3@80008000 {
                        compatible = "arm,pl18x", "arm,primecell";
                        reg = <0x80008000 0x1000>;
                        interrupts = <0 100 0x4>;
                        ranges = <0 0x50000000 0x4000000>;
                        status = "disabled";
                };
+
+               vmmci: regulator-gpio {
+                       compatible = "regulator-gpio";
+
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <2600000>;
+                       regulator-name = "mmci-reg";
+                       regulator-type = "voltage";
+
+                       gpios = <&tc3589x_gpio 18 0x4>;
+                       gpio-enable = <&tc3589x_gpio 17 0x4>;
+                       states = <1800000 0x1
+                                 2900000 0x0>;
+               };
        };
 };
diff --git a/arch/arm/boot/dts/href.dtsi b/arch/arm/boot/dts/href.dtsi
new file mode 100644 (file)
index 0000000..592fb9d
--- /dev/null
@@ -0,0 +1,273 @@
+/*
+ * Copyright 2012 ST-Ericsson AB
+ *
+ * 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/ "dbx5x0.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-u9500 {
+               uart@80120000 {
+                       status = "okay";
+               };
+
+               uart@80121000 {
+                       status = "okay";
+               };
+
+               uart@80007000 {
+                       status = "okay";
+               };
+
+               i2c@80004000 {
+                       tc3589x@42 {
+                               compatible = "tc3589x";
+                               reg = <0x42>;
+                               interrupt-parent = <&gpio6>;
+                               interrupts = <25 0x1>;
+
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+
+                               tc3589x_gpio: tc3589x_gpio {
+                                       compatible = "tc3589x-gpio";
+                                       interrupts = <0 0x1>;
+
+                                       interrupt-controller;
+                                       #interrupt-cells = <2>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                               };
+                       };
+               };
+
+               i2c@80128000 {
+                       lp5521@0x33 {
+                               compatible = "lp5521";
+                               reg = <0x33>;
+                       };
+
+                       lp5521@0x34 {
+                               compatible = "lp5521";
+                               reg = <0x34>;
+                       };
+
+                       bh1780@0x29 {
+                               compatible = "rohm,bh1780gli";
+                               reg = <0x33>;
+                       };
+               };
+
+               // External Micro SD slot
+               sdi0_per1@80126000 {
+                       arm,primecell-periphid = <0x10480180>;
+                       max-frequency = <50000000>;
+                       bus-width = <4>;
+                       mmc-cap-sd-highspeed;
+                       mmc-cap-mmc-highspeed;
+                       vmmc-supply = <&ab8500_ldo_aux3_reg>;
+
+                       cd-gpios  = <&tc3589x_gpio 3 0x4>;
+
+                       status = "okay";
+               };
+
+               // WLAN SDIO channel
+               sdi1_per2@80118000 {
+                       arm,primecell-periphid = <0x10480180>;
+                       max-frequency = <50000000>;
+                       bus-width = <4>;
+
+                       status = "okay";
+               };
+
+               // PoP:ed eMMC
+               sdi2_per3@80005000 {
+                       arm,primecell-periphid = <0x10480180>;
+                       max-frequency = <50000000>;
+                       bus-width = <8>;
+                       mmc-cap-mmc-highspeed;
+
+                       status = "okay";
+               };
+
+               // On-board eMMC
+               sdi4_per2@80114000 {
+                       arm,primecell-periphid = <0x10480180>;
+                       max-frequency = <50000000>;
+                       bus-width = <8>;
+                       mmc-cap-mmc-highspeed;
+                       vmmc-supply = <&ab8500_ldo_aux2_reg>;
+
+                       status = "okay";
+               };
+
+               sound {
+                       compatible = "stericsson,snd-soc-mop500";
+
+                       stericsson,cpu-dai = <&msp1 &msp3>;
+                       stericsson,audio-codec = <&codec>;
+               };
+
+               msp1: msp@80124000 {
+                       status = "okay";
+               };
+
+               msp3: msp@80125000 {
+                       status = "okay";
+               };
+
+               prcmu@80157000 {
+                       db8500-prcmu-regulators {
+                               db8500_vape_reg: db8500_vape {
+                                       regulator-name = "db8500-vape";
+                               };
+
+                               db8500_varm_reg: db8500_varm {
+                                       regulator-name = "db8500-varm";
+                               };
+
+                               db8500_vmodem_reg: db8500_vmodem {
+                                       regulator-name = "db8500-vmodem";
+                               };
+
+                               db8500_vpll_reg: db8500_vpll {
+                                       regulator-name = "db8500-vpll";
+                               };
+
+                               db8500_vsmps1_reg: db8500_vsmps1 {
+                                       regulator-name = "db8500-vsmps1";
+                               };
+
+                               db8500_vsmps2_reg: db8500_vsmps2 {
+                                       regulator-name = "db8500-vsmps2";
+                               };
+
+                               db8500_vsmps3_reg: db8500_vsmps3 {
+                                       regulator-name = "db8500-vsmps3";
+                               };
+
+                               db8500_vrf1_reg: db8500_vrf1 {
+                                       regulator-name = "db8500-vrf1";
+                               };
+
+                               db8500_sva_mmdsp_reg: db8500_sva_mmdsp {
+                                       regulator-name = "db8500-sva-mmdsp";
+                               };
+
+                               db8500_sva_mmdsp_ret_reg: db8500_sva_mmdsp_ret {
+                                       regulator-name = "db8500-sva-mmdsp-ret";
+                               };
+
+                               db8500_sva_pipe_reg: db8500_sva_pipe {
+                                       regulator-name = "db8500_sva_pipe";
+                               };
+
+                               db8500_sia_mmdsp_reg: db8500_sia_mmdsp {
+                                       regulator-name = "db8500_sia_mmdsp";
+                               };
+
+                               db8500_sia_mmdsp_ret_reg: db8500_sia_mmdsp_ret {
+                                       regulator-name = "db8500-sia-mmdsp-ret";
+                               };
+
+                               db8500_sia_pipe_reg: db8500_sia_pipe {
+                                       regulator-name = "db8500-sia-pipe";
+                               };
+
+                               db8500_sga_reg: db8500_sga {
+                                       regulator-name = "db8500-sga";
+                               };
+
+                               db8500_b2r2_mcde_reg: db8500_b2r2_mcde {
+                                       regulator-name = "db8500-b2r2-mcde";
+                               };
+
+                               db8500_esram12_reg: db8500_esram12 {
+                                       regulator-name = "db8500-esram12";
+                               };
+
+                               db8500_esram12_ret_reg: db8500_esram12_ret {
+                                       regulator-name = "db8500-esram12-ret";
+                               };
+
+                               db8500_esram34_reg: db8500_esram34 {
+                                       regulator-name = "db8500-esram34";
+                               };
+
+                               db8500_esram34_ret_reg: db8500_esram34_ret {
+                                       regulator-name = "db8500-esram34-ret";
+                               };
+                       };
+
+                       ab8500@5 {
+                               ab8500-regulators {
+                                       ab8500_ldo_aux1_reg: ab8500_ldo_aux1 {
+                                               regulator-name = "V-DISPLAY";
+                                       };
+
+                                       ab8500_ldo_aux2_reg: ab8500_ldo_aux2 {
+                                               regulator-name = "V-eMMC1";
+                                       };
+
+                                       ab8500_ldo_aux3_reg: ab8500_ldo_aux3 {
+                                               regulator-name = "V-MMC-SD";
+                                       };
+
+                                       ab8500_ldo_initcore_reg: ab8500_ldo_initcore {
+                                               regulator-name = "V-INTCORE";
+                                       };
+
+                                       ab8500_ldo_tvout_reg: ab8500_ldo_tvout {
+                                               regulator-name = "V-TVOUT";
+                                       };
+
+                                       ab8500_ldo_usb_reg: ab8500_ldo_usb {
+                                               regulator-name = "dummy";
+                                       };
+
+                                       ab8500_ldo_audio_reg: ab8500_ldo_audio {
+                                               regulator-name = "V-AUD";
+                                       };
+
+                                       ab8500_ldo_anamic1_reg: ab8500_ldo_anamic1 {
+                                               regulator-name = "V-AMIC1";
+                                       };
+
+                                       ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 {
+                                               regulator-name = "V-AMIC2";
+                                       };
+
+                                       ab8500_ldo_dmic_reg: ab8500_ldo_dmic {
+                                               regulator-name = "V-DMIC";
+                                       };
+
+                                       ab8500_ldo_ana_reg: ab8500_ldo_ana {
+                                               regulator-name = "V-CSI/DSI";
+                                       };
+                               };
+                       };
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/hrefprev60.dts b/arch/arm/boot/dts/hrefprev60.dts
new file mode 100644 (file)
index 0000000..b398946
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2012 ST-Ericsson AB
+ *
+ * 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/ "dbx5x0.dtsi"
+/include/ "href.dtsi"
+/include/ "stuib.dtsi"
+
+/ {
+       model = "ST-Ericsson HREF (pre-v60) platform with Device Tree";
+       compatible = "st-ericsson,mop500", "st-ericsson,u8500";
+
+       gpio_keys {
+               button@1 {
+                       gpios = <&tc3589x_gpio 7 0x4>;
+               };
+       };
+
+       soc-u9500 {
+               i2c@80004000 {
+                       tps61052@33 {
+                               compatible = "tps61052";
+                               reg = <0x33>;
+                       };
+               };
+
+               i2c@80110000 {
+                       bu21013_tp@0x5c {
+                               reset-gpio = <&tc3589x_gpio 13 0x4>;
+                       };
+               };
+       };
+};
index 2131d77dc9c924adc0c8a0062e552a644dd542d6..a01ac8f000d67e210fcf39ed67b54b0f3596ea09 100644 (file)
 
 /dts-v1/;
 /include/ "dbx5x0.dtsi"
+/include/ "href.dtsi"
+/include/ "stuib.dtsi"
 
 / {
-       model = "ST-Ericsson HREF platform with Device Tree";
-       compatible = "st-ericsson,hrefv60+";
+       model = "ST-Ericsson HREF (v60+) platform with Device Tree";
+       compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500";
 
-       memory {
-               reg = <0x00000000 0x20000000>;
+       gpio_keys {
+               button@1 {
+                       gpios = <&gpio6 25 0x4>;
+               };
        };
 
        soc-u9500 {
-               uart@80120000 {
-                       status = "okay";
-               };
-
-               uart@80121000 {
-                       status = "okay";
-               };
-
-               uart@80007000 {
-                       status = "okay";
-               };
-
-               i2c@80004000 {
-                       tc3589x@42 {
-                               compatible = "tc3589x";
-                               reg = <0x42>;
-                               interrupt-parent = <&gpio6>;
-                               interrupts = <25 0x1>;
-
-                               interrupt-controller;
-                               #interrupt-cells = <2>;
-
-                               tc3589x_gpio: tc3589x_gpio {
-                                       compatible = "tc3589x-gpio";
-                                       interrupts = <0 0x1>;
-
-                                       interrupt-controller;
-                                       #interrupt-cells = <2>;
-                                       gpio-controller;
-                                       #gpio-cells = <2>;
-                               };
-                       };
-
-                       tps61052@33 {
-                               compatible = "tps61052";
-                               reg = <0x33>;
-                       };
-               };
-
-               i2c@80128000 {
-                       lp5521@0x33 {
-                               compatible = "lp5521";
-                               reg = <0x33>;
-                       };
-
-                       lp5521@0x34 {
-                               compatible = "lp5521";
-                               reg = <0x34>;
+               i2c@80110000 {
+                       bu21013_tp@0x5c {
+                               reset-gpio = <&gpio4 15 0x4>;
                        };
-
-                       bh1780@0x29 {
-                               compatible = "rohm,bh1780gli";
-                               reg = <0x33>;
-                       };
-               };
-
-               sound {
-                       compatible = "stericsson,snd-soc-mop500";
-
-                       stericsson,cpu-dai = <&msp1 &msp3>;
-                       stericsson,audio-codec = <&codec>;
-               };
-
-               msp1: msp@80124000 {
-                       status = "okay";
-               };
-
-               msp3: msp@80125000 {
-                       status = "okay";
                };
        };
 };
diff --git a/arch/arm/boot/dts/imx25-karo-tx25.dts b/arch/arm/boot/dts/imx25-karo-tx25.dts
new file mode 100644 (file)
index 0000000..d81f8a0
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2012 Sascha Hauer, 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
+ */
+
+/dts-v1/;
+/include/ "imx25.dtsi"
+
+/ {
+       model = "Ka-Ro TX25";
+       compatible = "karo,imx25-tx25", "fsl,imx25";
+
+       memory {
+               reg = <0x80000000 0x02000000 0x90000000 0x02000000>;
+       };
+
+       soc {
+               aips@43f00000 {
+                       uart1: serial@43f90000 {
+                               status = "okay";
+                       };
+               };
+
+               spba@50000000 {
+                       fec: ethernet@50038000 {
+                               status = "okay";
+                               phy-mode = "rmii";
+                       };
+               };
+
+               emi@80000000 {
+                       nand@bb000000 {
+                               nand-on-flash-bbt;
+                               status = "okay";
+                       };
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi
new file mode 100644 (file)
index 0000000..e1b13eb
--- /dev/null
@@ -0,0 +1,515 @@
+/*
+ * Copyright 2012 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+       aliases {
+               serial0 = &uart1;
+               serial1 = &uart2;
+               serial2 = &uart3;
+               serial3 = &uart4;
+               serial4 = &uart5;
+               gpio0 = &gpio1;
+               gpio1 = &gpio2;
+               gpio2 = &gpio3;
+               gpio3 = &gpio4;
+               usb0 = &usbotg;
+               usb1 = &usbhost1;
+       };
+
+       asic: asic-interrupt-controller@68000000 {
+               compatible = "fsl,imx25-asic", "fsl,avic";
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               reg = <0x68000000 0x8000000>;
+       };
+
+       clocks {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               osc {
+                       compatible = "fsl,imx-osc", "fixed-clock";
+                       clock-frequency = <24000000>;
+               };
+       };
+
+       soc {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "simple-bus";
+               interrupt-parent = <&asic>;
+               ranges;
+
+               aips@43f00000 { /* AIPS1 */
+                       compatible = "fsl,aips-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x43f00000 0x100000>;
+                       ranges;
+
+                       i2c1: i2c@43f80000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx25-i2c", "fsl,imx21-i2c";
+                               reg = <0x43f80000 0x4000>;
+                               clocks = <&clks 48>;
+                               clock-names = "";
+                               interrupts = <3>;
+                               status = "disabled";
+                       };
+
+                       i2c3: i2c@43f84000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx25-i2c", "fsl,imx21-i2c";
+                               reg = <0x43f84000 0x4000>;
+                               clocks = <&clks 48>;
+                               clock-names = "";
+                               interrupts = <10>;
+                               status = "disabled";
+                       };
+
+                       can1: can@43f88000 {
+                               compatible = "fsl,imx25-flexcan", "fsl,p1010-flexcan";
+                               reg = <0x43f88000 0x4000>;
+                               interrupts = <43>;
+                               clocks = <&clks 75>, <&clks 75>;
+                               clock-names = "ipg", "per";
+                               status = "disabled";
+                       };
+
+                       can2: can@43f8c000 {
+                               compatible = "fsl,imx25-flexcan", "fsl,p1010-flexcan";
+                               reg = <0x43f8c000 0x4000>;
+                               interrupts = <44>;
+                               clocks = <&clks 76>, <&clks 76>;
+                               clock-names = "ipg", "per";
+                               status = "disabled";
+                       };
+
+                       uart1: serial@43f90000 {
+                               compatible = "fsl,imx25-uart", "fsl,imx21-uart";
+                               reg = <0x43f90000 0x4000>;
+                               interrupts = <45>;
+                               clocks = <&clks 120>, <&clks 57>;
+                               clock-names = "ipg", "per";
+                               status = "disabled";
+                       };
+
+                       uart2: serial@43f94000 {
+                               compatible = "fsl,imx25-uart", "fsl,imx21-uart";
+                               reg = <0x43f94000 0x4000>;
+                               interrupts = <32>;
+                               clocks = <&clks 121>, <&clks 57>;
+                               clock-names = "ipg", "per";
+                               status = "disabled";
+                       };
+
+                       i2c2: i2c@43f98000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx25-i2c", "fsl,imx21-i2c";
+                               reg = <0x43f98000 0x4000>;
+                               clocks = <&clks 48>;
+                               clock-names = "";
+                               interrupts = <4>;
+                               status = "disabled";
+                       };
+
+                       owire@43f9c000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               reg = <0x43f9c000 0x4000>;
+                               clocks = <&clks 51>;
+                               clock-names = "";
+                               interrupts = <2>;
+                               status = "disabled";
+                       };
+
+                       spi1: cspi@43fa4000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx25-cspi", "fsl,imx35-cspi";
+                               reg = <0x43fa4000 0x4000>;
+                               clocks = <&clks 62>;
+                               clock-names = "ipg";
+                               interrupts = <14>;
+                               status = "disabled";
+                       };
+
+                       kpp@43fa8000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               reg = <0x43fa8000 0x4000>;
+                               clocks = <&clks 102>;
+                               clock-names = "";
+                               interrupts = <24>;
+                               status = "disabled";
+                       };
+
+                       iomuxc@43fac000{
+                               compatible = "fsl,imx25-iomuxc";
+                               reg = <0x43fac000 0x4000>;
+                       };
+
+                       audmux@43fb0000 {
+                               compatible = "fsl,imx25-audmux", "fsl,imx31-audmux";
+                               reg = <0x43fb0000 0x4000>;
+                               status = "disabled";
+                       };
+               };
+
+               spba@50000000 {
+                       compatible = "fsl,spba-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x50000000 0x40000>;
+                       ranges;
+
+                       spi3: cspi@50004000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx25-cspi", "fsl,imx35-cspi";
+                               reg = <0x50004000 0x4000>;
+                               interrupts = <0>;
+                               clocks = <&clks 80>;
+                               clock-names = "ipg";
+                               status = "disabled";
+                       };
+
+                       uart4: serial@50008000 {
+                               compatible = "fsl,imx25-uart", "fsl,imx21-uart";
+                               reg = <0x50008000 0x4000>;
+                               interrupts = <5>;
+                               clocks = <&clks 123>, <&clks 57>;
+                               clock-names = "ipg", "per";
+                               status = "disabled";
+                       };
+
+                       uart3: serial@5000c000 {
+                               compatible = "fsl,imx25-uart", "fsl,imx21-uart";
+                               reg = <0x5000c000 0x4000>;
+                               interrupts = <18>;
+                               clocks = <&clks 122>, <&clks 57>;
+                               clock-names = "ipg", "per";
+                               status = "disabled";
+                       };
+
+                       spi2: cspi@50010000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx25-cspi", "fsl,imx35-cspi";
+                               reg = <0x50010000 0x4000>;
+                               clocks = <&clks 79>;
+                               clock-names = "ipg";
+                               interrupts = <13>;
+                               status = "disabled";
+                       };
+
+                       ssi2: ssi@50014000 {
+                               compatible = "fsl,imx25-ssi", "fsl,imx21-ssi";
+                               reg = <0x50014000 0x4000>;
+                               interrupts = <11>;
+                               status = "disabled";
+                       };
+
+                       esai@50018000 {
+                               reg = <0x50018000 0x4000>;
+                               interrupts = <7>;
+                       };
+
+                       uart5: serial@5002c000 {
+                               compatible = "fsl,imx25-uart", "fsl,imx21-uart";
+                               reg = <0x5002c000 0x4000>;
+                               interrupts = <40>;
+                               clocks = <&clks 124>, <&clks 57>;
+                               clock-names = "ipg", "per";
+                               status = "disabled";
+                       };
+
+                       tsc: tsc@50030000 {
+                               compatible = "fsl,imx25-adc", "fsl,imx21-tsc";
+                               reg = <0x50030000 0x4000>;
+                               interrupts = <46>;
+                               clocks = <&clks 119>;
+                               clock-names = "ipg";
+                               status = "disabled";
+                       };
+
+                       ssi1: ssi@50034000 {
+                               compatible = "fsl,imx25-ssi", "fsl,imx21-ssi";
+                               reg = <0x50034000 0x4000>;
+                               interrupts = <12>;
+                               status = "disabled";
+                       };
+
+                       fec: ethernet@50038000 {
+                               compatible = "fsl,imx25-fec";
+                               reg = <0x50038000 0x4000>;
+                               interrupts = <57>;
+                               clocks = <&clks 88>, <&clks 65>;
+                               clock-names = "ipg", "ahb";
+                               status = "disabled";
+                       };
+               };
+
+               aips@53f00000 { /* AIPS2 */
+                       compatible = "fsl,aips-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x53f00000 0x100000>;
+                       ranges;
+
+                       clks: ccm@53f80000 {
+                               compatible = "fsl,imx25-ccm";
+                               reg = <0x53f80000 0x4000>;
+                               interrupts = <31>;
+                               #clock-cells = <1>;
+                       };
+
+                       gpt4: timer@53f84000 {
+                               compatible = "fsl,imx25-gpt", "fsl,imx31-gpt";
+                               reg = <0x53f84000 0x4000>;
+                               clocks = <&clks 9>, <&clks 45>;
+                               clock-names = "ipg", "per";
+                               interrupts = <1>;
+                       };
+
+                       gpt3: timer@53f88000 {
+                               compatible = "fsl,imx25-gpt", "fsl,imx31-gpt";
+                               reg = <0x53f88000 0x4000>;
+                               clocks = <&clks 9>, <&clks 47>;
+                               clock-names = "ipg", "per";
+                               interrupts = <29>;
+                       };
+
+                       gpt2: timer@53f8c000 {
+                               compatible = "fsl,imx25-gpt", "fsl,imx31-gpt";
+                               reg = <0x53f8c000 0x4000>;
+                               clocks = <&clks 9>, <&clks 47>;
+                               clock-names = "ipg", "per";
+                               interrupts = <53>;
+                       };
+
+                       gpt1: timer@53f90000 {
+                               compatible = "fsl,imx25-gpt", "fsl,imx31-gpt";
+                               reg = <0x53f90000 0x4000>;
+                               clocks = <&clks 9>, <&clks 47>;
+                               clock-names = "ipg", "per";
+                               interrupts = <54>;
+                       };
+
+                       epit1: timer@53f94000 {
+                               compatible = "fsl,imx25-epit";
+                               reg = <0x53f94000 0x4000>;
+                               interrupts = <28>;
+                       };
+
+                       epit2: timer@53f98000 {
+                               compatible = "fsl,imx25-epit";
+                               reg = <0x53f98000 0x4000>;
+                               interrupts = <27>;
+                       };
+
+                       gpio4: gpio@53f9c000 {
+                               compatible = "fsl,imx25-gpio", "fsl,imx35-gpio";
+                               reg = <0x53f9c000 0x4000>;
+                               interrupts = <23>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       pwm2: pwm@53fa0000 {
+                               compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
+                               #pwm-cells = <2>;
+                               reg = <0x53fa0000 0x4000>;
+                               clocks = <&clks 106>, <&clks 36>;
+                               clock-names = "ipg", "per";
+                               interrupts = <36>;
+                       };
+
+                       gpio3: gpio@53fa4000 {
+                               compatible = "fsl,imx25-gpio", "fsl,imx35-gpio";
+                               reg = <0x53fa4000 0x4000>;
+                               interrupts = <16>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       pwm3: pwm@53fa8000 {
+                               compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
+                               #pwm-cells = <2>;
+                               reg = <0x53fa8000 0x4000>;
+                               clocks = <&clks 107>, <&clks 36>;
+                               clock-names = "ipg", "per";
+                               interrupts = <41>;
+                       };
+
+                       esdhc1: esdhc@53fb4000 {
+                               compatible = "fsl,imx25-esdhc";
+                               reg = <0x53fb4000 0x4000>;
+                               interrupts = <9>;
+                               clocks = <&clks 86>, <&clks 63>, <&clks 45>;
+                               clock-names = "ipg", "ahb", "per";
+                               status = "disabled";
+                       };
+
+                       esdhc2: esdhc@53fb8000 {
+                               compatible = "fsl,imx25-esdhc";
+                               reg = <0x53fb8000 0x4000>;
+                               interrupts = <8>;
+                               clocks = <&clks 87>, <&clks 64>, <&clks 46>;
+                               clock-names = "ipg", "ahb", "per";
+                               status = "disabled";
+                       };
+
+                       lcdc@53fbc000 {
+                               reg = <0x53fbc000 0x4000>;
+                               interrupts = <39>;
+                               clocks = <&clks 103>, <&clks 66>, <&clks 49>;
+                               clock-names = "ipg", "ahb", "per";
+                               status = "disabled";
+                       };
+
+                       slcdc@53fc0000 {
+                               reg = <0x53fc0000 0x4000>;
+                               interrupts = <38>;
+                               status = "disabled";
+                       };
+
+                       pwm4: pwm@53fc8000 {
+                               compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
+                               reg = <0x53fc8000 0x4000>;
+                               clocks = <&clks 108>, <&clks 36>;
+                               clock-names = "ipg", "per";
+                               interrupts = <42>;
+                       };
+
+                       gpio1: gpio@53fcc000 {
+                               compatible = "fsl,imx25-gpio", "fsl,imx35-gpio";
+                               reg = <0x53fcc000 0x4000>;
+                               interrupts = <52>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio2: gpio@53fd0000 {
+                               compatible = "fsl,imx25-gpio", "fsl,imx35-gpio";
+                               reg = <0x53fd0000 0x4000>;
+                               interrupts = <51>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       sdma@53fd4000 {
+                               compatible = "fsl,imx25-sdma", "fsl,imx35-sdma";
+                               reg = <0x53fd4000 0x4000>;
+                               clocks = <&clks 112>, <&clks 68>;
+                               clock-names = "ipg", "ahb";
+                               interrupts = <34>;
+                       };
+
+                       wdog@53fdc000 {
+                               compatible = "fsl,imx25-wdt", "fsl,imx21-wdt";
+                               reg = <0x53fdc000 0x4000>;
+                               clocks = <&clks 126>;
+                               clock-names = "";
+                               interrupts = <55>;
+                       };
+
+                       pwm1: pwm@53fe0000 {
+                               compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
+                               #pwm-cells = <2>;
+                               reg = <0x53fe0000 0x4000>;
+                               clocks = <&clks 105>, <&clks 36>;
+                               clock-names = "ipg", "per";
+                               interrupts = <26>;
+                       };
+
+                       usbphy1: usbphy@1 {
+                               compatible = "nop-usbphy";
+                               status = "disabled";
+                       };
+
+                       usbphy2: usbphy@2 {
+                               compatible = "nop-usbphy";
+                               status = "disabled";
+                       };
+
+                       usbotg: usb@53ff4000 {
+                               compatible = "fsl,imx25-usb", "fsl,imx27-usb";
+                               reg = <0x53ff4000 0x0200>;
+                               interrupts = <37>;
+                               clocks = <&clks 9>, <&clks 70>, <&clks 8>;
+                               clock-names = "ipg", "ahb", "per";
+                               fsl,usbmisc = <&usbmisc 0>;
+                               status = "disabled";
+                       };
+
+                       usbhost1: usb@53ff4400 {
+                               compatible = "fsl,imx25-usb", "fsl,imx27-usb";
+                               reg = <0x53ff4400 0x0200>;
+                               interrupts = <35>;
+                               clocks = <&clks 9>, <&clks 70>, <&clks 8>;
+                               clock-names = "ipg", "ahb", "per";
+                               fsl,usbmisc = <&usbmisc 1>;
+                               status = "disabled";
+                       };
+
+                       usbmisc: usbmisc@53ff4600 {
+                               #index-cells = <1>;
+                               compatible = "fsl,imx25-usbmisc";
+                               clocks = <&clks 9>, <&clks 70>, <&clks 8>;
+                               clock-names = "ipg", "ahb", "per";
+                               reg = <0x53ff4600 0x00f>;
+                               status = "disabled";
+                       };
+
+                       dryice@53ffc000 {
+                               compatible = "fsl,imx25-dryice", "fsl,imx25-rtc";
+                               reg = <0x53ffc000 0x4000>;
+                               clocks = <&clks 81>;
+                               clock-names = "ipg";
+                               interrupts = <25>;
+                       };
+               };
+
+               emi@80000000 {
+                       compatible = "fsl,emi-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x80000000 0x3b002000>;
+                       ranges;
+
+                       nand@bb000000 {
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               compatible = "fsl,imx25-nand";
+                               reg = <0xbb000000 0x2000>;
+                               clocks = <&clks 50>;
+                               clock-names = "";
+                               interrupts = <33>;
+                               status = "disabled";
+                       };
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/imx27-apf27.dts b/arch/arm/boot/dts/imx27-apf27.dts
new file mode 100644 (file)
index 0000000..c0327c0
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2012 Philippe Reynes <tremyfr@yahoo.fr>
+ * Copyright 2012 Armadeus Systems <support@armadeus.com>
+ *
+ * Based on code which is: Copyright 2012 Sascha Hauer, 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
+ */
+
+/dts-v1/;
+/include/ "imx27.dtsi"
+
+/ {
+       model = "Armadeus Systems APF27 module";
+       compatible = "armadeus,imx27-apf27", "fsl,imx27";
+
+       memory {
+               reg = <0xa0000000 0x04000000>;
+       };
+
+       clocks {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               osc26m {
+                       compatible = "fsl,imx-osc26m", "fixed-clock";
+                       clock-frequency = <0>;
+               };
+       };
+
+       soc {
+               aipi@10000000 {
+                       serial@1000a000 {
+                               status = "okay";
+                       };
+
+                       ethernet@1002b000 {
+                               status = "okay";
+                       };
+               };
+
+               nand@d8000000 {
+                       status = "okay";
+                       nand-bus-width = <16>;
+                       nand-ecc-mode = "hw";
+                       nand-on-flash-bbt;
+
+                       partition@0 {
+                               label = "u-boot";
+                               reg = <0x0 0x100000>;
+                       };
+
+                       partition@100000 {
+                               label = "env";
+                               reg = <0x100000 0x80000>;
+                       };
+
+                       partition@180000 {
+                               label = "env2";
+                               reg = <0x180000 0x80000>;
+                       };
+
+                       partition@200000 {
+                               label = "firmware";
+                               reg = <0x200000 0x80000>;
+                       };
+
+                       partition@280000 {
+                               label = "dtb";
+                               reg = <0x280000 0x80000>;
+                       };
+
+                       partition@300000 {
+                               label = "kernel";
+                               reg = <0x300000 0x500000>;
+                       };
+
+                       partition@800000 {
+                               label = "rootfs";
+                               reg = <0x800000 0xf800000>;
+                       };
+               };
+       };
+};
index 3e54f1498841ca7ff3da6636cabd7d9274e3bd65..67d672792b0ddd1c8ea48bf5df4a309d48aa04ae 100644 (file)
                        i2c1: i2c@10012000 {
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "fsl,imx27-i2c", "fsl,imx1-i2c";
+                               compatible = "fsl,imx27-i2c", "fsl,imx21-i2c";
                                reg = <0x10012000 0x1000>;
                                interrupts = <12>;
                                status = "disabled";
                        i2c2: i2c@1001d000 {
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "fsl,imx27-i2c", "fsl,imx1-i2c";
+                               compatible = "fsl,imx27-i2c", "fsl,imx21-i2c";
                                reg = <0x1001d000 0x1000>;
                                interrupts = <1>;
                                status = "disabled";
index 75d069fcf8979d9684d2c979badaacdb3d3a7876..54aea74769a161d6fc6482ae171cd3fa9b62fdb7 100644 (file)
                        i2c@83fc4000 { /* I2C2 */
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "fsl,imx51-i2c", "fsl,imx1-i2c";
+                               compatible = "fsl,imx51-i2c", "fsl,imx21-i2c";
                                reg = <0x83fc4000 0x4000>;
                                interrupts = <63>;
                                status = "disabled";
                        i2c@83fc8000 { /* I2C1 */
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "fsl,imx51-i2c", "fsl,imx1-i2c";
+                               compatible = "fsl,imx51-i2c", "fsl,imx21-i2c";
                                reg = <0x83fc8000 0x4000>;
                                interrupts = <62>;
                                status = "disabled";
index 76ebb1ad2675334d38674fda586c9dee87d0cef8..caf09ff73f1005f14b753b06e02fffffdef95bf9 100644 (file)
                        i2c@53fec000 { /* I2C3 */
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "fsl,imx53-i2c", "fsl,imx1-i2c";
+                               compatible = "fsl,imx53-i2c", "fsl,imx21-i2c";
                                reg = <0x53fec000 0x4000>;
                                interrupts = <64>;
                                status = "disabled";
                        i2c@63fc4000 { /* I2C2 */
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "fsl,imx53-i2c", "fsl,imx1-i2c";
+                               compatible = "fsl,imx53-i2c", "fsl,imx21-i2c";
                                reg = <0x63fc4000 0x4000>;
                                interrupts = <63>;
                                status = "disabled";
                        i2c@63fc8000 { /* I2C1 */
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "fsl,imx53-i2c", "fsl,imx1-i2c";
+                               compatible = "fsl,imx53-i2c", "fsl,imx21-i2c";
                                reg = <0x63fc8000 0x4000>;
                                interrupts = <62>;
                                status = "disabled";
index f3990b04fecf4661216c9cf321dc817c72e1a0b7..f604a44a5c66c7225333e7c8abe17dd6d1a7623a 100644 (file)
                        i2c@021a0000 { /* I2C1 */
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "fsl,imx6q-i2c", "fsl,imx1-i2c";
+                               compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c";
                                reg = <0x021a0000 0x4000>;
                                interrupts = <0 36 0x04>;
                                clocks = <&clks 125>;
                        i2c@021a4000 { /* I2C2 */
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "fsl,imx6q-i2c", "fsl,imx1-i2c";
+                               compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c";
                                reg = <0x021a4000 0x4000>;
                                interrupts = <0 37 0x04>;
                                clocks = <&clks 126>;
                        i2c@021a8000 { /* I2C3 */
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "fsl,imx6q-i2c", "fsl,imx1-i2c";
+                               compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c";
                                reg = <0x021a8000 0x4000>;
                                interrupts = <0 38 0x04>;
                                clocks = <&clks 127>;
index 581cb081cb0f04586f98e8b10bdf1e095a3b65a0..761c4b69b25b2c3a661322a96ee5c7f41c839c70 100644 (file)
@@ -12,6 +12,7 @@
 
 / {
        compatible = "ti,omap2430", "ti,omap2420", "ti,omap2";
+       interrupt-parent = <&intc>;
 
        aliases {
                serial0 = &uart1;
                        ti,hwmods = "uart3";
                        clock-frequency = <48000000>;
                };
+
+               timer2: timer@4802a000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4802a000 0x400>;
+                       interrupts = <38>;
+                       ti,hwmods = "timer2";
+               };
+
+               timer3: timer@48078000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48078000 0x400>;
+                       interrupts = <39>;
+                       ti,hwmods = "timer3";
+               };
+
+               timer4: timer@4807a000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4807a000 0x400>;
+                       interrupts = <40>;
+                       ti,hwmods = "timer4";
+               };
+
+               timer5: timer@4807c000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4807c000 0x400>;
+                       interrupts = <41>;
+                       ti,hwmods = "timer5";
+                       ti,timer-dsp;
+               };
+
+               timer6: timer@4807e000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4807e000 0x400>;
+                       interrupts = <42>;
+                       ti,hwmods = "timer6";
+                       ti,timer-dsp;
+               };
+
+               timer7: timer@48080000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48080000 0x400>;
+                       interrupts = <43>;
+                       ti,hwmods = "timer7";
+                       ti,timer-dsp;
+               };
+
+               timer8: timer@48082000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48082000 0x400>;
+                       interrupts = <44>;
+                       ti,hwmods = "timer8";
+                       ti,timer-dsp;
+               };
+
+               timer9: timer@48084000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48084000 0x400>;
+                       interrupts = <45>;
+                       ti,hwmods = "timer9";
+                       ti,timer-pwm;
+               };
+
+               timer10: timer@48086000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48086000 0x400>;
+                       interrupts = <46>;
+                       ti,hwmods = "timer10";
+                       ti,timer-pwm;
+               };
+
+               timer11: timer@48088000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48088000 0x400>;
+                       interrupts = <47>;
+                       ti,hwmods = "timer11";
+                       ti,timer-pwm;
+               };
+
+               timer12: timer@4808a000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4808a000 0x400>;
+                       interrupts = <48>;
+                       ti,hwmods = "timer12";
+                       ti,timer-pwm;
+               };
        };
 };
index bfd76b4a0ddc95cc1c4d8d381c2420530dfd4a36..af6560908905595dbd2a535c013948afa7ef7637 100644 (file)
        compatible = "ti,omap2420", "ti,omap2";
 
        ocp {
+               counter32k: counter@48004000 {
+                       compatible = "ti,omap-counter32k";
+                       reg = <0x48004000 0x20>;
+                       ti,hwmods = "counter_32k";
+               };
+
                omap2420_pmx: pinmux@48000030 {
                        compatible = "ti,omap2420-padconf", "pinctrl-single";
                        reg = <0x48000030 0x0113>;
@@ -30,7 +36,6 @@
                        interrupts = <59>, /* TX interrupt */
                                     <60>; /* RX interrupt */
                        interrupt-names = "tx", "rx";
-                       interrupt-parent = <&intc>;
                        ti,hwmods = "mcbsp1";
                };
 
                        interrupts = <62>, /* TX interrupt */
                                     <63>; /* RX interrupt */
                        interrupt-names = "tx", "rx";
-                       interrupt-parent = <&intc>;
                        ti,hwmods = "mcbsp2";
                };
+
+               timer1: timer@48028000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48028000 0x400>;
+                       interrupts = <37>;
+                       ti,hwmods = "timer1";
+                       ti,timer-alwon;
+               };
        };
 };
index 4565d9750f4d82198646260c91d2fb497e6eb597..c3924457c9b62de16b2709434c98e99f280b3c47 100644 (file)
        compatible = "ti,omap2430", "ti,omap2";
 
        ocp {
+               counter32k: counter@49020000 {
+                       compatible = "ti,omap-counter32k";
+                       reg = <0x49020000 0x20>;
+                       ti,hwmods = "counter_32k";
+               };
+
                omap2430_pmx: pinmux@49002030 {
                        compatible = "ti,omap2430-padconf", "pinctrl-single";
                        reg = <0x49002030 0x0154>;
@@ -32,7 +38,6 @@
                                     <60>, /* RX interrupt */
                                     <61>; /* RX overflow interrupt */
                        interrupt-names = "common", "tx", "rx", "rx_overflow";
-                       interrupt-parent = <&intc>;
                        ti,buffer-size = <128>;
                        ti,hwmods = "mcbsp1";
                };
@@ -45,7 +50,6 @@
                                     <62>, /* TX interrupt */
                                     <63>; /* RX interrupt */
                        interrupt-names = "common", "tx", "rx";
-                       interrupt-parent = <&intc>;
                        ti,buffer-size = <128>;
                        ti,hwmods = "mcbsp2";
                };
@@ -58,7 +62,6 @@
                                     <89>, /* TX interrupt */
                                     <90>; /* RX interrupt */
                        interrupt-names = "common", "tx", "rx";
-                       interrupt-parent = <&intc>;
                        ti,buffer-size = <128>;
                        ti,hwmods = "mcbsp3";
                };
@@ -71,7 +74,6 @@
                                     <54>, /* TX interrupt */
                                     <55>; /* RX interrupt */
                        interrupt-names = "common", "tx", "rx";
-                       interrupt-parent = <&intc>;
                        ti,buffer-size = <128>;
                        ti,hwmods = "mcbsp4";
                };
                                     <81>, /* TX interrupt */
                                     <82>; /* RX interrupt */
                        interrupt-names = "common", "tx", "rx";
-                       interrupt-parent = <&intc>;
                        ti,buffer-size = <128>;
                        ti,hwmods = "mcbsp5";
                };
+
+               timer1: timer@49018000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x49018000 0x400>;
+                       interrupts = <37>;
+                       ti,hwmods = "timer1";
+                       ti,timer-alwon;
+               };
        };
 };
index c38cf76df81f2eaf3a3dfd9e1a8d3910f84f2067..3705a81c1fc25eac3b03d4b90be08f6fef7387f9 100644 (file)
                interrupts = <7>; /* SYS_NIRQ cascaded to intc */
                interrupt-parent = <&intc>;
 
-               vsim: regulator-vsim {
-                       compatible = "ti,twl4030-vsim";
-                       regulator-min-microvolt = <1800000>;
-                       regulator-max-microvolt = <3000000>;
-               };
-
                twl_audio: audio {
                        compatible = "ti,twl4030-audio";
                        codec {
diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
new file mode 100644 (file)
index 0000000..f624dc8
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+/include/ "omap3.dtsi"
+
+/ {
+       model = "TI OMAP3 BeagleBoard";
+       compatible = "ti,omap3-beagle", "ti,omap3";
+
+       memory {
+               device_type = "memory";
+               reg = <0x80000000 0x10000000>; /* 256 MB */
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pmu_stat {
+                       label = "beagleboard::pmu_stat";
+                       gpios = <&twl_gpio 19 0>; /* LEDB */
+               };
+
+               heartbeat {
+                       label = "beagleboard::usr0";
+                       gpios = <&gpio5 22 0>; /* 150 -> D6 LED */
+                       linux,default-trigger = "heartbeat";
+               };
+
+               mmc {
+                       label = "beagleboard::usr1";
+                       gpios = <&gpio5 21 0>; /* 149 -> D7 LED */
+                       linux,default-trigger = "mmc0";
+               };
+       };
+
+};
+
+&i2c1 {
+       clock-frequency = <2600000>;
+
+       twl: twl@48 {
+               reg = <0x48>;
+               interrupts = <7>; /* SYS_NIRQ cascaded to intc */
+               interrupt-parent = <&intc>;
+       };
+};
+
+/include/ "twl4030.dtsi"
+
+&mmc1 {
+       vmmc-supply = <&vmmc1>;
+       vmmc_aux-supply = <&vsim>;
+       bus-width = <8>;
+};
+
+&mmc2 {
+       status = "disabled";
+};
+
+&mmc3 {
+       status = "disabled";
+};
index 696e929d0304ff72580e83510771c1ba0048b91f..1acc26148ffcf94c1ee605d1db58c531f9b01e26 100644 (file)
@@ -12,6 +12,7 @@
 
 / {
        compatible = "ti,omap3430", "ti,omap3";
+       interrupt-parent = <&intc>;
 
        aliases {
                serial0 = &uart1;
                ranges;
                ti,hwmods = "l3_main";
 
+               counter32k: counter@48320000 {
+                       compatible = "ti,omap-counter32k";
+                       reg = <0x48320000 0x20>;
+                       ti,hwmods = "counter_32k";
+               };
+
                intc: interrupt-controller@48200000 {
                        compatible = "ti,omap2-intc";
                        interrupt-controller;
                                     <59>, /* TX interrupt */
                                     <60>; /* RX interrupt */
                        interrupt-names = "common", "tx", "rx";
-                       interrupt-parent = <&intc>;
                        ti,buffer-size = <128>;
                        ti,hwmods = "mcbsp1";
                };
                                     <63>, /* RX interrupt */
                                     <4>;  /* Sidetone */
                        interrupt-names = "common", "tx", "rx", "sidetone";
-                       interrupt-parent = <&intc>;
                        ti,buffer-size = <1280>;
                        ti,hwmods = "mcbsp2", "mcbsp2_sidetone";
                };
                                     <90>, /* RX interrupt */
                                     <5>;  /* Sidetone */
                        interrupt-names = "common", "tx", "rx", "sidetone";
-                       interrupt-parent = <&intc>;
                        ti,buffer-size = <128>;
                        ti,hwmods = "mcbsp3", "mcbsp3_sidetone";
                };
                                     <54>, /* TX interrupt */
                                     <55>; /* RX interrupt */
                        interrupt-names = "common", "tx", "rx";
-                       interrupt-parent = <&intc>;
                        ti,buffer-size = <128>;
                        ti,hwmods = "mcbsp4";
                };
                                     <81>, /* TX interrupt */
                                     <82>; /* RX interrupt */
                        interrupt-names = "common", "tx", "rx";
-                       interrupt-parent = <&intc>;
                        ti,buffer-size = <128>;
                        ti,hwmods = "mcbsp5";
                };
+
+               timer1: timer@48318000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48318000 0x400>;
+                       interrupts = <37>;
+                       ti,hwmods = "timer1";
+                       ti,timer-alwon;
+               };
+
+               timer2: timer@49032000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x49032000 0x400>;
+                       interrupts = <38>;
+                       ti,hwmods = "timer2";
+               };
+
+               timer3: timer@49034000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x49034000 0x400>;
+                       interrupts = <39>;
+                       ti,hwmods = "timer3";
+               };
+
+               timer4: timer@49036000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x49036000 0x400>;
+                       interrupts = <40>;
+                       ti,hwmods = "timer4";
+               };
+
+               timer5: timer@49038000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x49038000 0x400>;
+                       interrupts = <41>;
+                       ti,hwmods = "timer5";
+                       ti,timer-dsp;
+               };
+
+               timer6: timer@4903a000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4903a000 0x400>;
+                       interrupts = <42>;
+                       ti,hwmods = "timer6";
+                       ti,timer-dsp;
+               };
+
+               timer7: timer@4903c000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4903c000 0x400>;
+                       interrupts = <43>;
+                       ti,hwmods = "timer7";
+                       ti,timer-dsp;
+               };
+
+               timer8: timer@4903e000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4903e000 0x400>;
+                       interrupts = <44>;
+                       ti,hwmods = "timer8";
+                       ti,timer-pwm;
+                       ti,timer-dsp;
+               };
+
+               timer9: timer@49040000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x49040000 0x400>;
+                       interrupts = <45>;
+                       ti,hwmods = "timer9";
+                       ti,timer-pwm;
+               };
+
+               timer10: timer@48086000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48086000 0x400>;
+                       interrupts = <46>;
+                       ti,hwmods = "timer10";
+                       ti,timer-pwm;
+               };
+
+               timer11: timer@48088000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48088000 0x400>;
+                       interrupts = <47>;
+                       ti,hwmods = "timer11";
+                       ti,timer-pwm;
+               };
+
+               timer12: timer@48304000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48304000 0x400>;
+                       interrupts = <95>;
+                       ti,hwmods = "timer12";
+                       ti,timer-alwon;
+                       ti,timer-secure;
+               };
        };
 };
diff --git a/arch/arm/boot/dts/omap4-panda-a4.dts b/arch/arm/boot/dts/omap4-panda-a4.dts
new file mode 100644 (file)
index 0000000..75466d2
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/include/ "omap4-panda.dts"
+
+/* Pandaboard Rev A4+ have external pullups on SCL & SDA */
+&dss_hdmi_pins {
+       pinctrl-single,pins = <
+               0x5a 0x118      /* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */
+               0x5c 0x100      /* hdmi_scl.hdmi_scl INPUT | MODE 0 */
+               0x5e 0x100      /* hdmi_sda.hdmi_sda INPUT | MODE 0 */
+               >;
+};
similarity index 70%
rename from arch/arm/boot/dts/omap4-pandaES.dts
rename to arch/arm/boot/dts/omap4-panda-es.dts
index d4ba43a48d9b3f46a354267a9eb1d11b9739f3a4..73bc1a67e444480ff08ec414848981ec27fe7e39 100644 (file)
                "AFML", "Line In",
                "AFMR", "Line In";
 };
+
+/* PandaboardES has external pullups on SCL & SDA */
+&dss_hdmi_pins {
+       pinctrl-single,pins = <
+               0x5a 0x118      /* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */
+               0x5c 0x100      /* hdmi_scl.hdmi_scl INPUT | MODE 0 */
+               0x5e 0x100      /* hdmi_sda.hdmi_sda INPUT | MODE 0 */
+               >;
+};
index e8f927cbb376b37ed3d30465cad847a57d9f8ce6..4122efe31cfdf04ed6218ca970c7c661372d94e2 100644 (file)
@@ -65,6 +65,8 @@
                        &twl6040_pins
                        &mcpdm_pins
                        &mcbsp1_pins
+                       &dss_hdmi_pins
+                       &tpd12s015_pins
        >;
 
        twl6040_pins: pinmux_twl6040_pins {
                        0xc4 0x100      /* abe_mcbsp1_fsx.abe_mcbsp1_fsx INPUT | MODE0 */
                >;
        };
+
+       dss_hdmi_pins: pinmux_dss_hdmi_pins {
+               pinctrl-single,pins = <
+                       0x5a 0x118      /* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */
+                       0x5c 0x118      /* hdmi_scl.hdmi_scl INPUT PULLUP | MODE 0 */
+                       0x5e 0x118      /* hdmi_sda.hdmi_sda INPUT PULLUP | MODE 0 */
+               >;
+       };
+
+       tpd12s015_pins: pinmux_tpd12s015_pins {
+               pinctrl-single,pins = <
+                       0x22 0x3        /* gpmc_a17.gpio_41 OUTPUT | MODE3 */
+                       0x48 0x3        /* gpmc_nbe1.gpio_60 OUTPUT | MODE3 */
+                       0x58 0x10b      /* hdmi_hpd.gpio_63 INPUT PULLDOWN | MODE3 */
+               >;
+       };
 };
 
 &i2c1 {
 &dmic {
        status = "disabled";
 };
+
+&twl_usb_comparator {
+       usb-supply = <&vusb>;
+};
diff --git a/arch/arm/boot/dts/omap4-sdp-es23plus.dts b/arch/arm/boot/dts/omap4-sdp-es23plus.dts
new file mode 100644 (file)
index 0000000..b4a40ff
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/include/ "omap4-sdp.dts"
+
+/* SDP boards with 4430 ES2.3+ or 4460 have external pullups on SCL & SDA */
+&dss_hdmi_pins {
+       pinctrl-single,pins = <
+               0x5a 0x118      /* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */
+               0x5c 0x100      /* hdmi_scl.hdmi_scl INPUT | MODE 0 */
+               0x5e 0x100      /* hdmi_sda.hdmi_sda INPUT | MODE 0 */
+               >;
+};
index 5b7e04fbff500cf28b3338552b396745b30cac68..43e5258a9372b673d8c7a7866e30bbd5181148fa 100644 (file)
                        &dmic_pins
                        &mcbsp1_pins
                        &mcbsp2_pins
+                       &dss_hdmi_pins
+                       &tpd12s015_pins
        >;
 
        uart2_pins: pinmux_uart2_pins {
                        0xbc 0x100      /* abe_mcbsp2_fsx.abe_mcbsp2_fsx INPUT | MODE0 */
                >;
        };
+
+       dss_hdmi_pins: pinmux_dss_hdmi_pins {
+               pinctrl-single,pins = <
+                       0x5a 0x118      /* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */
+                       0x5c 0x118      /* hdmi_scl.hdmi_scl INPUT PULLUP | MODE 0 */
+                       0x5e 0x118      /* hdmi_sda.hdmi_sda INPUT PULLUP | MODE 0 */
+               >;
+       };
+
+       tpd12s015_pins: pinmux_tpd12s015_pins {
+               pinctrl-single,pins = <
+                       0x22 0x3        /* gpmc_a17.gpio_41 OUTPUT | MODE3 */
+                       0x48 0x3        /* gpmc_nbe1.gpio_60 OUTPUT | MODE3 */
+                       0x58 0x10b      /* hdmi_hpd.gpio_63 INPUT PULLDOWN | MODE3 */
+               >;
+       };
 };
 
 &i2c1 {
 &mcbsp3 {
        status = "disabled";
 };
+
+&twl_usb_comparator {
+       usb-supply = <&vusb>;
+};
index 3883f94fdbd0ed29430ec35815689ae4ff692cc5..739bb79e410e5bb5f558afdc85d227d9e5056885 100644 (file)
                ranges;
                ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
 
+               counter32k: counter@4a304000 {
+                       compatible = "ti,omap-counter32k";
+                       reg = <0x4a304000 0x20>;
+                       ti,hwmods = "counter_32k";
+               };
+
                omap4_pmx_core: pinmux@4a100040 {
                        compatible = "ti,omap4-padconf", "pinctrl-single";
                        reg = <0x4a100040 0x0196>;
                              <0x49032000 0x7f>; /* L3 Interconnect */
                        reg-names = "mpu", "dma";
                        interrupts = <0 112 0x4>;
-                       interrupt-parent = <&gic>;
                        ti,hwmods = "mcpdm";
                };
 
                              <0x4902e000 0x7f>; /* L3 Interconnect */
                        reg-names = "mpu", "dma";
                        interrupts = <0 114 0x4>;
-                       interrupt-parent = <&gic>;
                        ti,hwmods = "dmic";
                };
 
                        reg-names = "mpu", "dma";
                        interrupts = <0 17 0x4>;
                        interrupt-names = "common";
-                       interrupt-parent = <&gic>;
                        ti,buffer-size = <128>;
                        ti,hwmods = "mcbsp1";
                };
                        reg-names = "mpu", "dma";
                        interrupts = <0 22 0x4>;
                        interrupt-names = "common";
-                       interrupt-parent = <&gic>;
                        ti,buffer-size = <128>;
                        ti,hwmods = "mcbsp2";
                };
                        reg-names = "mpu", "dma";
                        interrupts = <0 23 0x4>;
                        interrupt-names = "common";
-                       interrupt-parent = <&gic>;
                        ti,buffer-size = <128>;
                        ti,hwmods = "mcbsp3";
                };
                        reg-names = "mpu";
                        interrupts = <0 16 0x4>;
                        interrupt-names = "common";
-                       interrupt-parent = <&gic>;
                        ti,buffer-size = <128>;
                        ti,hwmods = "mcbsp4";
                };
                        hw-caps-temp-alert;
                };
 
-               ocp2scp {
+               ocp2scp@4a0ad000 {
                        compatible = "ti,omap-ocp2scp";
+                       reg = <0x4a0ad000 0x1f>;
                        #address-cells = <1>;
                        #size-cells = <1>;
                        ranges;
                        ti,hwmods = "ocp2scp_usb_phy";
                };
+
+               timer1: timer@4a318000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4a318000 0x80>;
+                       interrupts = <0 37 0x4>;
+                       ti,hwmods = "timer1";
+                       ti,timer-alwon;
+               };
+
+               timer2: timer@48032000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48032000 0x80>;
+                       interrupts = <0 38 0x4>;
+                       ti,hwmods = "timer2";
+               };
+
+               timer3: timer@48034000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48034000 0x80>;
+                       interrupts = <0 39 0x4>;
+                       ti,hwmods = "timer3";
+               };
+
+               timer4: timer@48036000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48036000 0x80>;
+                       interrupts = <0 40 0x4>;
+                       ti,hwmods = "timer4";
+               };
+
+               timer5: timer@40138000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x40138000 0x80>,
+                             <0x49038000 0x80>;
+                       interrupts = <0 41 0x4>;
+                       ti,hwmods = "timer5";
+                       ti,timer-dsp;
+               };
+
+               timer6: timer@4013a000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4013a000 0x80>,
+                             <0x4903a000 0x80>;
+                       interrupts = <0 42 0x4>;
+                       ti,hwmods = "timer6";
+                       ti,timer-dsp;
+               };
+
+               timer7: timer@4013c000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4013c000 0x80>,
+                             <0x4903c000 0x80>;
+                       interrupts = <0 43 0x4>;
+                       ti,hwmods = "timer7";
+                       ti,timer-dsp;
+               };
+
+               timer8: timer@4013e000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4013e000 0x80>,
+                             <0x4903e000 0x80>;
+                       interrupts = <0 44 0x4>;
+                       ti,hwmods = "timer8";
+                       ti,timer-pwm;
+                       ti,timer-dsp;
+               };
+
+               timer9: timer@4803e000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4803e000 0x80>;
+                       interrupts = <0 45 0x4>;
+                       ti,hwmods = "timer9";
+                       ti,timer-pwm;
+               };
+
+               timer10: timer@48086000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48086000 0x80>;
+                       interrupts = <0 46 0x4>;
+                       ti,hwmods = "timer10";
+                       ti,timer-pwm;
+               };
+
+               timer11: timer@48088000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48088000 0x80>;
+                       interrupts = <0 47 0x4>;
+                       ti,hwmods = "timer11";
+                       ti,timer-pwm;
+               };
        };
 };
index c663eba73168adb8eb27edd7e15147440fae1af6..8722c15bbba2869a0fcd617517b132d930c05899 100644 (file)
@@ -8,6 +8,7 @@
 /dts-v1/;
 
 /include/ "omap5.dtsi"
+/include/ "samsung_k3pe0e000b.dtsi"
 
 / {
        model = "TI OMAP5 EVM board";
@@ -15,7 +16,7 @@
 
        memory {
                device_type = "memory";
-               reg = <0x80000000 0x40000000>; /* 1 GB */
+               reg = <0x80000000 0x80000000>; /* 2 GB */
        };
 
        vmmcsd_fixed: fixedregulator-mmcsd {
 &mcbsp3 {
        status = "disabled";
 };
+
+&emif1 {
+       cs1-used;
+       device-handle = <&samsung_K3PE0E000B>;
+};
+
+&emif2 {
+       cs1-used;
+       device-handle = <&samsung_K3PE0E000B>;
+};
index 42c78beb4fdc84c03c785bf50ac938d5d15063d1..790bb2a4b3434d47a500005da78ec20d385afd48 100644 (file)
                ranges;
                ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
 
+               counter32k: counter@4ae04000 {
+                       compatible = "ti,omap-counter32k";
+                       reg = <0x4ae04000 0x40>;
+                       ti,hwmods = "counter_32k";
+               };
+
                omap5_pmx_core: pinmux@4a002840 {
                        compatible = "ti,omap4-padconf", "pinctrl-single";
                        reg = <0x4a002840 0x01b6>;
 
                gpio1: gpio@4ae10000 {
                        compatible = "ti,omap4-gpio";
+                       reg = <0x4ae10000 0x200>;
+                       interrupts = <0 29 0x4>;
                        ti,hwmods = "gpio1";
                        gpio-controller;
                        #gpio-cells = <2>;
 
                gpio2: gpio@48055000 {
                        compatible = "ti,omap4-gpio";
+                       reg = <0x48055000 0x200>;
+                       interrupts = <0 30 0x4>;
                        ti,hwmods = "gpio2";
                        gpio-controller;
                        #gpio-cells = <2>;
 
                gpio3: gpio@48057000 {
                        compatible = "ti,omap4-gpio";
+                       reg = <0x48057000 0x200>;
+                       interrupts = <0 31 0x4>;
                        ti,hwmods = "gpio3";
                        gpio-controller;
                        #gpio-cells = <2>;
 
                gpio4: gpio@48059000 {
                        compatible = "ti,omap4-gpio";
+                       reg = <0x48059000 0x200>;
+                       interrupts = <0 32 0x4>;
                        ti,hwmods = "gpio4";
                        gpio-controller;
                        #gpio-cells = <2>;
 
                gpio5: gpio@4805b000 {
                        compatible = "ti,omap4-gpio";
+                       reg = <0x4805b000 0x200>;
+                       interrupts = <0 33 0x4>;
                        ti,hwmods = "gpio5";
                        gpio-controller;
                        #gpio-cells = <2>;
 
                gpio6: gpio@4805d000 {
                        compatible = "ti,omap4-gpio";
+                       reg = <0x4805d000 0x200>;
+                       interrupts = <0 34 0x4>;
                        ti,hwmods = "gpio6";
                        gpio-controller;
                        #gpio-cells = <2>;
 
                gpio7: gpio@48051000 {
                        compatible = "ti,omap4-gpio";
+                       reg = <0x48051000 0x200>;
+                       interrupts = <0 35 0x4>;
                        ti,hwmods = "gpio7";
                        gpio-controller;
                        #gpio-cells = <2>;
 
                gpio8: gpio@48053000 {
                        compatible = "ti,omap4-gpio";
+                       reg = <0x48053000 0x200>;
+                       interrupts = <0 121 0x4>;
                        ti,hwmods = "gpio8";
                        gpio-controller;
                        #gpio-cells = <2>;
 
                i2c1: i2c@48070000 {
                        compatible = "ti,omap4-i2c";
+                       reg = <0x48070000 0x100>;
+                       interrupts = <0 56 0x4>;
                        #address-cells = <1>;
                        #size-cells = <0>;
                        ti,hwmods = "i2c1";
 
                i2c2: i2c@48072000 {
                        compatible = "ti,omap4-i2c";
+                       reg = <0x48072000 0x100>;
+                       interrupts = <0 57 0x4>;
                        #address-cells = <1>;
                        #size-cells = <0>;
                        ti,hwmods = "i2c2";
 
                i2c3: i2c@48060000 {
                        compatible = "ti,omap4-i2c";
+                       reg = <0x48060000 0x100>;
+                       interrupts = <0 61 0x4>;
                        #address-cells = <1>;
                        #size-cells = <0>;
                        ti,hwmods = "i2c3";
                };
 
-               i2c4: i2c@4807A000 {
+               i2c4: i2c@4807a000 {
                        compatible = "ti,omap4-i2c";
+                       reg = <0x4807a000 0x100>;
+                       interrupts = <0 62 0x4>;
                        #address-cells = <1>;
                        #size-cells = <0>;
                        ti,hwmods = "i2c4";
                };
 
-               i2c5: i2c@4807C000 {
+               i2c5: i2c@4807c000 {
                        compatible = "ti,omap4-i2c";
+                       reg = <0x4807c000 0x100>;
+                       interrupts = <0 60 0x4>;
                        #address-cells = <1>;
                        #size-cells = <0>;
                        ti,hwmods = "i2c5";
 
                uart1: serial@4806a000 {
                        compatible = "ti,omap4-uart";
+                       reg = <0x4806a000 0x100>;
+                       interrupts = <0 72 0x4>;
                        ti,hwmods = "uart1";
                        clock-frequency = <48000000>;
                };
 
                uart2: serial@4806c000 {
                        compatible = "ti,omap4-uart";
+                       reg = <0x4806c000 0x100>;
+                       interrupts = <0 73 0x4>;
                        ti,hwmods = "uart2";
                        clock-frequency = <48000000>;
                };
 
                uart3: serial@48020000 {
                        compatible = "ti,omap4-uart";
+                       reg = <0x48020000 0x100>;
+                       interrupts = <0 74 0x4>;
                        ti,hwmods = "uart3";
                        clock-frequency = <48000000>;
                };
 
                uart4: serial@4806e000 {
                        compatible = "ti,omap4-uart";
+                       reg = <0x4806e000 0x100>;
+                       interrupts = <0 70 0x4>;
                        ti,hwmods = "uart4";
                        clock-frequency = <48000000>;
                };
 
                uart5: serial@48066000 {
-                       compatible = "ti,omap5-uart";
+                       compatible = "ti,omap4-uart";
+                       reg = <0x48066000 0x100>;
+                       interrupts = <0 105 0x4>;
                        ti,hwmods = "uart5";
                        clock-frequency = <48000000>;
                };
 
                uart6: serial@48068000 {
-                       compatible = "ti,omap6-uart";
+                       compatible = "ti,omap4-uart";
+                       reg = <0x48068000 0x100>;
+                       interrupts = <0 106 0x4>;
                        ti,hwmods = "uart6";
                        clock-frequency = <48000000>;
                };
 
                mmc1: mmc@4809c000 {
                        compatible = "ti,omap4-hsmmc";
+                       reg = <0x4809c000 0x400>;
+                       interrupts = <0 83 0x4>;
                        ti,hwmods = "mmc1";
                        ti,dual-volt;
                        ti,needs-special-reset;
 
                mmc2: mmc@480b4000 {
                        compatible = "ti,omap4-hsmmc";
+                       reg = <0x480b4000 0x400>;
+                       interrupts = <0 86 0x4>;
                        ti,hwmods = "mmc2";
                        ti,needs-special-reset;
                };
 
                mmc3: mmc@480ad000 {
                        compatible = "ti,omap4-hsmmc";
+                       reg = <0x480ad000 0x400>;
+                       interrupts = <0 94 0x4>;
                        ti,hwmods = "mmc3";
                        ti,needs-special-reset;
                };
 
                mmc4: mmc@480d1000 {
                        compatible = "ti,omap4-hsmmc";
+                       reg = <0x480d1000 0x400>;
+                       interrupts = <0 96 0x4>;
                        ti,hwmods = "mmc4";
                        ti,needs-special-reset;
                };
 
                mmc5: mmc@480d5000 {
                        compatible = "ti,omap4-hsmmc";
+                       reg = <0x480d5000 0x400>;
+                       interrupts = <0 59 0x4>;
                        ti,hwmods = "mmc5";
                        ti,needs-special-reset;
                };
                              <0x49032000 0x7f>; /* L3 Interconnect */
                        reg-names = "mpu", "dma";
                        interrupts = <0 112 0x4>;
-                       interrupt-parent = <&gic>;
                        ti,hwmods = "mcpdm";
                };
 
                              <0x4902e000 0x7f>; /* L3 Interconnect */
                        reg-names = "mpu", "dma";
                        interrupts = <0 114 0x4>;
-                       interrupt-parent = <&gic>;
                        ti,hwmods = "dmic";
                };
 
                        reg-names = "mpu", "dma";
                        interrupts = <0 17 0x4>;
                        interrupt-names = "common";
-                       interrupt-parent = <&gic>;
                        ti,buffer-size = <128>;
                        ti,hwmods = "mcbsp1";
                };
                        reg-names = "mpu", "dma";
                        interrupts = <0 22 0x4>;
                        interrupt-names = "common";
-                       interrupt-parent = <&gic>;
                        ti,buffer-size = <128>;
                        ti,hwmods = "mcbsp2";
                };
                        reg-names = "mpu", "dma";
                        interrupts = <0 23 0x4>;
                        interrupt-names = "common";
-                       interrupt-parent = <&gic>;
                        ti,buffer-size = <128>;
                        ti,hwmods = "mcbsp3";
                };
+
+               timer1: timer@4ae18000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4ae18000 0x80>;
+                       interrupts = <0 37 0x4>;
+                       ti,hwmods = "timer1";
+                       ti,timer-alwon;
+               };
+
+               timer2: timer@48032000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48032000 0x80>;
+                       interrupts = <0 38 0x4>;
+                       ti,hwmods = "timer2";
+               };
+
+               timer3: timer@48034000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48034000 0x80>;
+                       interrupts = <0 39 0x4>;
+                       ti,hwmods = "timer3";
+               };
+
+               timer4: timer@48036000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48036000 0x80>;
+                       interrupts = <0 40 0x4>;
+                       ti,hwmods = "timer4";
+               };
+
+               timer5: timer@40138000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x40138000 0x80>,
+                             <0x49038000 0x80>;
+                       interrupts = <0 41 0x4>;
+                       ti,hwmods = "timer5";
+                       ti,timer-dsp;
+               };
+
+               timer6: timer@4013a000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4013a000 0x80>,
+                             <0x4903a000 0x80>;
+                       interrupts = <0 42 0x4>;
+                       ti,hwmods = "timer6";
+                       ti,timer-dsp;
+                       ti,timer-pwm;
+               };
+
+               timer7: timer@4013c000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4013c000 0x80>,
+                             <0x4903c000 0x80>;
+                       interrupts = <0 43 0x4>;
+                       ti,hwmods = "timer7";
+                       ti,timer-dsp;
+               };
+
+               timer8: timer@4013e000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4013e000 0x80>,
+                             <0x4903e000 0x80>;
+                       interrupts = <0 44 0x4>;
+                       ti,hwmods = "timer8";
+                       ti,timer-dsp;
+                       ti,timer-pwm;
+               };
+
+               timer9: timer@4803e000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x4803e000 0x80>;
+                       interrupts = <0 45 0x4>;
+                       ti,hwmods = "timer9";
+               };
+
+               timer10: timer@48086000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48086000 0x80>;
+                       interrupts = <0 46 0x4>;
+                       ti,hwmods = "timer10";
+               };
+
+               timer11: timer@48088000 {
+                       compatible = "ti,omap2-timer";
+                       reg = <0x48088000 0x80>;
+                       interrupts = <0 47 0x4>;
+                       ti,hwmods = "timer11";
+                       ti,timer-pwm;
+               };
+
+               emif1: emif@0x4c000000 {
+                       compatible      = "ti,emif-4d5";
+                       ti,hwmods       = "emif1";
+                       phy-type        = <2>; /* DDR PHY type: Intelli PHY */
+                       reg = <0x4c000000 0x400>;
+                       interrupts = <0 110 0x4>;
+                       hw-caps-read-idle-ctrl;
+                       hw-caps-ll-interface;
+                       hw-caps-temp-alert;
+               };
+
+               emif2: emif@0x4d000000 {
+                       compatible      = "ti,emif-4d5";
+                       ti,hwmods       = "emif2";
+                       phy-type        = <2>; /* DDR PHY type: Intelli PHY */
+                       reg = <0x4d000000 0x400>;
+                       interrupts = <0 111 0x4>;
+                       hw-caps-read-idle-ctrl;
+                       hw-caps-ll-interface;
+                       hw-caps-temp-alert;
+               };
        };
 };
diff --git a/arch/arm/boot/dts/samsung_k3pe0e000b.dtsi b/arch/arm/boot/dts/samsung_k3pe0e000b.dtsi
new file mode 100644 (file)
index 0000000..9657a5c
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Timings and Geometry for Samsung K3PE0E000B memory part
+ */
+
+/ {
+       samsung_K3PE0E000B: lpddr2 {
+               compatible      = "Samsung,K3PE0E000B","jedec,lpddr2-s4";
+               density         = <4096>;
+               io-width        = <32>;
+
+               tRPab-min-tck   = <3>;
+               tRCD-min-tck    = <3>;
+               tWR-min-tck     = <3>;
+               tRASmin-min-tck = <3>;
+               tRRD-min-tck    = <2>;
+               tWTR-min-tck    = <2>;
+               tXP-min-tck     = <2>;
+               tRTP-min-tck    = <2>;
+               tCKE-min-tck    = <3>;
+               tCKESR-min-tck  = <3>;
+               tFAW-min-tck    = <8>;
+
+               timings_samsung_K3PE0E000B_533MHz: lpddr2-timings@0 {
+                       compatible      = "jedec,lpddr2-timings";
+                       min-freq        = <10000000>;
+                       max-freq        = <533333333>;
+                       tRPab           = <21000>;
+                       tRCD            = <18000>;
+                       tWR             = <15000>;
+                       tRAS-min        = <42000>;
+                       tRRD            = <10000>;
+                       tWTR            = <7500>;
+                       tXP             = <7500>;
+                       tRTP            = <7500>;
+                       tCKESR          = <15000>;
+                       tDQSCK-max      = <5500>;
+                       tFAW            = <50000>;
+                       tZQCS           = <90000>;
+                       tZQCL           = <360000>;
+                       tZQinit         = <1000000>;
+                       tRAS-max-ns     = <70000>;
+                       tDQSCK-max-derated = <6000>;
+               };
+
+               timings_samsung_K3PE0E000B_266MHz: lpddr2-timings@1 {
+                       compatible      = "jedec,lpddr2-timings";
+                       min-freq        = <10000000>;
+                       max-freq        = <266666666>;
+                       tRPab           = <21000>;
+                       tRCD            = <18000>;
+                       tWR             = <15000>;
+                       tRAS-min        = <42000>;
+                       tRRD            = <10000>;
+                       tWTR            = <7500>;
+                       tXP             = <7500>;
+                       tRTP            = <7500>;
+                       tCKESR          = <15000>;
+                       tDQSCK-max      = <5500>;
+                       tFAW            = <50000>;
+                       tZQCS           = <90000>;
+                       tZQCL           = <360000>;
+                       tZQinit         = <1000000>;
+                       tRAS-max-ns     = <70000>;
+                       tDQSCK-max-derated = <6000>;
+               };
+       };
+};
index 702c0baa6004bb9bddba8bbe5c19f008c31bbce0..9e02a913eb6265d155db696a15d8943605d76110 100644 (file)
@@ -14,7 +14,7 @@
 
 / {
        model = "Calao Systems Snowball platform with device tree";
-       compatible = "calaosystems,snowball-a9500";
+       compatible = "calaosystems,snowball-a9500", "st-ericsson,u9500";
 
        memory {
                reg = <0x00000000 0x20000000>;
                };
 
                // External Micro SD slot
-               sdi@80126000 {
+               sdi0_per1@80126000 {
                        arm,primecell-periphid = <0x10480180>;
                        max-frequency = <50000000>;
-                       bus-width = <8>;
+                       bus-width = <4>;
                        mmc-cap-mmc-highspeed;
                        vmmc-supply = <&ab8500_ldo_aux3_reg>;
 
                };
 
                // On-board eMMC
-               sdi@80114000 {
+               sdi4_per2@80114000 {
                        arm,primecell-periphid = <0x10480180>;
                        max-frequency = <50000000>;
                        bus-width = <8>;
                                reg = <0x33>;
                        };
                };
+
+               prcmu@80157000 {
+                       db8500-prcmu-regulators {
+                               db8500_vape_reg: db8500_vape {
+                                       regulator-name = "db8500-vape";
+                               };
+
+                               db8500_varm_reg: db8500_varm {
+                                       regulator-name = "db8500-varm";
+                               };
+
+                               db8500_vmodem_reg: db8500_vmodem {
+                                       regulator-name = "db8500-vmodem";
+                               };
+
+                               db8500_vpll_reg: db8500_vpll {
+                                       regulator-name = "db8500-vpll";
+                               };
+
+                               db8500_vsmps1_reg: db8500_vsmps1 {
+                                       regulator-name = "db8500-vsmps1";
+                               };
+
+                               db8500_vsmps2_reg: db8500_vsmps2 {
+                                       regulator-name = "db8500-vsmps2";
+                               };
+
+                               db8500_vsmps3_reg: db8500_vsmps3 {
+                                       regulator-name = "db8500-vsmps3";
+                               };
+
+                               db8500_vrf1_reg: db8500_vrf1 {
+                                       regulator-name = "db8500-vrf1";
+                               };
+
+                               db8500_sva_mmdsp_reg: db8500_sva_mmdsp {
+                                       regulator-name = "db8500-sva-mmdsp";
+                               };
+
+                               db8500_sva_mmdsp_ret_reg: db8500_sva_mmdsp_ret {
+                                       regulator-name = "db8500-sva-mmdsp-ret";
+                               };
+
+                               db8500_sva_pipe_reg: db8500_sva_pipe {
+                                       regulator-name = "db8500_sva_pipe";
+                               };
+
+                               db8500_sia_mmdsp_reg: db8500_sia_mmdsp {
+                                       regulator-name = "db8500_sia_mmdsp";
+                               };
+
+                               db8500_sia_mmdsp_ret_reg: db8500_sia_mmdsp_ret {
+                                       regulator-name = "db8500-sia-mmdsp-ret";
+                               };
+
+                               db8500_sia_pipe_reg: db8500_sia_pipe {
+                                       regulator-name = "db8500-sia-pipe";
+                               };
+
+                               db8500_sga_reg: db8500_sga {
+                                       regulator-name = "db8500-sga";
+                               };
+
+                               db8500_b2r2_mcde_reg: db8500_b2r2_mcde {
+                                       regulator-name = "db8500-b2r2-mcde";
+                               };
+
+                               db8500_esram12_reg: db8500_esram12 {
+                                       regulator-name = "db8500-esram12";
+                               };
+
+                               db8500_esram12_ret_reg: db8500_esram12_ret {
+                                       regulator-name = "db8500-esram12-ret";
+                               };
+
+                               db8500_esram34_reg: db8500_esram34 {
+                                       regulator-name = "db8500-esram34";
+                               };
+
+                               db8500_esram34_ret_reg: db8500_esram34_ret {
+                                       regulator-name = "db8500-esram34-ret";
+                               };
+                       };
+
+                       ab8500@5 {
+                               ab8500-regulators {
+                                       ab8500_ldo_aux1_reg: ab8500_ldo_aux1 {
+                                               regulator-name = "V-DISPLAY";
+                                       };
+
+                                       ab8500_ldo_aux2_reg: ab8500_ldo_aux2 {
+                                               regulator-name = "V-eMMC1";
+                                       };
+
+                                       ab8500_ldo_aux3_reg: ab8500_ldo_aux3 {
+                                               regulator-name = "V-MMC-SD";
+                                       };
+
+                                       ab8500_ldo_initcore_reg: ab8500_ldo_initcore {
+                                               regulator-name = "V-INTCORE";
+                                       };
+
+                                       ab8500_ldo_tvout_reg: ab8500_ldo_tvout {
+                                               regulator-name = "V-TVOUT";
+                                       };
+
+                                       ab8500_ldo_usb_reg: ab8500_ldo_usb {
+                                               regulator-name = "dummy";
+                                       };
+
+                                       ab8500_ldo_audio_reg: ab8500_ldo_audio {
+                                               regulator-name = "V-AUD";
+                                       };
+
+                                       ab8500_ldo_anamic1_reg: ab8500_ldo_anamic1 {
+                                               regulator-name = "V-AMIC1";
+                                       };
+
+                                       ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 {
+                                               regulator-name = "V-AMIC2";
+                                       };
+
+                                       ab8500_ldo_dmic_reg: ab8500_ldo_dmic {
+                                               regulator-name = "V-DMIC";
+                                       };
+
+                                       ab8500_ldo_ana_reg: ab8500_ldo_ana {
+                                               regulator-name = "V-CSI/DSI";
+                                       };
+                               };
+                       };
+               };
        };
 };
diff --git a/arch/arm/boot/dts/stuib.dtsi b/arch/arm/boot/dts/stuib.dtsi
new file mode 100644 (file)
index 0000000..39446a2
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2012 ST-Ericsson AB
+ *
+ * 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
+ */
+
+/ {
+       soc-u9500 {
+               i2c@80004000 {
+                       stmpe1601: stmpe1601@40 {
+                               compatible = "st,stmpe1601";
+                               reg = <0x40>;
+                               interrupts = <26 0x1>;
+                               interrupt-parent = <&gpio6>;
+                               interrupt-controller;
+
+                               wakeup-source;
+                               st,autosleep-timeout = <1024>;
+
+                               stmpe_keypad {
+                                       compatible = "st,stmpe-keypad";
+
+                                       debounce-interval = <64>;
+                                       st,scan-count = <8>;
+                                       st,no-autorepeat;
+
+                                       linux,keymap = <0x205006b
+                                                       0x4010074
+                                                       0x3050072
+                                                       0x1030004
+                                                       0x502006a
+                                                       0x500000a
+                                                       0x5008b
+                                                       0x706001c
+                                                       0x405000b
+                                                       0x6070003
+                                                       0x3040067
+                                                       0x303006c
+                                                       0x60400e7
+                                                       0x602009e
+                                                       0x4020073
+                                                       0x5050002
+                                                       0x4030069
+                                                       0x3020008>;
+                               };
+                       };
+               };
+
+               i2c@80110000 {
+                       bu21013_tp@0x5c {
+                               compatible = "rhom,bu21013_tp";
+                               reg = <0x5c>;
+                               touch-gpio = <&gpio2 20 0x4>;
+                               avdd-supply = <&ab8500_ldo_aux1_reg>;
+
+                               rhom,touch-max-x = <384>;
+                               rhom,touch-max-y = <704>;
+                               rhom,flip-y;
+                       };
+
+                       bu21013_tp@0x5d {
+                               compatible = "rhom,bu21013_tp";
+                               reg = <0x5d>;
+                               touch-gpio = <&gpio2 20 0x4>;
+                               avdd-supply = <&ab8500_ldo_aux1_reg>;
+
+                               rhom,touch-max-x = <384>;
+                               rhom,touch-max-y = <704>;
+                               rhom,flip-y;
+                       };
+               };
+       };
+};
index ff000172c93c42306c42fb15446b378a24596ed4..63411b036932011e6fe1b8764c7fa9ecdd0ee48f 100644 (file)
                regulator-max-microvolt = <3150000>;
        };
 
+       vusb1v5: regulator-vusb1v5 {
+               compatible = "ti,twl4030-vusb1v5";
+       };
+
+       vusb1v8: regulator-vusb1v8 {
+               compatible = "ti,twl4030-vusb1v8";
+       };
+
+       vusb3v1: regulator-vusb3v1 {
+               compatible = "ti,twl4030-vusb3v1";
+       };
+
+       vsim: regulator-vsim {
+               compatible = "ti,twl4030-vsim";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <3000000>;
+       };
+
        twl_gpio: gpio {
                compatible = "ti,twl4030-gpio";
                gpio-controller;
                interrupt-controller;
                #interrupt-cells = <1>;
        };
+
+       twl4030-usb {
+               compatible = "ti,twl4030-usb";
+               interrupts = <10>, <4>;
+               usb1v5-supply = <&vusb1v5>;
+               usb1v8-supply = <&vusb1v8>;
+               usb3v1-supply = <&vusb3v1>;
+               usb_mode = <1>;
+       };
 };
index 123e2c40218a4385361d6175d5259a77cb46199a..9996cfc5ee809a8854817757aded21e59b861161 100644 (file)
@@ -86,4 +86,9 @@
        clk32kg: regulator-clk32kg {
                compatible = "ti,twl6030-clk32kg";
        };
+
+       twl_usb_comparator: usb-comparator {
+               compatible = "ti,twl6030-usb";
+               interrupts = <4>, <10>;
+       };
 };
index 78ed575feb1abac028168ab3ab847694165c68c2..f71302c3ac3324713925bbe3ec28591be3c65e8a 100644 (file)
@@ -18,7 +18,9 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_IOSCHED_DEADLINE is not set
 # CONFIG_IOSCHED_CFQ is not set
 CONFIG_ARCH_MXC=y
-CONFIG_ARCH_IMX_V4_V5=y
+CONFIG_ARCH_MULTI_V4T=y
+CONFIG_ARCH_MULTI_V5=y
+# CONFIG_ARCH_MULTI_V7 is not set
 CONFIG_ARCH_MX1ADS=y
 CONFIG_MACH_SCB9328=y
 CONFIG_MACH_APF9328=y
index 394ded624e375a8e1e36b04ee5b85cefbf5c9391..44f117aab52cb42f429595c60a76fb7333aab8ca 100644 (file)
@@ -17,6 +17,8 @@ CONFIG_MODVERSIONS=y
 CONFIG_MODULE_SRCVERSION_ALL=y
 # CONFIG_BLK_DEV_BSG is not set
 CONFIG_ARCH_MXC=y
+CONFIG_ARCH_MULTI_V6=y
+CONFIG_ARCH_MULTI_V7=y
 CONFIG_MACH_MX31LILLY=y
 CONFIG_MACH_MX31LITE=y
 CONFIG_MACH_PCM037=y
index da6845493caabae29842d959f0b80bdcc1bd7790..6fe7ede6f0c23e10427d58454c50df765a531040 100644 (file)
@@ -76,6 +76,7 @@ CONFIG_AB8500_CORE=y
 CONFIG_REGULATOR=y
 CONFIG_REGULATOR_AB8500=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
+CONFIG_REGULATOR_GPIO=y
 # CONFIG_HID_SUPPORT is not set
 CONFIG_USB_GADGET=y
 CONFIG_AB8500_USB=y
index 35c1ed89b93652688dc99ede919b55b0d5051b1d..42f042ee4ada2563aac52e7449c062011042839c 100644 (file)
@@ -64,7 +64,7 @@ extern void __raw_readsl(const void __iomem *addr, void *data, int longlen);
 static inline void __raw_writew(u16 val, volatile void __iomem *addr)
 {
        asm volatile("strh %1, %0"
-                    : "+Qo" (*(volatile u16 __force *)addr)
+                    : "+Q" (*(volatile u16 __force *)addr)
                     : "r" (val));
 }
 
@@ -72,7 +72,7 @@ static inline u16 __raw_readw(const volatile void __iomem *addr)
 {
        u16 val;
        asm volatile("ldrh %1, %0"
-                    : "+Qo" (*(volatile u16 __force *)addr),
+                    : "+Q" (*(volatile u16 __force *)addr),
                       "=r" (val));
        return val;
 }
index 05b8e82ec9f5b66744305de1094df1115fc92798..e3f7572634381bd28fbf3225eb375788431ee3fc 100644 (file)
@@ -10,7 +10,5 @@
 
 extern void sched_clock_postinit(void);
 extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
-extern void setup_sched_clock_needs_suspend(u32 (*read)(void), int bits,
-               unsigned long rate);
 
 #endif
index 6a6f1e485f41a2b9402534c435b79c183cb5cdb2..301c1db3e99b13e95a6e8882013e7c518b6011c7 100644 (file)
@@ -27,9 +27,9 @@
 #if __LINUX_ARM_ARCH__ <= 6
        ldr     \tmp, =elf_hwcap                    @ may not have MVFR regs
        ldr     \tmp, [\tmp, #0]
-       tst     \tmp, #HWCAP_VFPv3D16
-       ldceql  p11, cr0, [\base],#32*4             @ FLDMIAD \base!, {d16-d31}
-       addne   \base, \base, #32*4                 @ step over unused register space
+       tst     \tmp, #HWCAP_VFPD32
+       ldcnel  p11, cr0, [\base],#32*4             @ FLDMIAD \base!, {d16-d31}
+       addeq   \base, \base, #32*4                 @ step over unused register space
 #else
        VFPFMRX \tmp, MVFR0                         @ Media and VFP Feature Register 0
        and     \tmp, \tmp, #MVFR0_A_SIMD_MASK      @ A_SIMD field
@@ -51,9 +51,9 @@
 #if __LINUX_ARM_ARCH__ <= 6
        ldr     \tmp, =elf_hwcap                    @ may not have MVFR regs
        ldr     \tmp, [\tmp, #0]
-       tst     \tmp, #HWCAP_VFPv3D16
-       stceql  p11, cr0, [\base],#32*4             @ FSTMIAD \base!, {d16-d31}
-       addne   \base, \base, #32*4                 @ step over unused register space
+       tst     \tmp, #HWCAP_VFPD32
+       stcnel  p11, cr0, [\base],#32*4             @ FSTMIAD \base!, {d16-d31}
+       addeq   \base, \base, #32*4                 @ step over unused register space
 #else
        VFPFMRX \tmp, MVFR0                         @ Media and VFP Feature Register 0
        and     \tmp, \tmp, #MVFR0_A_SIMD_MASK      @ A_SIMD field
similarity index 59%
rename from arch/arm/plat-mxc/include/mach/debug-macro.S
rename to arch/arm/include/debug/imx.S
index 761e45f9456f1a8adfe3806b2b157dcc186e21ce..0b65d792f6640433a2bc51c3fed50525c899ef63 100644 (file)
  * published by the Free Software Foundation.
  *
  */
-#include <mach/hardware.h>
-
 #ifdef CONFIG_DEBUG_IMX1_UART
-#define UART_PADDR     MX1_UART1_BASE_ADDR
+#define UART_PADDR     0x00206000
 #elif defined (CONFIG_DEBUG_IMX25_UART)
-#define UART_PADDR     MX25_UART1_BASE_ADDR
+#define UART_PADDR     0x43f90000
 #elif defined (CONFIG_DEBUG_IMX21_IMX27_UART)
-#define UART_PADDR     MX2x_UART1_BASE_ADDR
+#define UART_PADDR     0x1000a000
 #elif defined (CONFIG_DEBUG_IMX31_IMX35_UART)
-#define UART_PADDR     MX3x_UART1_BASE_ADDR
+#define UART_PADDR     0x43f90000
 #elif defined (CONFIG_DEBUG_IMX51_UART)
-#define UART_PADDR     MX51_UART1_BASE_ADDR
+#define UART_PADDR     0x73fbc000
 #elif defined (CONFIG_DEBUG_IMX50_IMX53_UART)
-#define UART_PADDR     MX53_UART1_BASE_ADDR
+#define UART_PADDR     0x53fbc000
 #elif defined (CONFIG_DEBUG_IMX6Q_UART2)
-#define UART_PADDR     MX6Q_UART2_BASE_ADDR
+#define UART_PADDR     0x021e8000
 #elif defined (CONFIG_DEBUG_IMX6Q_UART4)
-#define UART_PADDR     MX6Q_UART4_BASE_ADDR
+#define UART_PADDR     0x021f0000
 #endif
 
-#define UART_VADDR     IMX_IO_ADDRESS(UART_PADDR)
+/*
+ * FIXME: This is a copy of IMX_IO_P2V in hardware.h, and needs to
+ * stay sync with that.  It's hard to maintain, and should be fixed
+ * globally for multi-platform build to use a fixed virtual address
+ * for low-level debug uart port across platforms.
+ */
+#define IMX_IO_P2V(x)  (                                               \
+                       (((x) & 0x80000000) >> 7) |                     \
+                       (0xf4000000 +                                   \
+                       (((x) & 0x50000000) >> 6) +                     \
+                       (((x) & 0x0b000000) >> 4) +                     \
+                       (((x) & 0x000fffff))))
+
+#define UART_VADDR     IMX_IO_P2V(UART_PADDR)
 
                .macro  addruart, rp, rv, tmp
                ldr     \rp, =UART_PADDR        @ physical
index f254f6503cce7df8aedc3104db344417913d44c1..3688fd15a32dd5a5e5f81aef148cf397022fc2d7 100644 (file)
 #define HWCAP_THUMBEE  (1 << 11)
 #define HWCAP_NEON     (1 << 12)
 #define HWCAP_VFPv3    (1 << 13)
-#define HWCAP_VFPv3D16 (1 << 14)
+#define HWCAP_VFPv3D16 (1 << 14)       /* also set for VFPv4-D16 */
 #define HWCAP_TLS      (1 << 15)
 #define HWCAP_VFPv4    (1 << 16)
 #define HWCAP_IDIVA    (1 << 17)
 #define HWCAP_IDIVT    (1 << 18)
+#define HWCAP_VFPD32   (1 << 19)       /* set if VFP has 32 regs (not 16) */
 #define HWCAP_IDIV     (HWCAP_IDIVA | HWCAP_IDIVT)
 
 
index e21bac20d90da1558000125586623bdb9cbe328c..fc6692e2b603b747553835f04a85bf3b1f9c5f3b 100644 (file)
@@ -107,13 +107,6 @@ static void sched_clock_poll(unsigned long wrap_ticks)
        update_sched_clock();
 }
 
-void __init setup_sched_clock_needs_suspend(u32 (*read)(void), int bits,
-               unsigned long rate)
-{
-       setup_sched_clock(read, bits, rate);
-       cd.needs_suspend = true;
-}
-
 void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)
 {
        unsigned long r, w;
@@ -189,18 +182,15 @@ void __init sched_clock_postinit(void)
 static int sched_clock_suspend(void)
 {
        sched_clock_poll(sched_clock_timer.data);
-       if (cd.needs_suspend)
-               cd.suspended = true;
+       cd.suspended = true;
        return 0;
 }
 
 static void sched_clock_resume(void)
 {
-       if (cd.needs_suspend) {
-               cd.epoch_cyc = read_sched_clock();
-               cd.epoch_cyc_copy = cd.epoch_cyc;
-               cd.suspended = false;
-       }
+       cd.epoch_cyc = read_sched_clock();
+       cd.epoch_cyc_copy = cd.epoch_cyc;
+       cd.suspended = false;
 }
 
 static struct syscore_ops sched_clock_ops = {
similarity index 99%
rename from arch/arm/plat-mxc/3ds_debugboard.c
rename to arch/arm/mach-imx/3ds_debugboard.c
index 5c10ad05df740fe6d514ad61fea52b3cd01f12c5..1343773529665e876db7bf08e34b529bb3e80a81 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/regulator/machine.h>
 #include <linux/regulator/fixed.h>
 
-#include <mach/hardware.h>
+#include "hardware.h"
 
 /* LAN9217 ethernet base address */
 #define LAN9217_BASE_ADDR(n)   (n + 0x0)
index 8d276584650e810d349868ba4c154823cbe271aa..ff702c3f35b7998408101ce40c761366468c53c1 100644 (file)
@@ -1,3 +1,70 @@
+config ARCH_MXC
+       bool "Freescale i.MX family" if ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7
+       select ARCH_REQUIRE_GPIOLIB
+       select ARM_PATCH_PHYS_VIRT
+       select AUTO_ZRELADDR if !ZBOOT_ROM
+       select CLKDEV_LOOKUP
+       select CLKSRC_MMIO
+       select GENERIC_CLOCKEVENTS
+       select GENERIC_IRQ_CHIP
+       select MULTI_IRQ_HANDLER
+       select SPARSE_IRQ
+       select USE_OF
+       help
+         Support for Freescale MXC/iMX-based family of processors
+
+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 even IRQF_DISABLED flag is not set.
+         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
+
+config MXC_AVIC
+       bool
+
+config MXC_DEBUG_BOARD
+       bool "Enable MXC debug board(for 3-stack)"
+       help
+         The debug board is an integral part of the MXC 3-stack(PDK)
+         platforms, it can be attached or removed from the peripheral
+         board. On debug board, several debug devices(ethernet, UART,
+         buttons, LEDs and JTAG) are implemented. Between the MCU and
+         these devices, a CPLD is added as a bridge which performs
+         data/address de-multiplexing and decode, signal level shift,
+         interrupt control and various board functions.
+
+config HAVE_EPIT
+       bool
+
+config MXC_USE_EPIT
+       bool "Use EPIT instead of GPT"
+       depends on HAVE_EPIT
+       help
+         Use EPIT as the system timer on systems that have it. Normally you
+         don't have a reason to do so as the EPIT has the same features and
+         uses the same clocks as the GPT. Anyway, on some systems the GPT
+         may be in use for other purposes.
+
+config MXC_ULPI
+       bool
+
+config ARCH_HAS_RNGA
+       bool
+
+config IRAM_ALLOC
+       bool
+       select GENERIC_ALLOCATOR
+
 config HAVE_IMX_GPC
        bool
 
@@ -5,6 +72,12 @@ config HAVE_IMX_MMDC
        bool
 
 config HAVE_IMX_SRC
+       def_bool y if SMP
+
+config IMX_HAVE_IOMUX_V1
+       bool
+
+config ARCH_MXC_IOMUX_V3
        bool
 
 config ARCH_MX1
@@ -104,7 +177,7 @@ config      SOC_IMX51
        select PINCTRL_IMX51
        select SOC_IMX5
 
-if ARCH_IMX_V4_V5
+if ARCH_MULTI_V4T
 
 comment "MX1 platforms:"
 config MACH_MXLADS
@@ -133,6 +206,10 @@ config MACH_APF9328
        help
          Say Yes here if you are using the Armadeus APF9328 development board
 
+endif
+
+if ARCH_MULTI_V5
+
 comment "MX21 platforms:"
 
 config MACH_MX21ADS
@@ -195,6 +272,13 @@ config MACH_EUKREA_MBIMXSD25_BASEBOARD
 
 endchoice
 
+config MACH_IMX25_DT
+       bool "Support i.MX25 platforms from device tree"
+       select SOC_IMX25
+       help
+         Include support for Freescale i.MX25 based platforms
+         using the device tree for discovery
+
 comment "MX27 platforms:"
 
 config MACH_MX27ADS
@@ -384,7 +468,7 @@ config MACH_IMX27_DT
 
 endif
 
-if ARCH_IMX_V6_V7
+if ARCH_MULTI_V6
 
 comment "MX31 platforms:"
 
@@ -649,6 +733,10 @@ config MACH_VPR200
          Include support for VPR200 platform. This includes specific
          configurations for the board and its peripherals.
 
+endif
+
+if ARCH_MULTI_V7
+
 comment "i.MX5 platforms:"
 
 config MACH_MX50_RDP
@@ -756,7 +844,6 @@ config SOC_IMX6Q
        select HAVE_CAN_FLEXCAN if CAN
        select HAVE_IMX_GPC
        select HAVE_IMX_MMDC
-       select HAVE_IMX_SRC
        select HAVE_SMP
        select MFD_SYSCON
        select PINCTRL
@@ -766,3 +853,7 @@ config SOC_IMX6Q
          This enables support for Freescale i.MX6 Quad processor.
 
 endif
+
+source "arch/arm/mach-imx/devices/Kconfig"
+
+endmenu
index 895754aeb4f33f856a12009989743d02a894176c..0634b3152c24ca6918ba6584c8da914fd5d7dacf 100644 (file)
@@ -1,3 +1,5 @@
+obj-y := time.o cpu.o system.o irq-common.o
+
 obj-$(CONFIG_SOC_IMX1) += clk-imx1.o mm-imx1.o
 obj-$(CONFIG_SOC_IMX21) += clk-imx21.o mm-imx21.o
 
@@ -15,6 +17,24 @@ obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o mm-imx5.o clk-imx51-imx53.o ehci-imx5.o $(i
 obj-$(CONFIG_COMMON_CLK) += clk-pllv1.o clk-pllv2.o clk-pllv3.o clk-gate2.o \
                            clk-pfd.o clk-busy.o clk.o
 
+obj-$(CONFIG_IMX_HAVE_IOMUX_V1) += iomux-v1.o
+obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o
+
+obj-$(CONFIG_MXC_TZIC) += tzic.o
+obj-$(CONFIG_MXC_AVIC) += avic.o
+
+obj-$(CONFIG_IRAM_ALLOC) += iram_alloc.o
+obj-$(CONFIG_MXC_ULPI) += ulpi.o
+obj-$(CONFIG_MXC_USE_EPIT) += epit.o
+obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
+obj-$(CONFIG_CPU_FREQ_IMX)    += cpufreq.o
+obj-$(CONFIG_CPU_IDLE) += cpuidle.o
+
+ifdef CONFIG_SND_IMX_SOC
+obj-y += ssi-fiq.o
+obj-y += ssi-fiq-ksym.o
+endif
+
 # Support for CMOS sensor interface
 obj-$(CONFIG_MX1_VIDEO) += mx1-camera-fiq.o mx1-camera-fiq-ksym.o
 
@@ -30,6 +50,7 @@ obj-$(CONFIG_MACH_MX21ADS) += mach-mx21ads.o
 obj-$(CONFIG_MACH_MX25_3DS) += mach-mx25_3ds.o
 obj-$(CONFIG_MACH_EUKREA_CPUIMX25SD) += mach-eukrea_cpuimx25.o
 obj-$(CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD) += eukrea_mbimxsd25-baseboard.o
+obj-$(CONFIG_MACH_IMX25_DT) += imx25-dt.o
 
 # i.MX27 based machines
 obj-$(CONFIG_MACH_MX27ADS) += mach-mx27ads.o
@@ -89,3 +110,5 @@ obj-$(CONFIG_MACH_MX50_RDP) += mach-mx50_rdp.o
 
 obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o
 obj-$(CONFIG_SOC_IMX53) += mach-imx53.o
+
+obj-y += devices/
similarity index 98%
rename from arch/arm/plat-mxc/avic.c
rename to arch/arm/mach-imx/avic.c
index cbd55c36def3e52d304fbd965ba9891b89d345e5..0eff23ed92b930c5e2c56b3b0c3753420ac09ff5 100644 (file)
 #include <linux/irqdomain.h>
 #include <linux/io.h>
 #include <linux/of.h>
-#include <mach/common.h>
 #include <asm/mach/irq.h>
 #include <asm/exception.h>
-#include <mach/hardware.h>
-#include <mach/irqs.h>
 
+#include "common.h"
+#include "hardware.h"
 #include "irq-common.h"
 
 #define AVIC_INTCNTL           0x00    /* int control reg */
index 516ddee1948e81dc207d1b91c29380452c6c970d..15f9d223cf0b9a7dcd489c2c603b46aaaaad604c 100644 (file)
@@ -22,9 +22,9 @@
 #include <linux/clkdev.h>
 #include <linux/err.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
 #include "clk.h"
+#include "common.h"
+#include "hardware.h"
 
 /* CCM register addresses */
 #define IO_ADDR_CCM(off)       (MX1_IO_ADDRESS(MX1_CCM_BASE_ADDR + (off)))
@@ -82,7 +82,8 @@ int __init mx1_clocks_init(unsigned long fref)
                        pr_err("imx1 clk %d: register failed with %ld\n",
                                i, PTR_ERR(clk[i]));
 
-       clk_register_clkdev(clk[dma_gate], "ahb", "imx-dma");
+       clk_register_clkdev(clk[dma_gate], "ahb", "imx1-dma");
+       clk_register_clkdev(clk[hclk], "ipg", "imx1-dma");
        clk_register_clkdev(clk[csi_gate], NULL, "mx1-camera.0");
        clk_register_clkdev(clk[mma_gate], "mma", NULL);
        clk_register_clkdev(clk[usbd_gate], NULL, "imx_udc.0");
@@ -94,18 +95,18 @@ int __init mx1_clocks_init(unsigned long fref)
        clk_register_clkdev(clk[hclk], "ipg", "imx1-uart.1");
        clk_register_clkdev(clk[per1], "per", "imx1-uart.2");
        clk_register_clkdev(clk[hclk], "ipg", "imx1-uart.2");
-       clk_register_clkdev(clk[hclk], NULL, "imx-i2c.0");
+       clk_register_clkdev(clk[hclk], NULL, "imx1-i2c.0");
        clk_register_clkdev(clk[per2], "per", "imx1-cspi.0");
        clk_register_clkdev(clk[dummy], "ipg", "imx1-cspi.0");
        clk_register_clkdev(clk[per2], "per", "imx1-cspi.1");
        clk_register_clkdev(clk[dummy], "ipg", "imx1-cspi.1");
        clk_register_clkdev(clk[per2], NULL, "imx-mmc.0");
-       clk_register_clkdev(clk[per2], "per", "imx-fb.0");
-       clk_register_clkdev(clk[dummy], "ipg", "imx-fb.0");
-       clk_register_clkdev(clk[dummy], "ahb", "imx-fb.0");
+       clk_register_clkdev(clk[per2], "per", "imx1-fb.0");
+       clk_register_clkdev(clk[dummy], "ipg", "imx1-fb.0");
+       clk_register_clkdev(clk[dummy], "ahb", "imx1-fb.0");
        clk_register_clkdev(clk[hclk], "mshc", NULL);
        clk_register_clkdev(clk[per3], "ssi", NULL);
-       clk_register_clkdev(clk[clk32], NULL, "mxc_rtc.0");
+       clk_register_clkdev(clk[clk32], NULL, "imx1-rtc.0");
        clk_register_clkdev(clk[clko], "clko", NULL);
 
        mxc_timer_init(MX1_IO_ADDRESS(MX1_TIM1_BASE_ADDR), MX1_TIM1_INT);
index cf65148bc519a036b1dc8b7e4e5d6c9b57920c5a..d7ed66091a2ab60f0ef372ebf7ee57af8a4e4e6e 100644 (file)
@@ -25,9 +25,9 @@
 #include <linux/module.h>
 #include <linux/err.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
 #include "clk.h"
+#include "common.h"
+#include "hardware.h"
 
 #define IO_ADDR_CCM(off)       (MX21_IO_ADDRESS(MX21_CCM_BASE_ADDR + (off)))
 
@@ -156,16 +156,16 @@ int __init mx21_clocks_init(unsigned long lref, unsigned long href)
        clk_register_clkdev(clk[cspi2_ipg_gate], "ipg", "imx21-cspi.1");
        clk_register_clkdev(clk[per2], "per", "imx21-cspi.2");
        clk_register_clkdev(clk[cspi3_ipg_gate], "ipg", "imx21-cspi.2");
-       clk_register_clkdev(clk[per3], "per", "imx-fb.0");
-       clk_register_clkdev(clk[lcdc_ipg_gate], "ipg", "imx-fb.0");
-       clk_register_clkdev(clk[lcdc_hclk_gate], "ahb", "imx-fb.0");
+       clk_register_clkdev(clk[per3], "per", "imx21-fb.0");
+       clk_register_clkdev(clk[lcdc_ipg_gate], "ipg", "imx21-fb.0");
+       clk_register_clkdev(clk[lcdc_hclk_gate], "ahb", "imx21-fb.0");
        clk_register_clkdev(clk[usb_gate], "per", "imx21-hcd.0");
        clk_register_clkdev(clk[usb_hclk_gate], "ahb", "imx21-hcd.0");
-       clk_register_clkdev(clk[nfc_gate], NULL, "mxc_nand.0");
-       clk_register_clkdev(clk[dma_hclk_gate], "ahb", "imx-dma");
-       clk_register_clkdev(clk[dma_gate], "ipg", "imx-dma");
+       clk_register_clkdev(clk[nfc_gate], NULL, "imx21-nand.0");
+       clk_register_clkdev(clk[dma_hclk_gate], "ahb", "imx21-dma");
+       clk_register_clkdev(clk[dma_gate], "ipg", "imx21-dma");
        clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0");
-       clk_register_clkdev(clk[i2c_gate], NULL, "imx-i2c.0");
+       clk_register_clkdev(clk[i2c_gate], NULL, "imx21-i2c.0");
        clk_register_clkdev(clk[kpp_gate], NULL, "mxc-keypad");
        clk_register_clkdev(clk[owire_gate], NULL, "mxc_w1.0");
        clk_register_clkdev(clk[brom_gate], "brom", NULL);
index 01e2f843bf2e0d65910bf0951f12555077f7693e..b197aa73dc4b448ad603256f8ea1ea5a9be8e30c 100644 (file)
 #include <linux/io.h>
 #include <linux/clkdev.h>
 #include <linux/err.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/mx25.h>
 #include "clk.h"
+#include "common.h"
+#include "hardware.h"
+#include "mx25.h"
 
 #define CRM_BASE       MX25_IO_ADDRESS(MX25_CRM_BASE_ADDR)
 
@@ -55,6 +58,8 @@
 
 #define ccm(x) (CRM_BASE + (x))
 
+static struct clk_onecell_data clk_data;
+
 static const char *cpu_sel_clks[] = { "mpll", "mpll_cpu_3_4", };
 static const char *per_sel_clks[] = { "ahb", "upll", };
 
@@ -64,24 +69,30 @@ enum mx25_clks {
        per7_sel, per8_sel, per9_sel, per10_sel, per11_sel, per12_sel,
        per13_sel, per14_sel, per15_sel, per0, per1, per2, per3, per4, per5,
        per6, per7, per8, per9, per10, per11, per12, per13, per14, per15,
-       csi_ipg_per, esdhc1_ipg_per, esdhc2_ipg_per, gpt_ipg_per, i2c_ipg_per,
-       lcdc_ipg_per, nfc_ipg_per, ssi1_ipg_per, ssi2_ipg_per, uart_ipg_per,
-       csi_ahb, esdhc1_ahb, esdhc2_ahb, fec_ahb, lcdc_ahb, sdma_ahb,
-       usbotg_ahb, can1_ipg, can2_ipg, csi_ipg, cspi1_ipg, cspi2_ipg,
-       cspi3_ipg, dryice_ipg, esdhc1_ipg, esdhc2_ipg, fec_ipg, iim_ipg,
-       kpp_ipg, lcdc_ipg, pwm1_ipg, pwm2_ipg, pwm3_ipg, pwm4_ipg, sdma_ipg,
-       ssi1_ipg, ssi2_ipg, tsc_ipg, uart1_ipg, uart2_ipg, uart3_ipg,
-       uart4_ipg, uart5_ipg, wdt_ipg, clk_max
+       csi_ipg_per, epit_ipg_per, esai_ipg_per, esdhc1_ipg_per, esdhc2_ipg_per,
+       gpt_ipg_per, i2c_ipg_per, lcdc_ipg_per, nfc_ipg_per, owire_ipg_per,
+       pwm_ipg_per, sim1_ipg_per, sim2_ipg_per, ssi1_ipg_per, ssi2_ipg_per,
+       uart_ipg_per, ata_ahb, reserved1, csi_ahb, emi_ahb, esai_ahb, esdhc1_ahb,
+       esdhc2_ahb, fec_ahb, lcdc_ahb, rtic_ahb, sdma_ahb, slcdc_ahb, usbotg_ahb,
+       reserved2, reserved3, reserved4, reserved5, can1_ipg, can2_ipg, csi_ipg,
+       cspi1_ipg, cspi2_ipg, cspi3_ipg, dryice_ipg, ect_ipg, epit1_ipg, epit2_ipg,
+       reserved6, esdhc1_ipg, esdhc2_ipg, fec_ipg, reserved7, reserved8, reserved9,
+       gpt1_ipg, gpt2_ipg, gpt3_ipg, gpt4_ipg, reserved10, reserved11, reserved12,
+       iim_ipg, reserved13, reserved14, kpp_ipg, lcdc_ipg, reserved15, pwm1_ipg,
+       pwm2_ipg, pwm3_ipg, pwm4_ipg, rngb_ipg, reserved16, scc_ipg, sdma_ipg,
+       sim1_ipg, sim2_ipg, slcdc_ipg, spba_ipg, ssi1_ipg, ssi2_ipg, tsc_ipg,
+       uart1_ipg, uart2_ipg, uart3_ipg, uart4_ipg, uart5_ipg, reserved17,
+       wdt_ipg, clk_max
 };
 
 static struct clk *clk[clk_max];
 
-int __init mx25_clocks_init(void)
+static int __init __mx25_clocks_init(unsigned long osc_rate)
 {
        int i;
 
        clk[dummy] = imx_clk_fixed("dummy", 0);
-       clk[osc] = imx_clk_fixed("osc", 24000000);
+       clk[osc] = imx_clk_fixed("osc", osc_rate);
        clk[mpll] = imx_clk_pllv1("mpll", "osc", ccm(CCM_MPCTL));
        clk[upll] = imx_clk_pllv1("upll", "osc", ccm(CCM_UPCTL));
        clk[mpll_cpu_3_4] = imx_clk_fixed_factor("mpll_cpu_3_4", "mpll", 3, 4);
@@ -123,22 +134,36 @@ int __init mx25_clocks_init(void)
        clk[per14] = imx_clk_divider("per14", "per14_sel", ccm(CCM_PCDR3), 16, 6);
        clk[per15] = imx_clk_divider("per15", "per15_sel", ccm(CCM_PCDR3), 24, 6);
        clk[csi_ipg_per] = imx_clk_gate("csi_ipg_per", "per0", ccm(CCM_CGCR0), 0);
+       clk[epit_ipg_per] = imx_clk_gate("epit_ipg_per", "per1", ccm(CCM_CGCR0),  1);
+       clk[esai_ipg_per] = imx_clk_gate("esai_ipg_per", "per2", ccm(CCM_CGCR0),  2);
        clk[esdhc1_ipg_per] = imx_clk_gate("esdhc1_ipg_per", "per3", ccm(CCM_CGCR0),  3);
        clk[esdhc2_ipg_per] = imx_clk_gate("esdhc2_ipg_per", "per4", ccm(CCM_CGCR0),  4);
        clk[gpt_ipg_per] = imx_clk_gate("gpt_ipg_per", "per5", ccm(CCM_CGCR0),  5);
        clk[i2c_ipg_per] = imx_clk_gate("i2c_ipg_per", "per6", ccm(CCM_CGCR0),  6);
        clk[lcdc_ipg_per] = imx_clk_gate("lcdc_ipg_per", "per7", ccm(CCM_CGCR0),  7);
        clk[nfc_ipg_per] = imx_clk_gate("nfc_ipg_per", "per8", ccm(CCM_CGCR0),  8);
+       clk[owire_ipg_per] = imx_clk_gate("owire_ipg_per", "per9", ccm(CCM_CGCR0),  9);
+       clk[pwm_ipg_per] = imx_clk_gate("pwm_ipg_per", "per10", ccm(CCM_CGCR0),  10);
+       clk[sim1_ipg_per] = imx_clk_gate("sim1_ipg_per", "per11", ccm(CCM_CGCR0),  11);
+       clk[sim2_ipg_per] = imx_clk_gate("sim2_ipg_per", "per12", ccm(CCM_CGCR0),  12);
        clk[ssi1_ipg_per] = imx_clk_gate("ssi1_ipg_per", "per13", ccm(CCM_CGCR0), 13);
        clk[ssi2_ipg_per] = imx_clk_gate("ssi2_ipg_per", "per14", ccm(CCM_CGCR0), 14);
        clk[uart_ipg_per] = imx_clk_gate("uart_ipg_per", "per15", ccm(CCM_CGCR0), 15);
+       clk[ata_ahb] = imx_clk_gate("ata_ahb", "ahb", ccm(CCM_CGCR0), 16);
+       /* CCM_CGCR0(17): reserved */
        clk[csi_ahb] = imx_clk_gate("csi_ahb", "ahb", ccm(CCM_CGCR0), 18);
+       clk[emi_ahb] = imx_clk_gate("emi_ahb", "ahb", ccm(CCM_CGCR0), 19);
+       clk[esai_ahb] = imx_clk_gate("esai_ahb", "ahb", ccm(CCM_CGCR0), 20);
        clk[esdhc1_ahb] = imx_clk_gate("esdhc1_ahb", "ahb", ccm(CCM_CGCR0), 21);
        clk[esdhc2_ahb] = imx_clk_gate("esdhc2_ahb", "ahb", ccm(CCM_CGCR0), 22);
        clk[fec_ahb] = imx_clk_gate("fec_ahb", "ahb", ccm(CCM_CGCR0), 23);
        clk[lcdc_ahb] = imx_clk_gate("lcdc_ahb", "ahb", ccm(CCM_CGCR0), 24);
+       clk[rtic_ahb] = imx_clk_gate("rtic_ahb", "ahb", ccm(CCM_CGCR0), 25);
        clk[sdma_ahb] = imx_clk_gate("sdma_ahb", "ahb", ccm(CCM_CGCR0), 26);
+       clk[slcdc_ahb] = imx_clk_gate("slcdc_ahb", "ahb", ccm(CCM_CGCR0), 27);
        clk[usbotg_ahb] = imx_clk_gate("usbotg_ahb", "ahb", ccm(CCM_CGCR0), 28);
+       /* CCM_CGCR0(29-31): reserved */
+       /* CCM_CGCR1(0): reserved in datasheet, used as audmux in FSL kernel */
        clk[can1_ipg] = imx_clk_gate("can1_ipg", "ipg", ccm(CCM_CGCR1),  2);
        clk[can2_ipg] = imx_clk_gate("can2_ipg", "ipg", ccm(CCM_CGCR1),  3);
        clk[csi_ipg] = imx_clk_gate("csi_ipg", "ipg", ccm(CCM_CGCR1),  4);
@@ -146,17 +171,41 @@ int __init mx25_clocks_init(void)
        clk[cspi2_ipg] = imx_clk_gate("cspi2_ipg", "ipg", ccm(CCM_CGCR1),  6);
        clk[cspi3_ipg] = imx_clk_gate("cspi3_ipg", "ipg", ccm(CCM_CGCR1),  7);
        clk[dryice_ipg] = imx_clk_gate("dryice_ipg", "ipg", ccm(CCM_CGCR1),  8);
+       clk[ect_ipg] = imx_clk_gate("ect_ipg", "ipg", ccm(CCM_CGCR1),  9);
+       clk[epit1_ipg] = imx_clk_gate("epit1_ipg", "ipg", ccm(CCM_CGCR1),  10);
+       clk[epit2_ipg] = imx_clk_gate("epit2_ipg", "ipg", ccm(CCM_CGCR1),  11);
+       /* CCM_CGCR1(12): reserved in datasheet, used as esai in FSL kernel */
        clk[esdhc1_ipg] = imx_clk_gate("esdhc1_ipg", "ipg", ccm(CCM_CGCR1), 13);
        clk[esdhc2_ipg] = imx_clk_gate("esdhc2_ipg", "ipg", ccm(CCM_CGCR1), 14);
        clk[fec_ipg] = imx_clk_gate("fec_ipg", "ipg", ccm(CCM_CGCR1), 15);
+       /* CCM_CGCR1(16): reserved in datasheet, used as gpio1 in FSL kernel */
+       /* CCM_CGCR1(17): reserved in datasheet, used as gpio2 in FSL kernel */
+       /* CCM_CGCR1(18): reserved in datasheet, used as gpio3 in FSL kernel */
+       clk[gpt1_ipg] = imx_clk_gate("gpt1_ipg", "ipg", ccm(CCM_CGCR1), 19);
+       clk[gpt2_ipg] = imx_clk_gate("gpt2_ipg", "ipg", ccm(CCM_CGCR1), 20);
+       clk[gpt3_ipg] = imx_clk_gate("gpt3_ipg", "ipg", ccm(CCM_CGCR1), 21);
+       clk[gpt4_ipg] = imx_clk_gate("gpt4_ipg", "ipg", ccm(CCM_CGCR1), 22);
+       /* CCM_CGCR1(23): reserved in datasheet, used as i2c1 in FSL kernel */
+       /* CCM_CGCR1(24): reserved in datasheet, used as i2c2 in FSL kernel */
+       /* CCM_CGCR1(25): reserved in datasheet, used as i2c3 in FSL kernel */
        clk[iim_ipg] = imx_clk_gate("iim_ipg", "ipg", ccm(CCM_CGCR1), 26);
+       /* CCM_CGCR1(27): reserved in datasheet, used as iomuxc in FSL kernel */
+       /* CCM_CGCR1(28): reserved in datasheet, used as kpp in FSL kernel */
        clk[kpp_ipg] = imx_clk_gate("kpp_ipg", "ipg", ccm(CCM_CGCR1), 28);
        clk[lcdc_ipg] = imx_clk_gate("lcdc_ipg", "ipg", ccm(CCM_CGCR1), 29);
+       /* CCM_CGCR1(30): reserved in datasheet, used as owire in FSL kernel */
        clk[pwm1_ipg] = imx_clk_gate("pwm1_ipg", "ipg", ccm(CCM_CGCR1), 31);
        clk[pwm2_ipg] = imx_clk_gate("pwm2_ipg", "ipg", ccm(CCM_CGCR2),  0);
        clk[pwm3_ipg] = imx_clk_gate("pwm3_ipg", "ipg", ccm(CCM_CGCR2),  1);
        clk[pwm4_ipg] = imx_clk_gate("pwm4_ipg", "ipg", ccm(CCM_CGCR2),  2);
+       clk[rngb_ipg] = imx_clk_gate("rngb_ipg", "ipg", ccm(CCM_CGCR2),  3);
+       /* CCM_CGCR2(4): reserved in datasheet, used as rtic in FSL kernel */
+       clk[scc_ipg] = imx_clk_gate("scc_ipg", "ipg", ccm(CCM_CGCR2),  5);
        clk[sdma_ipg] = imx_clk_gate("sdma_ipg", "ipg", ccm(CCM_CGCR2),  6);
+       clk[sim1_ipg] = imx_clk_gate("sim1_ipg", "ipg", ccm(CCM_CGCR2),  7);
+       clk[sim2_ipg] = imx_clk_gate("sim2_ipg", "ipg", ccm(CCM_CGCR2),  8);
+       clk[slcdc_ipg] = imx_clk_gate("slcdc_ipg", "ipg", ccm(CCM_CGCR2),  9);
+       clk[spba_ipg] = imx_clk_gate("spba_ipg", "ipg", ccm(CCM_CGCR2),  10);
        clk[ssi1_ipg] = imx_clk_gate("ssi1_ipg", "ipg", ccm(CCM_CGCR2), 11);
        clk[ssi2_ipg] = imx_clk_gate("ssi2_ipg", "ipg", ccm(CCM_CGCR2), 12);
        clk[tsc_ipg] = imx_clk_gate("tsc_ipg", "ipg", ccm(CCM_CGCR2), 13);
@@ -165,6 +214,7 @@ int __init mx25_clocks_init(void)
        clk[uart3_ipg] = imx_clk_gate("uart3_ipg", "ipg", ccm(CCM_CGCR2), 16);
        clk[uart4_ipg] = imx_clk_gate("uart4_ipg", "ipg", ccm(CCM_CGCR2), 17);
        clk[uart5_ipg] = imx_clk_gate("uart5_ipg", "ipg", ccm(CCM_CGCR2), 18);
+       /* CCM_CGCR2(19): reserved in datasheet, but used as wdt in FSL kernel */
        clk[wdt_ipg] = imx_clk_gate("wdt_ipg", "ipg", ccm(CCM_CGCR2), 19);
 
        for (i = 0; i < ARRAY_SIZE(clk); i++)
@@ -172,6 +222,18 @@ int __init mx25_clocks_init(void)
                        pr_err("i.MX25 clk %d: register failed with %ld\n",
                                i, PTR_ERR(clk[i]));
 
+       clk_prepare_enable(clk[emi_ahb]);
+
+       clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0");
+       clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");
+
+       return 0;
+}
+
+int __init mx25_clocks_init(void)
+{
+       __mx25_clocks_init(24000000);
+
        /* i.mx25 has the i.mx21 type uart */
        clk_register_clkdev(clk[uart1_ipg], "ipg", "imx21-uart.0");
        clk_register_clkdev(clk[uart_ipg_per], "per", "imx21-uart.0");
@@ -183,8 +245,6 @@ int __init mx25_clocks_init(void)
        clk_register_clkdev(clk[uart_ipg_per], "per", "imx21-uart.3");
        clk_register_clkdev(clk[uart5_ipg], "ipg", "imx21-uart.4");
        clk_register_clkdev(clk[uart_ipg_per], "per", "imx21-uart.4");
-       clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0");
-       clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");
        clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.0");
        clk_register_clkdev(clk[usbotg_ahb], "ahb", "mxc-ehci.0");
        clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.0");
@@ -197,7 +257,7 @@ int __init mx25_clocks_init(void)
        clk_register_clkdev(clk[ipg], "ipg", "fsl-usb2-udc");
        clk_register_clkdev(clk[usbotg_ahb], "ahb", "fsl-usb2-udc");
        clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc");
-       clk_register_clkdev(clk[nfc_ipg_per], NULL, "mxc_nand.0");
+       clk_register_clkdev(clk[nfc_ipg_per], NULL, "imx25-nand.0");
        /* i.mx25 has the i.mx35 type cspi */
        clk_register_clkdev(clk[cspi1_ipg], NULL, "imx35-cspi.0");
        clk_register_clkdev(clk[cspi2_ipg], NULL, "imx35-cspi.1");
@@ -212,15 +272,15 @@ int __init mx25_clocks_init(void)
        clk_register_clkdev(clk[per10], "per", "mxc_pwm.3");
        clk_register_clkdev(clk[kpp_ipg], NULL, "imx-keypad");
        clk_register_clkdev(clk[tsc_ipg], NULL, "mx25-adc");
-       clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx-i2c.0");
-       clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx-i2c.1");
-       clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx-i2c.2");
+       clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx21-i2c.0");
+       clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx21-i2c.1");
+       clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx21-i2c.2");
        clk_register_clkdev(clk[fec_ipg], "ipg", "imx25-fec.0");
        clk_register_clkdev(clk[fec_ahb], "ahb", "imx25-fec.0");
        clk_register_clkdev(clk[dryice_ipg], NULL, "imxdi_rtc.0");
-       clk_register_clkdev(clk[lcdc_ipg_per], "per", "imx-fb.0");
-       clk_register_clkdev(clk[lcdc_ipg], "ipg", "imx-fb.0");
-       clk_register_clkdev(clk[lcdc_ahb], "ahb", "imx-fb.0");
+       clk_register_clkdev(clk[lcdc_ipg_per], "per", "imx21-fb.0");
+       clk_register_clkdev(clk[lcdc_ipg], "ipg", "imx21-fb.0");
+       clk_register_clkdev(clk[lcdc_ahb], "ahb", "imx21-fb.0");
        clk_register_clkdev(clk[wdt_ipg], NULL, "imx2-wdt.0");
        clk_register_clkdev(clk[ssi1_ipg], NULL, "imx-ssi.0");
        clk_register_clkdev(clk[ssi2_ipg], NULL, "imx-ssi.1");
@@ -230,9 +290,9 @@ int __init mx25_clocks_init(void)
        clk_register_clkdev(clk[esdhc2_ipg_per], "per", "sdhci-esdhc-imx25.1");
        clk_register_clkdev(clk[esdhc2_ipg], "ipg", "sdhci-esdhc-imx25.1");
        clk_register_clkdev(clk[esdhc2_ahb], "ahb", "sdhci-esdhc-imx25.1");
-       clk_register_clkdev(clk[csi_ipg_per], "per", "mx2-camera.0");
-       clk_register_clkdev(clk[csi_ipg], "ipg", "mx2-camera.0");
-       clk_register_clkdev(clk[csi_ahb], "ahb", "mx2-camera.0");
+       clk_register_clkdev(clk[csi_ipg_per], "per", "imx25-camera.0");
+       clk_register_clkdev(clk[csi_ipg], "ipg", "imx25-camera.0");
+       clk_register_clkdev(clk[csi_ahb], "ahb", "imx25-camera.0");
        clk_register_clkdev(clk[dummy], "audmux", NULL);
        clk_register_clkdev(clk[can1_ipg], NULL, "flexcan.0");
        clk_register_clkdev(clk[can2_ipg], NULL, "flexcan.1");
@@ -242,5 +302,40 @@ int __init mx25_clocks_init(void)
        clk_register_clkdev(clk[iim_ipg], "iim", NULL);
 
        mxc_timer_init(MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), MX25_INT_GPT1);
+
+       return 0;
+}
+
+int __init mx25_clocks_init_dt(void)
+{
+       struct device_node *np;
+       void __iomem *base;
+       int irq;
+       unsigned long osc_rate = 24000000;
+
+       /* retrieve the freqency of fixed clocks from device tree */
+       for_each_compatible_node(np, NULL, "fixed-clock") {
+               u32 rate;
+               if (of_property_read_u32(np, "clock-frequency", &rate))
+                       continue;
+
+               if (of_device_is_compatible(np, "fsl,imx-osc"))
+                       osc_rate = rate;
+       }
+
+       np = of_find_compatible_node(NULL, NULL, "fsl,imx25-ccm");
+       clk_data.clks = clk;
+       clk_data.clk_num = ARRAY_SIZE(clk);
+       of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
+
+       __mx25_clocks_init(osc_rate);
+
+       np = of_find_compatible_node(NULL, NULL, "fsl,imx25-gpt");
+       base = of_iomap(np, 0);
+       WARN_ON(!base);
+       irq = irq_of_parse_and_map(np, 0);
+
+       mxc_timer_init(base, irq);
+
        return 0;
 }
index 366e5d59d886f7cd43bb79bfe50a70c9fa6a6c5b..585ab256c58f1af55b34884d030adeef67c065dc 100644 (file)
@@ -6,9 +6,9 @@
 #include <linux/clk-provider.h>
 #include <linux/of.h>
 
-#include <mach/common.h>
-#include <mach/hardware.h>
 #include "clk.h"
+#include "common.h"
+#include "hardware.h"
 
 #define IO_ADDR_CCM(off)       (MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR + (off)))
 
@@ -211,19 +211,19 @@ int __init mx27_clocks_init(unsigned long fref)
        clk_register_clkdev(clk[gpt6_ipg_gate], "ipg", "imx-gpt.5");
        clk_register_clkdev(clk[per1_gate], "per", "imx-gpt.5");
        clk_register_clkdev(clk[pwm_ipg_gate], NULL, "mxc_pwm.0");
-       clk_register_clkdev(clk[per2_gate], "per", "mxc-mmc.0");
-       clk_register_clkdev(clk[sdhc1_ipg_gate], "ipg", "mxc-mmc.0");
-       clk_register_clkdev(clk[per2_gate], "per", "mxc-mmc.1");
-       clk_register_clkdev(clk[sdhc2_ipg_gate], "ipg", "mxc-mmc.1");
-       clk_register_clkdev(clk[per2_gate], "per", "mxc-mmc.2");
-       clk_register_clkdev(clk[sdhc2_ipg_gate], "ipg", "mxc-mmc.2");
+       clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.0");
+       clk_register_clkdev(clk[sdhc1_ipg_gate], "ipg", "imx21-mmc.0");
+       clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.1");
+       clk_register_clkdev(clk[sdhc2_ipg_gate], "ipg", "imx21-mmc.1");
+       clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.2");
+       clk_register_clkdev(clk[sdhc2_ipg_gate], "ipg", "imx21-mmc.2");
        clk_register_clkdev(clk[cspi1_ipg_gate], NULL, "imx27-cspi.0");
        clk_register_clkdev(clk[cspi2_ipg_gate], NULL, "imx27-cspi.1");
        clk_register_clkdev(clk[cspi3_ipg_gate], NULL, "imx27-cspi.2");
-       clk_register_clkdev(clk[per3_gate], "per", "imx-fb.0");
-       clk_register_clkdev(clk[lcdc_ipg_gate], "ipg", "imx-fb.0");
-       clk_register_clkdev(clk[lcdc_ahb_gate], "ahb", "imx-fb.0");
-       clk_register_clkdev(clk[csi_ahb_gate], "ahb", "mx2-camera.0");
+       clk_register_clkdev(clk[per3_gate], "per", "imx21-fb.0");
+       clk_register_clkdev(clk[lcdc_ipg_gate], "ipg", "imx21-fb.0");
+       clk_register_clkdev(clk[lcdc_ahb_gate], "ahb", "imx21-fb.0");
+       clk_register_clkdev(clk[csi_ahb_gate], "ahb", "imx27-camera.0");
        clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc");
        clk_register_clkdev(clk[usb_ipg_gate], "ipg", "fsl-usb2-udc");
        clk_register_clkdev(clk[usb_ahb_gate], "ahb", "fsl-usb2-udc");
@@ -238,27 +238,27 @@ int __init mx27_clocks_init(unsigned long fref)
        clk_register_clkdev(clk[usb_ahb_gate], "ahb", "mxc-ehci.2");
        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[nfc_baud_gate], NULL, "mxc_nand.0");
+       clk_register_clkdev(clk[nfc_baud_gate], NULL, "imx27-nand.0");
        clk_register_clkdev(clk[vpu_baud_gate], "per", "coda-imx27.0");
        clk_register_clkdev(clk[vpu_ahb_gate], "ahb", "coda-imx27.0");
-       clk_register_clkdev(clk[dma_ahb_gate], "ahb", "imx-dma");
-       clk_register_clkdev(clk[dma_ipg_gate], "ipg", "imx-dma");
+       clk_register_clkdev(clk[dma_ahb_gate], "ahb", "imx27-dma");
+       clk_register_clkdev(clk[dma_ipg_gate], "ipg", "imx27-dma");
        clk_register_clkdev(clk[fec_ipg_gate], "ipg", "imx27-fec.0");
        clk_register_clkdev(clk[fec_ahb_gate], "ahb", "imx27-fec.0");
        clk_register_clkdev(clk[wdog_ipg_gate], NULL, "imx2-wdt.0");
-       clk_register_clkdev(clk[i2c1_ipg_gate], NULL, "imx-i2c.0");
-       clk_register_clkdev(clk[i2c2_ipg_gate], NULL, "imx-i2c.1");
+       clk_register_clkdev(clk[i2c1_ipg_gate], NULL, "imx21-i2c.0");
+       clk_register_clkdev(clk[i2c2_ipg_gate], NULL, "imx21-i2c.1");
        clk_register_clkdev(clk[owire_ipg_gate], NULL, "mxc_w1.0");
        clk_register_clkdev(clk[kpp_ipg_gate], NULL, "imx-keypad");
-       clk_register_clkdev(clk[emma_ahb_gate], "emma-ahb", "mx2-camera.0");
-       clk_register_clkdev(clk[emma_ipg_gate], "emma-ipg", "mx2-camera.0");
+       clk_register_clkdev(clk[emma_ahb_gate], "emma-ahb", "imx27-camera.0");
+       clk_register_clkdev(clk[emma_ipg_gate], "emma-ipg", "imx27-camera.0");
        clk_register_clkdev(clk[emma_ahb_gate], "ahb", "m2m-emmaprp.0");
        clk_register_clkdev(clk[emma_ipg_gate], "ipg", "m2m-emmaprp.0");
        clk_register_clkdev(clk[iim_ipg_gate], "iim", NULL);
        clk_register_clkdev(clk[gpio_ipg_gate], "gpio", NULL);
        clk_register_clkdev(clk[brom_ahb_gate], "brom", NULL);
        clk_register_clkdev(clk[ata_ahb_gate], "ata", NULL);
-       clk_register_clkdev(clk[rtc_ipg_gate], NULL, "mxc_rtc");
+       clk_register_clkdev(clk[rtc_ipg_gate], NULL, "imx21-rtc");
        clk_register_clkdev(clk[scc_ipg_gate], "scc", NULL);
        clk_register_clkdev(clk[cpu_div], "cpu", NULL);
        clk_register_clkdev(clk[emi_ahb_gate], "emi_ahb" , NULL);
index 1253af2d99715a63f157a9f838230895006d9323..8be64e0a4ace0bec7a33f64ad2c056dfd0ad6947 100644 (file)
 #include <linux/err.h>
 #include <linux/of.h>
 
-#include <mach/hardware.h>
-#include <mach/mx31.h>
-#include <mach/common.h>
-
 #include "clk.h"
+#include "common.h"
 #include "crmregs-imx3.h"
+#include "hardware.h"
+#include "mx31.h"
 
 static const char *mcu_main_sel[] = { "spll", "mpll", };
 static const char *per_sel[] = { "per_div", "ipg", };
@@ -124,10 +123,10 @@ int __init mx31_clocks_init(unsigned long fref)
        clk_register_clkdev(clk[cspi3_gate], NULL, "imx31-cspi.2");
        clk_register_clkdev(clk[pwm_gate], "pwm", NULL);
        clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0");
-       clk_register_clkdev(clk[rtc_gate], NULL, "mxc_rtc");
+       clk_register_clkdev(clk[rtc_gate], NULL, "imx21-rtc");
        clk_register_clkdev(clk[epit1_gate], "epit", NULL);
        clk_register_clkdev(clk[epit2_gate], "epit", NULL);
-       clk_register_clkdev(clk[nfc], NULL, "mxc_nand.0");
+       clk_register_clkdev(clk[nfc], NULL, "imx27-nand.0");
        clk_register_clkdev(clk[ipu_gate], NULL, "ipu-core");
        clk_register_clkdev(clk[ipu_gate], NULL, "mx3_sdc_fb");
        clk_register_clkdev(clk[kpp_gate], NULL, "imx-keypad");
@@ -155,12 +154,12 @@ int __init mx31_clocks_init(unsigned long fref)
        clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.3");
        clk_register_clkdev(clk[uart5_gate], "per", "imx21-uart.4");
        clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.4");
-       clk_register_clkdev(clk[i2c1_gate], NULL, "imx-i2c.0");
-       clk_register_clkdev(clk[i2c2_gate], NULL, "imx-i2c.1");
-       clk_register_clkdev(clk[i2c3_gate], NULL, "imx-i2c.2");
+       clk_register_clkdev(clk[i2c1_gate], NULL, "imx21-i2c.0");
+       clk_register_clkdev(clk[i2c2_gate], NULL, "imx21-i2c.1");
+       clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2");
        clk_register_clkdev(clk[owire_gate], NULL, "mxc_w1.0");
-       clk_register_clkdev(clk[sdhc1_gate], NULL, "mxc-mmc.0");
-       clk_register_clkdev(clk[sdhc2_gate], NULL, "mxc-mmc.1");
+       clk_register_clkdev(clk[sdhc1_gate], NULL, "imx31-mmc.0");
+       clk_register_clkdev(clk[sdhc2_gate], NULL, "imx31-mmc.1");
        clk_register_clkdev(clk[ssi1_gate], NULL, "imx-ssi.0");
        clk_register_clkdev(clk[ssi2_gate], NULL, "imx-ssi.1");
        clk_register_clkdev(clk[firi_gate], "firi", NULL);
index 177259b523cda0e8ba704c8b2a523e6bf95c2411..66f3d65ea2755f0a522f2fdea52f9b9351fe5beb 100644 (file)
 #include <linux/of.h>
 #include <linux/err.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
-
 #include "crmregs-imx3.h"
 #include "clk.h"
+#include "common.h"
+#include "hardware.h"
 
 struct arm_ahb_div {
        unsigned char arm, ahb, sel;
@@ -226,9 +225,9 @@ int __init mx35_clocks_init()
        clk_register_clkdev(clk[fec_gate], NULL, "imx27-fec.0");
        clk_register_clkdev(clk[gpt_gate], "per", "imx-gpt.0");
        clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0");
-       clk_register_clkdev(clk[i2c1_gate], NULL, "imx-i2c.0");
-       clk_register_clkdev(clk[i2c2_gate], NULL, "imx-i2c.1");
-       clk_register_clkdev(clk[i2c3_gate], NULL, "imx-i2c.2");
+       clk_register_clkdev(clk[i2c1_gate], NULL, "imx21-i2c.0");
+       clk_register_clkdev(clk[i2c2_gate], NULL, "imx21-i2c.1");
+       clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2");
        clk_register_clkdev(clk[ipu_gate], NULL, "ipu-core");
        clk_register_clkdev(clk[ipu_gate], NULL, "mx3_sdc_fb");
        clk_register_clkdev(clk[kpp_gate], NULL, "imx-keypad");
@@ -256,7 +255,7 @@ int __init mx35_clocks_init()
        clk_register_clkdev(clk[ipg], "ipg", "fsl-usb2-udc");
        clk_register_clkdev(clk[usbotg_gate], "ahb", "fsl-usb2-udc");
        clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0");
-       clk_register_clkdev(clk[nfc_div], NULL, "mxc_nand.0");
+       clk_register_clkdev(clk[nfc_div], NULL, "imx25-nand.0");
        clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0");
 
        clk_prepare_enable(clk[spba_gate]);
index a0bf84803eacee45978fc1b1deef41076db17f19..abb71f6b4d6051b8c64d28c61c32faceb83d75ac 100644 (file)
 #include <linux/of.h>
 #include <linux/err.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
-
 #include "crm-regs-imx5.h"
 #include "clk.h"
+#include "common.h"
+#include "hardware.h"
 
 /* Low-power Audio Playback Mode clock */
 static const char *lp_apm_sel[] = { "osc", };
@@ -258,8 +257,8 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
        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, "imx-i2c.0");
-       clk_register_clkdev(clk[i2c2_gate], NULL, "imx-i2c.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");
@@ -272,7 +271,7 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
        clk_register_clkdev(clk[usboh3_per_gate], "per", "fsl-usb2-udc");
        clk_register_clkdev(clk[usboh3_gate], "ipg", "fsl-usb2-udc");
        clk_register_clkdev(clk[usboh3_gate], "ahb", "fsl-usb2-udc");
-       clk_register_clkdev(clk[nfc_gate], NULL, "mxc_nand");
+       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");
@@ -345,7 +344,7 @@ 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, "imx-i2c.2");
+       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");
@@ -440,7 +439,7 @@ int __init mx53_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[vpu_gate], NULL, "imx53-vpu.0");
-       clk_register_clkdev(clk[i2c3_gate], NULL, "imx-i2c.2");
+       clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2");
        clk_register_clkdev(clk[fec_gate], NULL, "imx25-fec.0");
        clk_register_clkdev(clk[ipu_gate], "bus", "imx53-ipu");
        clk_register_clkdev(clk[ipu_di0_gate], "di0", "imx53-ipu");
index 3ec242f3341ee7d6f64be258a75faadc16da6d29..e5a82bb95b526b7225bdd000c0d5665f6e3949c5 100644 (file)
@@ -19,8 +19,9 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
-#include <mach/common.h>
+
 #include "clk.h"
+#include "common.h"
 
 #define CCGR0                          0x68
 #define CCGR1                          0x6c
index 02be73178912f14e53af58b26c700413c8402ba8..abff350ba24cab1976f9594ad9a699903e599bbc 100644 (file)
@@ -4,10 +4,10 @@
 #include <linux/slab.h>
 #include <linux/kernel.h>
 #include <linux/err.h>
-#include <mach/common.h>
-#include <mach/hardware.h>
 
 #include "clk.h"
+#include "common.h"
+#include "hardware.h"
 
 /**
  * pll v1
similarity index 98%
rename from arch/arm/plat-mxc/include/mach/common.h
rename to arch/arm/mach-imx/common.h
index ead901814c0d86395047420b14deda478540afda..7191ab4434e52b5c881e170e9e7925e918ba42f5 100644 (file)
@@ -66,6 +66,7 @@ extern int mx51_clocks_init(unsigned long ckil, unsigned long osc,
                        unsigned long ckih1, unsigned long ckih2);
 extern int mx53_clocks_init(unsigned long ckil, unsigned long osc,
                        unsigned long ckih1, unsigned long ckih2);
+extern int mx25_clocks_init_dt(void);
 extern int mx27_clocks_init_dt(void);
 extern int mx31_clocks_init_dt(void);
 extern int mx51_clocks_init_dt(void);
@@ -79,6 +80,7 @@ extern void mxc_arch_reset_init(void __iomem *);
 extern int mx53_revision(void);
 extern int mx53_display_revision(void);
 extern void imx_set_aips(void __iomem *);
+extern int mxc_device_init(void);
 
 enum mxc_cpu_pwr_mode {
        WAIT_CLOCKED,           /* wfi only */
index 6914bcbf84e4287080d5e3849cb9a5e232c9674b..96ec64b5ff7d3e056ddfdea0f3918278732ea0c1 100644 (file)
@@ -11,8 +11,9 @@
  */
 #include <linux/module.h>
 #include <linux/io.h>
-#include <mach/hardware.h>
-#include <mach/iim.h>
+
+#include "iim.h"
+#include "hardware.h"
 
 static int mx25_cpu_rev = -1;
 
index ff38e1505f670306997d2aee412a9c71cc2e32a8..fe8d36f7e30ed95209ae218811c4420af52b5bee 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/io.h>
 #include <linux/module.h>
 
-#include <mach/hardware.h>
+#include "hardware.h"
 
 static int mx27_cpu_rev = -1;
 static int mx27_cpu_partnumber;
index 3f2345f0cdaf275659deef2b7adac0d5fc72a906..fde1860a25216ed9763fb7ba8256ed0b16757e70 100644 (file)
 
 #include <linux/module.h>
 #include <linux/io.h>
-#include <mach/hardware.h>
-#include <mach/iim.h>
-#include <mach/common.h>
+
+#include "common.h"
+#include "hardware.h"
+#include "iim.h"
 
 static int mx31_cpu_rev = -1;
 
index 846e46eb8cbfd87f2ad61131e7794fc27ca14e2a..ec3aaa098c1706b3d7cf88b9c608302777419aad 100644 (file)
@@ -10,8 +10,9 @@
  */
 #include <linux/module.h>
 #include <linux/io.h>
-#include <mach/hardware.h>
-#include <mach/iim.h>
+
+#include "hardware.h"
+#include "iim.h"
 
 static int mx35_cpu_rev = -1;
 
index 8eb15a2fcaf9307e047a16252ec25e0a5e59e9bb..d88760014ff96ab46277d3ef97e4f592105b5dbb 100644 (file)
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/module.h>
-#include <mach/hardware.h>
 #include <linux/io.h>
 
+#include "hardware.h"
+
 static int mx5_cpu_rev = -1;
 
 #define IIM_SREV 0x24
similarity index 97%
rename from arch/arm/plat-mxc/cpu.c
rename to arch/arm/mach-imx/cpu.c
index 220dd6f93126367efdbce0b1b7630fab4cec25d1..03fcbd082593b18eb32373f079dc15ae47392b8e 100644 (file)
@@ -1,7 +1,8 @@
 
 #include <linux/module.h>
 #include <linux/io.h>
-#include <mach/hardware.h>
+
+#include "hardware.h"
 
 unsigned int __mxc_cpu_type;
 EXPORT_SYMBOL(__mxc_cpu_type);
index 7b92cd6da6d3f1ae8330f75dcf4b879c7f492ec5..b9ef692b61a292bb75837a434edaacbd25b9c80e 100644 (file)
 
 #include <linux/bug.h>
 #include <linux/types.h>
-#include <mach/hardware.h>
 #include <linux/kernel.h>
 
+#include "hardware.h"
+
 static struct cpu_op mx51_cpu_op[] = {
        {
        .cpu_rate = 160000000,},
similarity index 99%
rename from arch/arm/plat-mxc/cpufreq.c
rename to arch/arm/mach-imx/cpufreq.c
index b5b6f80831307dc5051ced39d0ea841d43afa8bb..36e8b399447037a73eb5261381a39cd88d9ea2bf 100644 (file)
@@ -22,7 +22,8 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/slab.h>
-#include <mach/hardware.h>
+
+#include "hardware.h"
 
 #define CLK32_FREQ     32768
 #define NANOSECOND     (1000 * 1000 * 1000)
index 3aad1e70de969fe2d76f2a741ea4525818916563..f9b5afc6bcd153028fb0dc0587c3d895ec81b602 100644 (file)
@@ -6,8 +6,7 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/mx1.h>
-#include <mach/devices-common.h>
+#include "devices/devices-common.h"
 
 extern const struct imx_imx_fb_data imx1_imx_fb_data;
 #define imx1_add_imx_fb(pdata) \
index 93ece55f75dfbf3014039968a6a740d7cecd1900..bd939328015901e3315a528653b7afeffd649679 100644 (file)
@@ -6,8 +6,7 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/mx21.h>
-#include <mach/devices-common.h>
+#include "devices/devices-common.h"
 
 extern const struct imx_imx21_hcd_data imx21_imx21_hcd_data;
 #define imx21_add_imx21_hcd(pdata)     \
index f8e03dd1f116f16a8f175403c6e6cd62756caa2d..0d2922bc575caa862a99b60c621d24da6d3e14ca 100644 (file)
@@ -6,8 +6,7 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/mx25.h>
-#include <mach/devices-common.h>
+#include "devices/devices-common.h"
 
 extern const struct imx_fec_data imx25_fec_data;
 #define imx25_add_fec(pdata)   \
index 04822932cdd1d13c260b4e950ccb51dec9f4ff39..8a1ad7972d4c0843a096dcf7d21810737b16075b 100644 (file)
@@ -6,8 +6,7 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/mx27.h>
-#include <mach/devices-common.h>
+#include "devices/devices-common.h"
 
 extern const struct imx_fec_data imx27_fec_data;
 #define imx27_add_fec(pdata)   \
index 8b2ceb45bb8344223dae53b974e345237c707479..e8d1611bbc8e325f29bf897cea68ffcc9c253aa8 100644 (file)
@@ -6,8 +6,7 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/mx31.h>
-#include <mach/devices-common.h>
+#include "devices/devices-common.h"
 
 extern const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data;
 #define imx31_add_fsl_usb2_udc(pdata)  \
index c3e9f206ac2bdfdff093b2a082dbddd168aa4d05..e2675f1b141c0a0baedd8e5db9daa252a7541827 100644 (file)
@@ -6,8 +6,7 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/mx35.h>
-#include <mach/devices-common.h>
+#include "devices/devices-common.h"
 
 extern const struct imx_fec_data imx35_fec_data;
 #define imx35_add_fec(pdata)   \
index 7216667eaafcd2d259c2882a934b3f292c02ef21..2c290391f298653198784669e57fd48f72366922 100644 (file)
@@ -18,8 +18,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <mach/mx50.h>
-#include <mach/devices-common.h>
+#include "devices/devices-common.h"
 
 extern const struct imx_imx_uart_1irq_data imx50_imx_uart_data[];
 #define imx50_add_imx_uart(id, pdata)  \
index 9f1718725195414e0798a40d49c932838f7b4235..deee5baee88cf636627acb1c923b029e9d58b032 100644 (file)
@@ -6,8 +6,7 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/mx51.h>
-#include <mach/devices-common.h>
+#include "devices/devices-common.h"
 
 extern const struct imx_fec_data imx51_fec_data;
 #define imx51_add_fec(pdata)   \
similarity index 98%
rename from arch/arm/plat-mxc/devices/Makefile
rename to arch/arm/mach-imx/devices/Makefile
index 76f3195475d06abd27a9114cf3c64301a2ebdf52..2abe2a5144d0365312af9a6a9431ec9fd141a265 100644 (file)
@@ -1,3 +1,5 @@
+obj-y := devices.o
+
 obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_FSL_USB2_UDC) += platform-fsl-usb2-udc.o
similarity index 97%
rename from arch/arm/plat-mxc/include/mach/devices-common.h
rename to arch/arm/mach-imx/devices/devices-common.h
index eaf79d220c9a42d8c707218a5781073038ec2167..e4b790b9e2aaaea5d708371354ec83d9adc28844 100644 (file)
@@ -108,6 +108,7 @@ struct platform_device *__init imx_add_imxdi_rtc(
 
 #include <linux/platform_data/video-imxfb.h>
 struct imx_imx_fb_data {
+       const char *devid;
        resource_size_t iobase;
        resource_size_t iosize;
        resource_size_t irq;
@@ -118,6 +119,7 @@ struct platform_device *__init imx_add_imx_fb(
 
 #include <linux/platform_data/i2c-imx.h>
 struct imx_imx_i2c_data {
+       const char *devid;
        int id;
        resource_size_t iobase;
        resource_size_t iosize;
@@ -219,6 +221,7 @@ struct platform_device *__init imx_add_mx1_camera(
 
 #include <linux/platform_data/camera-mx2.h>
 struct imx_mx2_camera_data {
+       const char *devid;
        resource_size_t iobasecsi;
        resource_size_t iosizecsi;
        resource_size_t irqcsi;
@@ -244,6 +247,7 @@ struct platform_device *__init imx_add_mxc_ehci(
 
 #include <linux/platform_data/mmc-mxcmmc.h>
 struct imx_mxc_mmc_data {
+       const char *devid;
        int id;
        resource_size_t iobase;
        resource_size_t iosize;
@@ -256,6 +260,7 @@ struct platform_device *__init imx_add_mxc_mmc(
 
 #include <linux/platform_data/mtd-mxc_nand.h>
 struct imx_mxc_nand_data {
+       const char *devid;
        /*
         * id is traditionally 0, but -1 is more appropriate.  We use -1 for new
         * machines but don't change existing devices as the nand device usually
@@ -290,6 +295,7 @@ struct platform_device *__init imx_add_mxc_pwm(
 
 /* mxc_rtc */
 struct imx_mxc_rtc_data {
+       const char *devid;
        resource_size_t iobase;
        resource_size_t irq;
 };
@@ -326,7 +332,8 @@ struct platform_device *__init imx_add_spi_imx(
                const struct imx_spi_imx_data *data,
                const struct spi_imx_master *pdata);
 
-struct platform_device *imx_add_imx_dma(void);
+struct platform_device *imx_add_imx_dma(char *name, resource_size_t iobase,
+                                       int irq, int irq_err);
 struct platform_device *imx_add_imx_sdma(char *name,
        resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
 
similarity index 92%
rename from arch/arm/plat-mxc/devices.c
rename to arch/arm/mach-imx/devices/devices.c
index 4d55a7a26e98fd92a1bda89dd5f266864c0ed55f..1b37482407f911461846fc95f0528a1ed2fc6b70 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/init.h>
 #include <linux/err.h>
 #include <linux/platform_device.h>
-#include <mach/common.h>
 
 struct device mxc_aips_bus = {
        .init_name      = "mxc_aips",
@@ -33,7 +32,7 @@ struct device mxc_ahb_bus = {
        .parent         = &platform_bus,
 };
 
-static int __init mxc_device_init(void)
+int __init mxc_device_init(void)
 {
        int ret;
 
@@ -46,4 +45,3 @@ static int __init mxc_device_init(void)
 done:
        return ret;
 }
-core_initcall(mxc_device_init);
similarity index 98%
rename from arch/arm/plat-mxc/devices/platform-ahci-imx.c
rename to arch/arm/mach-imx/devices/platform-ahci-imx.c
index ade4a1c4e2a39e4aac13479deb48af97fd142c0b..3d87dd9c284ae1d6f8b99afcc49521fdf0bddef8 100644 (file)
@@ -24,8 +24,9 @@
 #include <linux/device.h>
 #include <linux/dma-mapping.h>
 #include <asm/sizes.h>
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_ahci_imx_data_entry_single(soc, _devid)            \
        {                                                               \
similarity index 97%
rename from arch/arm/plat-mxc/devices/platform-fec.c
rename to arch/arm/mach-imx/devices/platform-fec.c
index 0bae44e890db14e262cfdb46c50b09fb12279bf6..2cb188ad9a0a614422892a7ef64396bacdead050 100644 (file)
@@ -8,8 +8,9 @@
  */
 #include <linux/dma-mapping.h>
 #include <asm/sizes.h>
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_fec_data_entry_single(soc, _devid)                         \
        {                                                               \
similarity index 96%
rename from arch/arm/plat-mxc/devices/platform-flexcan.c
rename to arch/arm/mach-imx/devices/platform-flexcan.c
index 4e8497af2eb19fa344d52e2413303b1ee53cde56..1078bf0a94ef1122a81d094100030175423f173e 100644 (file)
@@ -5,8 +5,8 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_flexcan_data_entry_single(soc, _id, _hwid, _size)          \
        {                                                               \
similarity index 96%
rename from arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c
rename to arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c
index 848038f301fd24e518449beeb262018f95e367e6..37e44398197b4703b7130734d166963f9e894e01 100644 (file)
@@ -7,8 +7,9 @@
  * Free Software Foundation.
  */
 #include <linux/dma-mapping.h>
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_fsl_usb2_udc_data_entry_single(soc)                                \
        {                                                               \
similarity index 96%
rename from arch/arm/plat-mxc/devices/platform-gpio-mxc.c
rename to arch/arm/mach-imx/devices/platform-gpio-mxc.c
index a7919a241032184b94d005846eff6c84e66fc0e7..26483fa94b75109d13ed56ace45af8ed9c44656d 100644 (file)
@@ -6,7 +6,7 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/devices-common.h>
+#include "devices-common.h"
 
 struct platform_device *__init mxc_register_gpio(char *name, int id,
        resource_size_t iobase, resource_size_t iosize, int irq, int irq_high)
similarity index 94%
rename from arch/arm/plat-mxc/devices/platform-gpio_keys.c
rename to arch/arm/mach-imx/devices/platform-gpio_keys.c
index 1c53a532ea0ec6e6ab44e33afcb6aeeda2795659..486282539c76e72dd01e7dfefa317491f1cedb4f 100644 (file)
@@ -16,8 +16,9 @@
  * Boston, MA  02110-1301, USA.
  */
 #include <asm/sizes.h>
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+
+#include "../hardware.h"
+#include "devices-common.h"
 
 struct platform_device *__init imx_add_gpio_keys(
                const struct gpio_keys_platform_data *pdata)
similarity index 63%
rename from arch/arm/plat-mxc/devices/platform-imx-dma.c
rename to arch/arm/mach-imx/devices/platform-imx-dma.c
index 7fa7e9c9246803f74e95c97719009b3387ad660a..ccdb5dc4ddbdde117ae662c92ae25786bfaae764 100644 (file)
@@ -6,12 +6,29 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/devices-common.h>
+#include "devices-common.h"
 
-struct platform_device __init __maybe_unused *imx_add_imx_dma(void)
+struct platform_device __init __maybe_unused *imx_add_imx_dma(char *name,
+       resource_size_t iobase, int irq, int irq_err)
 {
+       struct resource res[] = {
+               {
+                       .start = iobase,
+                       .end = iobase + SZ_4K - 1,
+                       .flags = IORESOURCE_MEM,
+               }, {
+                       .start = irq,
+                       .end = irq,
+                       .flags = IORESOURCE_IRQ,
+               }, {
+                       .start = irq_err,
+                       .end = irq_err,
+                       .flags = IORESOURCE_IRQ,
+               },
+       };
+
        return platform_device_register_resndata(&mxc_ahb_bus,
-                       "imx-dma", -1, NULL, 0, NULL, 0);
+                       name, -1, res, ARRAY_SIZE(res), NULL, 0);
 }
 
 struct platform_device __init __maybe_unused *imx_add_imx_sdma(char *name,
similarity index 79%
rename from arch/arm/plat-mxc/devices/platform-imx-fb.c
rename to arch/arm/mach-imx/devices/platform-imx-fb.c
index 2b0b5e0aa9989639286efb65de5adb9ecbcc704c..10b0ed39f07f9ff5cea15ca7fd5359f96506bd34 100644 (file)
@@ -7,11 +7,13 @@
  * Free Software Foundation.
  */
 #include <linux/dma-mapping.h>
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
 
-#define imx_imx_fb_data_entry_single(soc, _size)                       \
+#include "../hardware.h"
+#include "devices-common.h"
+
+#define imx_imx_fb_data_entry_single(soc, _devid, _size)               \
        {                                                               \
+               .devid = _devid,                                        \
                .iobase = soc ## _LCDC_BASE_ADDR,                       \
                .iosize = _size,                                        \
                .irq = soc ## _INT_LCDC,                                \
 
 #ifdef CONFIG_SOC_IMX1
 const struct imx_imx_fb_data imx1_imx_fb_data __initconst =
-       imx_imx_fb_data_entry_single(MX1, SZ_4K);
+       imx_imx_fb_data_entry_single(MX1, "imx1-fb", SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX1 */
 
 #ifdef CONFIG_SOC_IMX21
 const struct imx_imx_fb_data imx21_imx_fb_data __initconst =
-       imx_imx_fb_data_entry_single(MX21, SZ_4K);
+       imx_imx_fb_data_entry_single(MX21, "imx21-fb", SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX21 */
 
 #ifdef CONFIG_SOC_IMX25
 const struct imx_imx_fb_data imx25_imx_fb_data __initconst =
-       imx_imx_fb_data_entry_single(MX25, SZ_16K);
+       imx_imx_fb_data_entry_single(MX25, "imx21-fb", SZ_16K);
 #endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_imx_fb_data imx27_imx_fb_data __initconst =
-       imx_imx_fb_data_entry_single(MX27, SZ_4K);
+       imx_imx_fb_data_entry_single(MX27, "imx21-fb", SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
 struct platform_device *__init imx_add_imx_fb(
similarity index 76%
rename from arch/arm/plat-mxc/devices/platform-imx-i2c.c
rename to arch/arm/mach-imx/devices/platform-imx-i2c.c
index 19ad580c0be348fb16d8bf93e3eb664b6ef1d431..8e30e5703cd204fadda337789bd292a9d14929d5 100644 (file)
@@ -6,34 +6,35 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+#include "../hardware.h"
+#include "devices-common.h"
 
-#define imx_imx_i2c_data_entry_single(soc, _id, _hwid, _size)          \
+#define imx_imx_i2c_data_entry_single(soc, _devid, _id, _hwid, _size)  \
        {                                                               \
+               .devid = _devid,                                        \
                .id = _id,                                              \
                .iobase = soc ## _I2C ## _hwid ## _BASE_ADDR,           \
                .iosize = _size,                                        \
                .irq = soc ## _INT_I2C ## _hwid,                        \
        }
 
-#define imx_imx_i2c_data_entry(soc, _id, _hwid, _size)                 \
-       [_id] = imx_imx_i2c_data_entry_single(soc, _id, _hwid, _size)
+#define imx_imx_i2c_data_entry(soc, _devid, _id, _hwid, _size)         \
+       [_id] = imx_imx_i2c_data_entry_single(soc, _devid, _id, _hwid, _size)
 
 #ifdef CONFIG_SOC_IMX1
 const struct imx_imx_i2c_data imx1_imx_i2c_data __initconst =
-       imx_imx_i2c_data_entry_single(MX1, 0, , SZ_4K);
+       imx_imx_i2c_data_entry_single(MX1, "imx1-i2c", 0, , SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX1 */
 
 #ifdef CONFIG_SOC_IMX21
 const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst =
-       imx_imx_i2c_data_entry_single(MX21, 0, , SZ_4K);
+       imx_imx_i2c_data_entry_single(MX21, "imx21-i2c", 0, , SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX21 */
 
 #ifdef CONFIG_SOC_IMX25
 const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst = {
 #define imx25_imx_i2c_data_entry(_id, _hwid)                           \
-       imx_imx_i2c_data_entry(MX25, _id, _hwid, SZ_16K)
+       imx_imx_i2c_data_entry(MX25, "imx21-i2c", _id, _hwid, SZ_16K)
        imx25_imx_i2c_data_entry(0, 1),
        imx25_imx_i2c_data_entry(1, 2),
        imx25_imx_i2c_data_entry(2, 3),
@@ -43,7 +44,7 @@ const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst = {
 #ifdef CONFIG_SOC_IMX27
 const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst = {
 #define imx27_imx_i2c_data_entry(_id, _hwid)                           \
-       imx_imx_i2c_data_entry(MX27, _id, _hwid, SZ_4K)
+       imx_imx_i2c_data_entry(MX27, "imx21-i2c", _id, _hwid, SZ_4K)
        imx27_imx_i2c_data_entry(0, 1),
        imx27_imx_i2c_data_entry(1, 2),
 };
@@ -52,7 +53,7 @@ const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst = {
 #ifdef CONFIG_SOC_IMX31
 const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst = {
 #define imx31_imx_i2c_data_entry(_id, _hwid)                           \
-       imx_imx_i2c_data_entry(MX31, _id, _hwid, SZ_4K)
+       imx_imx_i2c_data_entry(MX31, "imx21-i2c", _id, _hwid, SZ_4K)
        imx31_imx_i2c_data_entry(0, 1),
        imx31_imx_i2c_data_entry(1, 2),
        imx31_imx_i2c_data_entry(2, 3),
@@ -62,7 +63,7 @@ const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst = {
 #ifdef CONFIG_SOC_IMX35
 const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = {
 #define imx35_imx_i2c_data_entry(_id, _hwid)                           \
-       imx_imx_i2c_data_entry(MX35, _id, _hwid, SZ_4K)
+       imx_imx_i2c_data_entry(MX35, "imx21-i2c", _id, _hwid, SZ_4K)
        imx35_imx_i2c_data_entry(0, 1),
        imx35_imx_i2c_data_entry(1, 2),
        imx35_imx_i2c_data_entry(2, 3),
@@ -72,7 +73,7 @@ const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = {
 #ifdef CONFIG_SOC_IMX50
 const struct imx_imx_i2c_data imx50_imx_i2c_data[] __initconst = {
 #define imx50_imx_i2c_data_entry(_id, _hwid)                           \
-       imx_imx_i2c_data_entry(MX50, _id, _hwid, SZ_4K)
+       imx_imx_i2c_data_entry(MX50, "imx21-i2c", _id, _hwid, SZ_4K)
        imx50_imx_i2c_data_entry(0, 1),
        imx50_imx_i2c_data_entry(1, 2),
        imx50_imx_i2c_data_entry(2, 3),
@@ -82,10 +83,11 @@ const struct imx_imx_i2c_data imx50_imx_i2c_data[] __initconst = {
 #ifdef CONFIG_SOC_IMX51
 const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst = {
 #define imx51_imx_i2c_data_entry(_id, _hwid)                           \
-       imx_imx_i2c_data_entry(MX51, _id, _hwid, SZ_4K)
+       imx_imx_i2c_data_entry(MX51, "imx21-i2c", _id, _hwid, SZ_4K)
        imx51_imx_i2c_data_entry(0, 1),
        imx51_imx_i2c_data_entry(1, 2),
        {
+               .devid = "imx21-i2c",
                .id = 2,
                .iobase = MX51_HSI2C_DMA_BASE_ADDR,
                .iosize = SZ_16K,
@@ -97,7 +99,7 @@ const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst = {
 #ifdef CONFIG_SOC_IMX53
 const struct imx_imx_i2c_data imx53_imx_i2c_data[] __initconst = {
 #define imx53_imx_i2c_data_entry(_id, _hwid)                           \
-       imx_imx_i2c_data_entry(MX53, _id, _hwid, SZ_4K)
+       imx_imx_i2c_data_entry(MX53, "imx21-i2c", _id, _hwid, SZ_4K)
        imx53_imx_i2c_data_entry(0, 1),
        imx53_imx_i2c_data_entry(1, 2),
        imx53_imx_i2c_data_entry(2, 3),
@@ -120,7 +122,7 @@ struct platform_device *__init imx_add_imx_i2c(
                },
        };
 
-       return imx_add_platform_device("imx-i2c", data->id,
+       return imx_add_platform_device(data->devid, data->id,
                        res, ARRAY_SIZE(res),
                        pdata, sizeof(*pdata));
 }
similarity index 97%
rename from arch/arm/plat-mxc/devices/platform-imx-keypad.c
rename to arch/arm/mach-imx/devices/platform-imx-keypad.c
index 479c3e9f771f04be7105551e0286cda2a8dd21c3..8f22a4c98a4ce5957c262e719afb7ab3209f70f0 100644 (file)
@@ -6,8 +6,8 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_imx_keypad_data_entry_single(soc, _size)                   \
        {                                                               \
similarity index 98%
rename from arch/arm/plat-mxc/devices/platform-imx-ssi.c
rename to arch/arm/mach-imx/devices/platform-imx-ssi.c
index 21c6f30e1017403c386f2694aed6aeb81fd33339..bfcb8f3dfa8d712075876e84c3823d8a936aabb5 100644 (file)
@@ -6,8 +6,8 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_imx_ssi_data_entry(soc, _id, _hwid, _size)                 \
        [_id] = {                                                       \
similarity index 98%
rename from arch/arm/plat-mxc/devices/platform-imx-uart.c
rename to arch/arm/mach-imx/devices/platform-imx-uart.c
index d390f00bd29421e2dbe1d39a2f1c6b7392f7c529..67bf866a2cb6642008a78b968943ebf3bd4750f5 100644 (file)
@@ -6,8 +6,8 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_imx_uart_3irq_data_entry(soc, _id, _hwid, _size)           \
        [_id] = {                                                       \
similarity index 97%
rename from arch/arm/plat-mxc/devices/platform-imx2-wdt.c
rename to arch/arm/mach-imx/devices/platform-imx2-wdt.c
index 5e07ef2bf1c42510e59d384a9e0ea6c55f7d72a6..ec75d6413686d7f2004a83b96c16a4683bc630a1 100644 (file)
@@ -7,8 +7,9 @@
  * Free Software Foundation.
  */
 #include <asm/sizes.h>
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_imx2_wdt_data_entry_single(soc, _id, _hwid, _size)         \
        {                                                               \
similarity index 94%
rename from arch/arm/plat-mxc/devices/platform-imx21-hcd.c
rename to arch/arm/mach-imx/devices/platform-imx21-hcd.c
index 5770a42f33bf3d0bea750e4d858adef0db7afbb8..30c81616a9a10acbab642bac56757e1122b1f198 100644 (file)
@@ -6,8 +6,8 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_imx21_hcd_data_entry_single(soc)                           \
        {                                                               \
similarity index 93%
rename from arch/arm/plat-mxc/devices/platform-imx27-coda.c
rename to arch/arm/mach-imx/devices/platform-imx27-coda.c
index 8b12aacdf3965020d06e936c2ee6c11581caee55..25bebc29e5461e156f7c400020074435d6707f05 100644 (file)
@@ -7,8 +7,8 @@
  * Free Software Foundation.
  */
 
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+#include "../hardware.h"
+#include "devices-common.h"
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_imx27_coda_data imx27_coda_data __initconst = {
similarity index 96%
rename from arch/arm/plat-mxc/devices/platform-imx_udc.c
rename to arch/arm/mach-imx/devices/platform-imx_udc.c
index 6fd675dfce14079bbdf97858350607072a607606..5ced7e4e2c71d1df2f89157cf8f720b38e5c4810 100644 (file)
@@ -6,8 +6,8 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_imx_udc_data_entry_single(soc, _size)                      \
        {                                                               \
similarity index 94%
rename from arch/arm/plat-mxc/devices/platform-imxdi_rtc.c
rename to arch/arm/mach-imx/devices/platform-imxdi_rtc.c
index 805336fdc2521cffa82268655f58a2216bb8e647..5bb490d556eaa9dab0d26ba77ba5d77e4aba1d5b 100644 (file)
@@ -7,8 +7,9 @@
  * Free Software Foundation.
  */
 #include <asm/sizes.h>
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_imxdi_rtc_data_entry_single(soc)                           \
        {                                                               \
similarity index 98%
rename from arch/arm/plat-mxc/devices/platform-ipu-core.c
rename to arch/arm/mach-imx/devices/platform-ipu-core.c
index d1e33cc6f12e8cd9e5d332df58a4788ec2c61952..fc4dd7cedc1189019dea590e8a4caa6b0ebf6884 100644 (file)
@@ -7,8 +7,9 @@
  * Free Software Foundation.
  */
 #include <linux/dma-mapping.h>
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_ipu_core_entry_single(soc)                                 \
 {                                                                      \
similarity index 94%
rename from arch/arm/plat-mxc/devices/platform-mx1-camera.c
rename to arch/arm/mach-imx/devices/platform-mx1-camera.c
index edcc581a30a9ea440034df1b122d2bec6aac30e9..2c678813108096ff13218b6cc736522169a1728a 100644 (file)
@@ -6,8 +6,8 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_mx1_camera_data_entry_single(soc, _size)                   \
        {                                                               \
similarity index 83%
rename from arch/arm/plat-mxc/devices/platform-mx2-camera.c
rename to arch/arm/mach-imx/devices/platform-mx2-camera.c
index 11eace953a09e5df8adecc4a4ec283327998cc1c..f4910160346b4fc89e5793a650f6717afcc4b6e3 100644 (file)
@@ -6,17 +6,19 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+#include "../hardware.h"
+#include "devices-common.h"
 
-#define imx_mx2_camera_data_entry_single(soc)                          \
+#define imx_mx2_camera_data_entry_single(soc, _devid)                  \
        {                                                               \
+               .devid = _devid,                                        \
                .iobasecsi = soc ## _CSI_BASE_ADDR,                     \
                .iosizecsi = SZ_4K,                                     \
                .irqcsi = soc ## _INT_CSI,                              \
        }
-#define imx_mx2_camera_data_entry_single_emma(soc)                     \
+#define imx_mx2_camera_data_entry_single_emma(soc, _devid)             \
        {                                                               \
+               .devid = _devid,                                        \
                .iobasecsi = soc ## _CSI_BASE_ADDR,                     \
                .iosizecsi = SZ_32,                                     \
                .irqcsi = soc ## _INT_CSI,                              \
 
 #ifdef CONFIG_SOC_IMX25
 const struct imx_mx2_camera_data imx25_mx2_camera_data __initconst =
-       imx_mx2_camera_data_entry_single(MX25);
+       imx_mx2_camera_data_entry_single(MX25, "imx25-camera");
 #endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst =
-       imx_mx2_camera_data_entry_single_emma(MX27);
+       imx_mx2_camera_data_entry_single_emma(MX27, "imx27-camera");
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
 struct platform_device *__init imx_add_mx2_camera(
@@ -58,7 +60,7 @@ struct platform_device *__init imx_add_mx2_camera(
                        .flags = IORESOURCE_IRQ,
                },
        };
-       return imx_add_platform_device_dmamask("mx2-camera", 0,
+       return imx_add_platform_device_dmamask(data->devid, 0,
                        res, data->iobaseemmaprp ? 4 : 2,
                        pdata, sizeof(*pdata), DMA_BIT_MASK(32));
 }
similarity index 97%
rename from arch/arm/plat-mxc/devices/platform-mxc-ehci.c
rename to arch/arm/mach-imx/devices/platform-mxc-ehci.c
index 35851d889aca2b63bf5e9952359de53b6f429510..5d4bbbfde641360d31815917c2a4c1e88d7fe64d 100644 (file)
@@ -7,8 +7,9 @@
  * Free Software Foundation.
  */
 #include <linux/dma-mapping.h>
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_mxc_ehci_data_entry_single(soc, _id, hs)                   \
        {                                                               \
similarity index 76%
rename from arch/arm/plat-mxc/devices/platform-mxc-mmc.c
rename to arch/arm/mach-imx/devices/platform-mxc-mmc.c
index e7b920b58675d79bab4b1ef598b18e0f05fb14ed..b8203c760c8f5a58c6e4a5b917bd5512b417d7ee 100644 (file)
@@ -7,24 +7,26 @@
  * Free Software Foundation.
  */
 #include <linux/dma-mapping.h>
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
 
-#define imx_mxc_mmc_data_entry_single(soc, _id, _hwid, _size)          \
+#include "../hardware.h"
+#include "devices-common.h"
+
+#define imx_mxc_mmc_data_entry_single(soc, _devid, _id, _hwid, _size)  \
        {                                                               \
+               .devid = _devid,                                        \
                .id = _id,                                              \
                .iobase = soc ## _SDHC ## _hwid ## _BASE_ADDR,          \
                .iosize = _size,                                        \
                .irq = soc ## _INT_SDHC ## _hwid,                       \
                .dmareq = soc ## _DMA_REQ_SDHC ## _hwid,                \
        }
-#define imx_mxc_mmc_data_entry(soc, _id, _hwid, _size)                 \
-       [_id] = imx_mxc_mmc_data_entry_single(soc, _id, _hwid, _size)
+#define imx_mxc_mmc_data_entry(soc, _devid, _id, _hwid, _size)         \
+       [_id] = imx_mxc_mmc_data_entry_single(soc, _devid, _id, _hwid, _size)
 
 #ifdef CONFIG_SOC_IMX21
 const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst = {
 #define imx21_mxc_mmc_data_entry(_id, _hwid)                           \
-       imx_mxc_mmc_data_entry(MX21, _id, _hwid, SZ_4K)
+       imx_mxc_mmc_data_entry(MX21, "imx21-mmc", _id, _hwid, SZ_4K)
        imx21_mxc_mmc_data_entry(0, 1),
        imx21_mxc_mmc_data_entry(1, 2),
 };
@@ -33,7 +35,7 @@ const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst = {
 #ifdef CONFIG_SOC_IMX27
 const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst = {
 #define imx27_mxc_mmc_data_entry(_id, _hwid)                           \
-       imx_mxc_mmc_data_entry(MX27, _id, _hwid, SZ_4K)
+       imx_mxc_mmc_data_entry(MX27, "imx21-mmc", _id, _hwid, SZ_4K)
        imx27_mxc_mmc_data_entry(0, 1),
        imx27_mxc_mmc_data_entry(1, 2),
 };
@@ -42,7 +44,7 @@ const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst = {
 #ifdef CONFIG_SOC_IMX31
 const struct imx_mxc_mmc_data imx31_mxc_mmc_data[] __initconst = {
 #define imx31_mxc_mmc_data_entry(_id, _hwid)                           \
-       imx_mxc_mmc_data_entry(MX31, _id, _hwid, SZ_16K)
+       imx_mxc_mmc_data_entry(MX31, "imx31-mmc", _id, _hwid, SZ_16K)
        imx31_mxc_mmc_data_entry(0, 1),
        imx31_mxc_mmc_data_entry(1, 2),
 };
@@ -67,7 +69,7 @@ struct platform_device *__init imx_add_mxc_mmc(
                        .flags = IORESOURCE_DMA,
                },
        };
-       return imx_add_platform_device_dmamask("mxc-mmc", data->id,
+       return imx_add_platform_device_dmamask(data->devid, data->id,
                        res, ARRAY_SIZE(res),
                        pdata, sizeof(*pdata), DMA_BIT_MASK(32));
 }
similarity index 74%
rename from arch/arm/plat-mxc/devices/platform-mxc_nand.c
rename to arch/arm/mach-imx/devices/platform-mxc_nand.c
index 95b75cc70515efa8ffc0465cc44585b99ff70ede..7af1c53e42b50c669ad090ad1a513a748a530f38 100644 (file)
@@ -7,18 +7,21 @@
  * Free Software Foundation.
  */
 #include <asm/sizes.h>
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
 
-#define imx_mxc_nand_data_entry_single(soc, _size)                     \
+#include "../hardware.h"
+#include "devices-common.h"
+
+#define imx_mxc_nand_data_entry_single(soc, _devid, _size)             \
        {                                                               \
+               .devid = _devid,                                        \
                .iobase = soc ## _NFC_BASE_ADDR,                        \
                .iosize = _size,                                        \
                .irq = soc ## _INT_NFC                                  \
        }
 
-#define imx_mxc_nandv3_data_entry_single(soc, _size)                   \
+#define imx_mxc_nandv3_data_entry_single(soc, _devid, _size)           \
        {                                                               \
+               .devid = _devid,                                        \
                .id = -1,                                               \
                .iobase = soc ## _NFC_BASE_ADDR,                        \
                .iosize = _size,                                        \
 
 #ifdef CONFIG_SOC_IMX21
 const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst =
-       imx_mxc_nand_data_entry_single(MX21, SZ_4K);
+       imx_mxc_nand_data_entry_single(MX21, "imx21-nand", SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX21 */
 
 #ifdef CONFIG_SOC_IMX25
 const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst =
-       imx_mxc_nand_data_entry_single(MX25, SZ_8K);
+       imx_mxc_nand_data_entry_single(MX25, "imx25-nand", SZ_8K);
 #endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst =
-       imx_mxc_nand_data_entry_single(MX27, SZ_4K);
+       imx_mxc_nand_data_entry_single(MX27, "imx27-nand", SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
 #ifdef CONFIG_SOC_IMX31
 const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst =
-       imx_mxc_nand_data_entry_single(MX31, SZ_4K);
+       imx_mxc_nand_data_entry_single(MX31, "imx27-nand", SZ_4K);
 #endif
 
 #ifdef CONFIG_SOC_IMX35
 const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
-       imx_mxc_nand_data_entry_single(MX35, SZ_8K);
+       imx_mxc_nand_data_entry_single(MX35, "imx25-nand", SZ_8K);
 #endif
 
 #ifdef CONFIG_SOC_IMX51
 const struct imx_mxc_nand_data imx51_mxc_nand_data __initconst =
-       imx_mxc_nandv3_data_entry_single(MX51, SZ_16K);
+       imx_mxc_nandv3_data_entry_single(MX51, "imx51-nand", SZ_16K);
 #endif
 
 struct platform_device *__init imx_add_mxc_nand(
@@ -76,7 +79,7 @@ struct platform_device *__init imx_add_mxc_nand(
                        .flags = IORESOURCE_MEM,
                },
        };
-       return imx_add_platform_device("mxc_nand", data->id,
+       return imx_add_platform_device(data->devid, data->id,
                        res, ARRAY_SIZE(res) - !data->axibase,
                        pdata, sizeof(*pdata));
 }
similarity index 97%
rename from arch/arm/plat-mxc/devices/platform-mxc_pwm.c
rename to arch/arm/mach-imx/devices/platform-mxc_pwm.c
index b0c4ae298111feefe47dc6d4701e0b73823c5af1..dcd289777687303ea6547431e953c173b1e4fec7 100644 (file)
@@ -6,8 +6,8 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_mxc_pwm_data_entry_single(soc, _id, _hwid, _size)          \
        {                                                               \
similarity index 95%
rename from arch/arm/plat-mxc/devices/platform-mxc_rnga.c
rename to arch/arm/mach-imx/devices/platform-mxc_rnga.c
index b4b7612b6e172c2dad8fccc81ab06f2585a73403..c58404badb592080d6ff3702200c6bebb97cdc0f 100644 (file)
@@ -6,8 +6,8 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+#include "../hardware.h"
+#include "devices-common.h"
 
 struct imx_mxc_rnga_data {
        resource_size_t iobase;
similarity index 77%
rename from arch/arm/plat-mxc/devices/platform-mxc_rtc.c
rename to arch/arm/mach-imx/devices/platform-mxc_rtc.c
index a5c9ad5721c2a1374815cc737ede4c3436dfdba5..c7fffaadf847f75a9483464cb214fa47d8d4dd7e 100644 (file)
@@ -6,23 +6,24 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+#include "../hardware.h"
+#include "devices-common.h"
 
-#define imx_mxc_rtc_data_entry_single(soc)                             \
+#define imx_mxc_rtc_data_entry_single(soc, _devid)                     \
        {                                                               \
+               .devid = _devid,                                        \
                .iobase = soc ## _RTC_BASE_ADDR,                        \
                .irq = soc ## _INT_RTC,                                 \
        }
 
 #ifdef CONFIG_SOC_IMX31
 const struct imx_mxc_rtc_data imx31_mxc_rtc_data __initconst =
-       imx_mxc_rtc_data_entry_single(MX31);
+       imx_mxc_rtc_data_entry_single(MX31, "imx21-rtc");
 #endif /* ifdef CONFIG_SOC_IMX31 */
 
 #ifdef CONFIG_SOC_IMX35
 const struct imx_mxc_rtc_data imx35_mxc_rtc_data __initconst =
-       imx_mxc_rtc_data_entry_single(MX35);
+       imx_mxc_rtc_data_entry_single(MX35, "imx21-rtc");
 #endif /* ifdef CONFIG_SOC_IMX35 */
 
 struct platform_device *__init imx_add_mxc_rtc(
@@ -40,6 +41,6 @@ struct platform_device *__init imx_add_mxc_rtc(
                },
        };
 
-       return imx_add_platform_device("mxc_rtc", -1,
+       return imx_add_platform_device(data->devid, -1,
                        res, ARRAY_SIZE(res), NULL, 0);
 }
similarity index 95%
rename from arch/arm/plat-mxc/devices/platform-mxc_w1.c
rename to arch/arm/mach-imx/devices/platform-mxc_w1.c
index 96fa5ea91fe8e701eb7192f7ee0e3c4653bdee28..88c18b720d63722a8d4732fe35aa6a60ba63a905 100644 (file)
@@ -6,8 +6,8 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_mxc_w1_data_entry_single(soc)                              \
        {                                                               \
similarity index 96%
rename from arch/arm/plat-mxc/devices/platform-pata_imx.c
rename to arch/arm/mach-imx/devices/platform-pata_imx.c
index 70e2f2a4471440bc200a63135db831775722ef39..e4ec11c8ce5546e681f80d22900bc733249ded83 100644 (file)
@@ -3,8 +3,8 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_pata_imx_data_entry_single(soc, _size)                     \
        {                                                               \
similarity index 98%
rename from arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c
rename to arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c
index 3793e475cd954c5c7a39011998a9b3d333ce8a37..e66a4e316311e613e2b67d3738a8ebd21e2618b5 100644 (file)
@@ -6,10 +6,11 @@
  * Free Software Foundation.
  */
 
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
 #include <linux/platform_data/mmc-esdhc-imx.h>
 
+#include "../hardware.h"
+#include "devices-common.h"
+
 #define imx_sdhci_esdhc_imx_data_entry_single(soc, _devid, _id, hwid) \
        {                                                               \
                .devid = _devid,                                        \
similarity index 98%
rename from arch/arm/plat-mxc/devices/platform-spi_imx.c
rename to arch/arm/mach-imx/devices/platform-spi_imx.c
index 9c50c14c8f927fbf8e28018f817128e41a70018c..8880bcb11e055329eb4fbab033d13df2ad8b6d77 100644 (file)
@@ -6,8 +6,8 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+#include "../hardware.h"
+#include "devices-common.h"
 
 #define imx_spi_imx_data_entry_single(soc, type, _devid, _id, hwid, _size) \
        {                                                               \
index 412c583a24b01a7e35fc976572cdafc50e08e13e..27e40d17de9940dfa6631bd1680e4233f962205a 100644 (file)
 
 #include <linux/platform_device.h>
 #include <linux/io.h>
-
-#include <mach/hardware.h>
 #include <linux/platform_data/usb-ehci-mxc.h>
 
+#include "hardware.h"
+
 #define USBCTRL_OTGBASE_OFFSET 0x600
 
 #define MX25_OTG_SIC_SHIFT     29
index cd6e1f81508d2351152094f9c7d24a95fce4a848..448d9115539d391b7aa8f495a386e38d2f4e5066 100644 (file)
 
 #include <linux/platform_device.h>
 #include <linux/io.h>
-
-#include <mach/hardware.h>
 #include <linux/platform_data/usb-ehci-mxc.h>
 
+#include "hardware.h"
+
 #define USBCTRL_OTGBASE_OFFSET 0x600
 
 #define MX27_OTG_SIC_SHIFT     29
index 9a880c78af34081bdca578f8da106d86770054bf..05de4e1e39d7d74807bece3218b8e97402fbd5f6 100644 (file)
 
 #include <linux/platform_device.h>
 #include <linux/io.h>
-
-#include <mach/hardware.h>
 #include <linux/platform_data/usb-ehci-mxc.h>
 
+#include "hardware.h"
+
 #define USBCTRL_OTGBASE_OFFSET 0x600
 
 #define MX31_OTG_SIC_SHIFT     29
index 779e16eb65cb49aeaa58af79b19aac4e08b9bb47..a596f709a9372a6e729592f7cc401f19034cc441 100644 (file)
 
 #include <linux/platform_device.h>
 #include <linux/io.h>
-
-#include <mach/hardware.h>
 #include <linux/platform_data/usb-ehci-mxc.h>
 
+#include "hardware.h"
+
 #define USBCTRL_OTGBASE_OFFSET 0x600
 
 #define MX35_OTG_SIC_SHIFT     29
index cf8d00e5cce13a778af20eded054b75aa9427c09..e49710b10c68a2791026bcf97edd8b7128d071bc 100644 (file)
 
 #include <linux/platform_device.h>
 #include <linux/io.h>
-
-#include <mach/hardware.h>
 #include <linux/platform_data/usb-ehci-mxc.h>
 
+#include "hardware.h"
+
 #define MXC_OTG_OFFSET                 0
 #define MXC_H1_OFFSET                  0x200
 #define MXC_H2_OFFSET                  0x400
similarity index 99%
rename from arch/arm/plat-mxc/epit.c
rename to arch/arm/mach-imx/epit.c
index 88726f4dbbfa60b774e942176056c39f0b31fc66..04a5961beeac70c5567e0aa7f921a077f61df37b 100644 (file)
 #include <linux/clockchips.h>
 #include <linux/clk.h>
 #include <linux/err.h>
-
-#include <mach/hardware.h>
 #include <asm/mach/time.h>
-#include <mach/common.h>
+
+#include "common.h"
+#include "hardware.h"
 
 static struct clock_event_device clockevent_epit;
 static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED;
index 98aef571b9f839de8111cb8cb19e3dfe595b5adb..b4c70028d35991458ebf3afe4ea39d95784eac58 100644 (file)
 
 #include <asm/mach/arch.h>
 
-#include <mach/common.h>
-#include <mach/iomux-mx27.h>
-#include <mach/hardware.h>
-
+#include "common.h"
 #include "devices-imx27.h"
+#include "hardware.h"
+#include "iomux-mx27.h"
 
 static const int eukrea_mbimx27_pins[] __initconst = {
        /* UART2 */
index 0b84666792f05f7192954b3a57b2256d7e341031..e2b70f4c1a2c314a05b75a613e683b66c438754e 100644 (file)
 #include <linux/spi/spi.h>
 #include <video/platform_lcd.h>
 
-#include <mach/hardware.h>
-#include <mach/iomux-mx25.h>
-#include <mach/common.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
-#include <mach/mx25.h>
 
+#include "common.h"
 #include "devices-imx25.h"
+#include "hardware.h"
+#include "iomux-mx25.h"
+#include "mx25.h"
 
 static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {
        /* LCD */
index c6532a007d468ae68658c213d3656ee483cc2dfd..5a2d5ef12dd5141cb7c42e1df951857534dc4e76 100644 (file)
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/iomux-mx35.h>
-
+#include "common.h"
 #include "devices-imx35.h"
+#include "hardware.h"
+#include "iomux-mx35.h"
 
 static const struct fb_videomode fb_modedb[] = {
        {
index 8b0de30d7a3f3d2dba60032367b4b548657804b4..9be6c1e69d687d72fb764559acec849c83fa5a39 100644 (file)
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/iomux-mx51.h>
-
+#include "common.h"
 #include "devices-imx51.h"
+#include "hardware.h"
+#include "iomux-mx51.h"
 
 static iomux_v3_cfg_t eukrea_mbimxsd51_pads[] = {
        /* LED */
similarity index 94%
rename from arch/arm/plat-mxc/include/mach/hardware.h
rename to arch/arm/mach-imx/hardware.h
index ebf10654bb42ae477cfdeede23eedbcbc308c395..3ce7fa3bd43fbcefa6561c6a555e5e9b3254a7d1 100644 (file)
 
 #define IMX_IO_ADDRESS(x)      IOMEM(IMX_IO_P2V(x))
 
-#include <mach/mxc.h>
+#include "mxc.h"
 
-#include <mach/mx6q.h>
-#include <mach/mx50.h>
-#include <mach/mx51.h>
-#include <mach/mx53.h>
-#include <mach/mx3x.h>
-#include <mach/mx31.h>
-#include <mach/mx35.h>
-#include <mach/mx2x.h>
-#include <mach/mx21.h>
-#include <mach/mx27.h>
-#include <mach/mx1.h>
-#include <mach/mx25.h>
+#include "mx6q.h"
+#include "mx50.h"
+#include "mx51.h"
+#include "mx53.h"
+#include "mx3x.h"
+#include "mx31.h"
+#include "mx35.h"
+#include "mx2x.h"
+#include "mx21.h"
+#include "mx27.h"
+#include "mx1.h"
+#include "mx25.h"
 
 #define imx_map_entry(soc, name, _type)        {                               \
        .virtual = soc ## _IO_P2V(soc ## _ ## name ## _BASE_ADDR),      \
index b07b778dc9a80c7e06a8b462d8b110f744623020..3dec962b0770aa9f088829da920c76a44a9d4113 100644 (file)
@@ -13,7 +13,8 @@
 #include <linux/errno.h>
 #include <asm/cacheflush.h>
 #include <asm/cp15.h>
-#include <mach/common.h>
+
+#include "common.h"
 
 static inline void cpu_enter_lowpower(void)
 {
diff --git a/arch/arm/mach-imx/imx25-dt.c b/arch/arm/mach-imx/imx25-dt.c
new file mode 100644 (file)
index 0000000..e17dfbc
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2012 Sascha Hauer, 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
+ */
+
+#include <linux/irq.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/time.h>
+#include "common.h"
+#include "mx25.h"
+
+static void __init imx25_dt_init(void)
+{
+       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static void __init imx25_timer_init(void)
+{
+       mx25_clocks_init_dt();
+}
+
+static struct sys_timer imx25_timer = {
+       .init = imx25_timer_init,
+};
+
+static const char * const imx25_dt_board_compat[] __initconst = {
+       "fsl,imx25",
+       NULL
+};
+
+DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)")
+       .map_io         = mx25_map_io,
+       .init_early     = imx25_init_early,
+       .init_irq       = mx25_init_irq,
+       .handle_irq     = imx25_handle_irq,
+       .timer          = &imx25_timer,
+       .init_machine   = imx25_dt_init,
+       .dt_compat      = imx25_dt_board_compat,
+       .restart        = mxc_restart,
+MACHINE_END
index e80d5235dac0201346aeac09ab9045608bfbe9b5..ebfae96543c47d2ef50c1e4653d9ec6f0dd3fee4 100644 (file)
 #include <linux/of_platform.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
-#include <mach/common.h>
-#include <mach/mx27.h>
+
+#include "common.h"
+#include "mx27.h"
 
 static const struct of_dev_auxdata imx27_auxdata_lookup[] __initconst = {
        OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART1_BASE_ADDR, "imx21-uart.0", NULL),
        OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART2_BASE_ADDR, "imx21-uart.1", NULL),
        OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART3_BASE_ADDR, "imx21-uart.2", NULL),
        OF_DEV_AUXDATA("fsl,imx27-fec", MX27_FEC_BASE_ADDR, "imx27-fec.0", NULL),
-       OF_DEV_AUXDATA("fsl,imx27-i2c", MX27_I2C1_BASE_ADDR, "imx-i2c.0", NULL),
-       OF_DEV_AUXDATA("fsl,imx27-i2c", MX27_I2C2_BASE_ADDR, "imx-i2c.1", NULL),
+       OF_DEV_AUXDATA("fsl,imx27-i2c", MX27_I2C1_BASE_ADDR, "imx21-i2c.0", NULL),
+       OF_DEV_AUXDATA("fsl,imx27-i2c", MX27_I2C2_BASE_ADDR, "imx21-i2c.1", NULL),
        OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI1_BASE_ADDR, "imx27-cspi.0", NULL),
        OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI2_BASE_ADDR, "imx27-cspi.1", NULL),
        OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI3_BASE_ADDR, "imx27-cspi.2", NULL),
        OF_DEV_AUXDATA("fsl,imx27-wdt", MX27_WDOG_BASE_ADDR, "imx2-wdt.0", NULL),
-       OF_DEV_AUXDATA("fsl,imx27-nand", MX27_NFC_BASE_ADDR, "mxc_nand.0", NULL),
+       OF_DEV_AUXDATA("fsl,imx27-nand", MX27_NFC_BASE_ADDR, "imx27-nand.0", NULL),
        { /* sentinel */ }
 };
 
index a68ba207b2b790ce3d0bce0f41a134349647a6af..af476de2570e8727c1c4e9fe0ac0a77397da7985 100644 (file)
@@ -14,8 +14,9 @@
 #include <linux/of_platform.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
-#include <mach/common.h>
-#include <mach/mx31.h>
+
+#include "common.h"
+#include "mx31.h"
 
 static const struct of_dev_auxdata imx31_auxdata_lookup[] __initconst = {
        OF_DEV_AUXDATA("fsl,imx31-uart", MX31_UART1_BASE_ADDR,
index f233b4bb2342ded80353a25a8ad253b60fd7620d..50742990a136f07a02f0e2f99d4debdc9257f5ae 100644 (file)
@@ -15,8 +15,9 @@
 #include <linux/of_platform.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
-#include <mach/common.h>
-#include <mach/mx51.h>
+
+#include "common.h"
+#include "mx51.h"
 
 /*
  * Lookup table for attaching a specific name and platform_data pointer to
@@ -36,8 +37,8 @@ static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = {
        OF_DEV_AUXDATA("fsl,imx51-ecspi", MX51_ECSPI1_BASE_ADDR, "imx51-ecspi.0", NULL),
        OF_DEV_AUXDATA("fsl,imx51-ecspi", MX51_ECSPI2_BASE_ADDR, "imx51-ecspi.1", NULL),
        OF_DEV_AUXDATA("fsl,imx51-cspi", MX51_CSPI_BASE_ADDR, "imx35-cspi.0", NULL),
-       OF_DEV_AUXDATA("fsl,imx51-i2c", MX51_I2C1_BASE_ADDR, "imx-i2c.0", NULL),
-       OF_DEV_AUXDATA("fsl,imx51-i2c", MX51_I2C2_BASE_ADDR, "imx-i2c.1", NULL),
+       OF_DEV_AUXDATA("fsl,imx51-i2c", MX51_I2C1_BASE_ADDR, "imx21-i2c.0", NULL),
+       OF_DEV_AUXDATA("fsl,imx51-i2c", MX51_I2C2_BASE_ADDR, "imx21-i2c.1", NULL),
        OF_DEV_AUXDATA("fsl,imx51-sdma", MX51_SDMA_BASE_ADDR, "imx35-sdma", NULL),
        OF_DEV_AUXDATA("fsl,imx51-wdt", MX51_WDOG1_BASE_ADDR, "imx2-wdt.0", NULL),
        { /* sentinel */ }
diff --git a/arch/arm/mach-imx/include/mach/dma-mx1-mx2.h b/arch/arm/mach-imx/include/mach/dma-mx1-mx2.h
deleted file mode 100644 (file)
index df5f522..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __MACH_DMA_MX1_MX2_H__
-#define __MACH_DMA_MX1_MX2_H__
-/*
- * Don't use this header in new code, it will go away when all users are
- * converted to mach/dma-v1.h
- */
-
-#include <mach/dma-v1.h>
-
-#endif /* ifndef __MACH_DMA_MX1_MX2_H__ */
index 82bd4403b450a915ac2a8b83a627ddf00642a6fa..cabefbc5e7c16cbcaa7493e2e56373071335de30 100644 (file)
@@ -22,8 +22,9 @@
 #include <linux/spinlock.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
-#include <mach/hardware.h>
-#include <mach/iomux-mx3.h>
+
+#include "hardware.h"
+#include "iomux-mx3.h"
 
 /*
  * IOMUX register (base) addresses
similarity index 99%
rename from arch/arm/plat-mxc/include/mach/iomux-mx1.h
rename to arch/arm/mach-imx/iomux-mx1.h
index 6b1507cf378e1bb1cede03777d47b45e26d21e12..95f4681d85d7a1a9e57126f01dff0cf14a16b501 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef __MACH_IOMUX_MX1_H__
 #define __MACH_IOMUX_MX1_H__
 
-#include <mach/iomux-v1.h>
+#include "iomux-v1.h"
 
 #define PA0_AIN_SPI2_CLK       (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 0)
 #define PA0_AF_ETMTRACESYNC    (GPIO_PORTA | GPIO_AF | 0)
similarity index 99%
rename from arch/arm/plat-mxc/include/mach/iomux-mx21.h
rename to arch/arm/mach-imx/iomux-mx21.h
index 1495dfda7834c8e0d0a7dc5fce1e2650b2913cb1..a70cffceb085eebcd789fb8a2ce744a293713e3a 100644 (file)
@@ -18,8 +18,8 @@
 #ifndef __MACH_IOMUX_MX21_H__
 #define __MACH_IOMUX_MX21_H__
 
-#include <mach/iomux-mx2x.h>
-#include <mach/iomux-v1.h>
+#include "iomux-mx2x.h"
+#include "iomux-v1.h"
 
 /* Primary GPIO pin functions */
 
similarity index 99%
rename from arch/arm/plat-mxc/include/mach/iomux-mx25.h
rename to arch/arm/mach-imx/iomux-mx25.h
index c61ec0fc10d47899c1ffc8dfb361fa1de73f273a..be51e838375cf84a0b6dbe5104fc556419b36eb2 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef __MACH_IOMUX_MX25_H__
 #define __MACH_IOMUX_MX25_H__
 
-#include <mach/iomux-v3.h>
+#include "iomux-v3.h"
 
 /*
  * IOMUX/PAD Bit field definitions
similarity index 99%
rename from arch/arm/plat-mxc/include/mach/iomux-mx27.h
rename to arch/arm/mach-imx/iomux-mx27.h
index d9f9a6e32d80c809bf901ccfaef7f3acf168c692..218e99e89e86e62c0318f10def97c2413959b92d 100644 (file)
@@ -19,8 +19,8 @@
 #ifndef __MACH_IOMUX_MX27_H__
 #define __MACH_IOMUX_MX27_H__
 
-#include <mach/iomux-mx2x.h>
-#include <mach/iomux-v1.h>
+#include "iomux-mx2x.h"
+#include "iomux-v1.h"
 
 /* Primary GPIO pin functions */
 
similarity index 99%
rename from arch/arm/plat-mxc/include/mach/iomux-mx35.h
rename to arch/arm/mach-imx/iomux-mx35.h
index 3117c18bbbd9dcabb88408f51453df3cef85235f..90bfa6b5be6a41ec01c07e7934134501ba4cd690 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef __MACH_IOMUX_MX35_H__
 #define __MACH_IOMUX_MX35_H__
 
-#include <mach/iomux-v3.h>
+#include "iomux-v3.h"
 
 /*
  * The naming convention for the pad modes is MX35_PAD_<padname>__<padmode>
similarity index 99%
rename from arch/arm/plat-mxc/include/mach/iomux-mx50.h
rename to arch/arm/mach-imx/iomux-mx50.h
index 98e7fd0b90830d27414515cc0cb1d8c99afd4fb1..00f56e0e8009ce1529ff8dc865d4165ede8b91bb 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef __MACH_IOMUX_MX50_H__
 #define __MACH_IOMUX_MX50_H__
 
-#include <mach/iomux-v3.h>
+#include "iomux-v3.h"
 
 #define MX50_ELCDIF_PAD_CTRL   (PAD_CTL_PKE | PAD_CTL_DSE_HIGH)
 
similarity index 99%
rename from arch/arm/plat-mxc/include/mach/iomux-mx51.h
rename to arch/arm/mach-imx/iomux-mx51.h
index 2623e7a2e1907368d9d8e7926122199d9892c89c..75bbcc4aa2d27a1181e63c119603302fd2f6a91a 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef __MACH_IOMUX_MX51_H__
 #define __MACH_IOMUX_MX51_H__
 
-#include <mach/iomux-v3.h>
+#include "iomux-v3.h"
 #define __NA_  0x000
 
 
similarity index 98%
rename from arch/arm/plat-mxc/iomux-v1.c
rename to arch/arm/mach-imx/iomux-v1.c
index 1f73963bc13e916e895433ffd5e5d7687e9e333d..2b156d1d9e216bf2d6b7a5c38064f8c79efb26e5 100644 (file)
 #include <linux/string.h>
 #include <linux/gpio.h>
 
-#include <mach/hardware.h>
 #include <asm/mach/map.h>
-#include <mach/iomux-v1.h>
+
+#include "hardware.h"
+#include "iomux-v1.h"
 
 static void __iomem *imx_iomuxv1_baseaddr;
 static unsigned imx_iomuxv1_numports;
similarity index 97%
rename from arch/arm/plat-mxc/iomux-v3.c
rename to arch/arm/mach-imx/iomux-v3.c
index 99a9cdb9d6be57b5a0de933865cbaa319435ffdf..9dae74bf47fcb5d96ad2c900a1fe9fead266bf2d 100644 (file)
 #include <linux/string.h>
 #include <linux/gpio.h>
 
-#include <mach/hardware.h>
 #include <asm/mach/map.h>
-#include <mach/iomux-v3.h>
+
+#include "hardware.h"
+#include "iomux-v3.h"
 
 static void __iomem *base;
 
similarity index 98%
rename from arch/arm/plat-mxc/iram_alloc.c
rename to arch/arm/mach-imx/iram_alloc.c
index 074c3869626aeaa2cf01d1967d0ba1288897a5f9..6c80424f678e3fad821aa8ea60685485db5ddb6e 100644 (file)
@@ -22,7 +22,8 @@
 #include <linux/module.h>
 #include <linux/spinlock.h>
 #include <linux/genalloc.h>
-#include <mach/iram.h>
+
+#include "iram.h"
 
 static unsigned long iram_phys_base;
 static void __iomem *iram_virt_base;
similarity index 94%
rename from arch/arm/plat-mxc/irq-common.h
rename to arch/arm/mach-imx/irq-common.h
index 6ccb3a14c693943b37d1aac199e2bf9de589535f..5b2dabba330fd7ad69c534aa3714bc821d77342a 100644 (file)
@@ -19,6 +19,9 @@
 #ifndef __PLAT_MXC_IRQ_COMMON_H__
 #define __PLAT_MXC_IRQ_COMMON_H__
 
+/* all normal IRQs can be FIQs */
+#define FIQ_START      0
+
 struct mxc_extra_irq
 {
        int (*set_priority)(unsigned char irq, unsigned char prio);
index c40a34c0048910c974789695b0ecb13374d3cb94..5f1510363ee76f469358be2c86a664eed70f9308 100644 (file)
@@ -14,7 +14,8 @@
 #include <asm/page.h>
 #include <asm/sizes.h>
 #include <asm/mach/map.h>
-#include <mach/hardware.h>
+
+#include "hardware.h"
 
 static struct map_desc imx_lluart_desc = {
 #ifdef CONFIG_DEBUG_IMX6Q_UART2
index 7b99a79722b6fbe638829ad8946877f11eb5c353..5c9bd2c66e6d595c51677259cd2ecf411bee7946 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-mx1.h>
-
+#include "common.h"
 #include "devices-imx1.h"
+#include "hardware.h"
+#include "iomux-mx1.h"
 
 static const int apf9328_pins[] __initconst = {
        /* UART1 */
index 5985ed1b8c9875cffc99ab74233147912ae01eca..59bd6b06a6b5f1d549b87d4fb8a71e6ded3fe074 100644 (file)
 #include <linux/regulator/machine.h>
 #include <linux/regulator/fixed.h>
 
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/memory.h>
 #include <asm/mach/map.h>
 
-#include <mach/common.h>
-#include <mach/iomux-mx3.h>
-#include <mach/ulpi.h>
-
+#include "common.h"
 #include "devices-imx31.h"
 #include "crmregs-imx3.h"
+#include "hardware.h"
+#include "iomux-mx3.h"
+#include "ulpi.h"
 
 static int armadillo5x0_pins[] = {
        /* UART1 */
index 9a9897749dd61b5b06b7a5d2037a72044acbc76f..3a39d5aec07a7cffbec8adf8a940ee20ccb9e7d4 100644 (file)
 #include <linux/init.h>
 #include <linux/platform_device.h>
 
-#include <mach/iomux-mx3.h>
-#include <mach/hardware.h>
-#include <mach/common.h>
-
 #include <asm/mach/time.h>
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
 
+#include "common.h"
 #include "devices-imx31.h"
+#include "hardware.h"
+#include "iomux-mx3.h"
 
 static const struct imxuart_platform_data uart_pdata __initconst = {
        .flags = IMXUART_HAVE_RTSCTS,
index 2bb9e18d9ee134a078c664c966c2de6d2d4342f5..12a370646b450e5b313ad73b70d79d4b3fcf1c0b 100644 (file)
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
 
-#include <mach/eukrea-baseboards.h>
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-mx27.h>
-#include <mach/ulpi.h>
-
+#include "common.h"
 #include "devices-imx27.h"
+#include "eukrea-baseboards.h"
+#include "hardware.h"
+#include "iomux-mx27.h"
+#include "ulpi.h"
 
 static const int eukrea_cpuimx27_pins[] __initconst = {
        /* UART1 */
index d49b0ec6bdec839953f15775a03adb5546c17b6a..5a31bf8c8f4c528b1275d99b727be937917b8491 100644 (file)
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
 
-#include <mach/eukrea-baseboards.h>
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/iomux-mx35.h>
-
+#include "common.h"
 #include "devices-imx35.h"
+#include "eukrea-baseboards.h"
+#include "hardware.h"
+#include "iomux-mx35.h"
 
 static const struct imxuart_platform_data uart_pdata __initconst = {
        .flags = IMXUART_HAVE_RTSCTS,
index b87cc49ab1e8ec67e6504f54335115de95c3223d..b727de029c8f3dfc4a99fd1e68333086c06c9737 100644 (file)
 #include <linux/spi/spi.h>
 #include <linux/can/platform/mcp251x.h>
 
-#include <mach/eukrea-baseboards.h>
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-mx51.h>
-
 #include <asm/setup.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 
+#include "common.h"
 #include "devices-imx51.h"
 #include "cpu_op-mx51.h"
+#include "eukrea-baseboards.h"
+#include "hardware.h"
+#include "iomux-mx51.h"
 
 #define USBH1_RST              IMX_GPIO_NR(2, 28)
 #define ETH_RST                        IMX_GPIO_NR(2, 31)
index 017bbb70ea415b3b75c050dbf0952aa46374680c..75027a5ad8b75c2dbc8afd98a413dd855a59cca4 100644 (file)
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
 
-#include <mach/eukrea-baseboards.h>
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/memory.h>
 #include <asm/mach/map.h>
-#include <mach/common.h>
-#include <mach/mx25.h>
-#include <mach/iomux-mx25.h>
 
+#include "common.h"
 #include "devices-imx25.h"
+#include "eukrea-baseboards.h"
+#include "hardware.h"
+#include "iomux-mx25.h"
+#include "mx25.h"
 
 static const struct imxuart_platform_data uart_pdata __initconst = {
        .flags = IMXUART_HAVE_RTSCTS,
index 141756f00ae5c8733795855bd31b994c8609a496..b74422679126fb7156087d0c2eedc0cfe94fd856 100644 (file)
 #include <asm/mach/time.h>
 #include <asm/system_info.h>
 #include <asm/memblock.h>
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-mx27.h>
 
+#include "common.h"
 #include "devices-imx27.h"
+#include "hardware.h"
+#include "iomux-mx27.h"
 
 #define TVP5150_RSTN (GPIO_PORTC + 18)
 #define TVP5150_PWDN (GPIO_PORTC + 19)
index 7381387a890558909ae69b3fd2fbeb621118e61c..53a8601129385d85c9314169ffa913e37ef69ba8 100644 (file)
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/iomux-mx27.h>
 
+#include "hardware.h"
+#include "common.h"
 #include "devices-imx27.h"
+#include "iomux-mx27.h"
 
 static const int mx27ipcam_pins[] __initconst = {
        /* UART1 */
index 1f45b9189229787343ca9465b4c2d3d0425c6758..fc8dce93137888bbd22d508833cad4ea78888b87 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/iomux-mx27.h>
 
+#include "common.h"
 #include "devices-imx27.h"
+#include "hardware.h"
+#include "iomux-mx27.h"
 
 static const int mx27lite_pins[] __initconst = {
        /* UART1 */
index 29711e95579f7cb5a28bf9e29f359b14f78a7133..e71e62610eba239bef4d34ed4ff38df570cc30c2 100644 (file)
@@ -19,8 +19,9 @@
 #include <linux/of_platform.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
-#include <mach/common.h>
-#include <mach/mx53.h>
+
+#include "common.h"
+#include "mx53.h"
 
 /*
  * Lookup table for attaching a specific name and platform_data pointer to
@@ -42,9 +43,9 @@ static const struct of_dev_auxdata imx53_auxdata_lookup[] __initconst = {
        OF_DEV_AUXDATA("fsl,imx53-ecspi", MX53_ECSPI1_BASE_ADDR, "imx51-ecspi.0", NULL),
        OF_DEV_AUXDATA("fsl,imx53-ecspi", MX53_ECSPI2_BASE_ADDR, "imx51-ecspi.1", NULL),
        OF_DEV_AUXDATA("fsl,imx53-cspi", MX53_CSPI_BASE_ADDR, "imx35-cspi.0", NULL),
-       OF_DEV_AUXDATA("fsl,imx53-i2c", MX53_I2C1_BASE_ADDR, "imx-i2c.0", NULL),
-       OF_DEV_AUXDATA("fsl,imx53-i2c", MX53_I2C2_BASE_ADDR, "imx-i2c.1", NULL),
-       OF_DEV_AUXDATA("fsl,imx53-i2c", MX53_I2C3_BASE_ADDR, "imx-i2c.2", NULL),
+       OF_DEV_AUXDATA("fsl,imx53-i2c", MX53_I2C1_BASE_ADDR, "imx21-i2c.0", NULL),
+       OF_DEV_AUXDATA("fsl,imx53-i2c", MX53_I2C2_BASE_ADDR, "imx21-i2c.1", NULL),
+       OF_DEV_AUXDATA("fsl,imx53-i2c", MX53_I2C3_BASE_ADDR, "imx21-i2c.2", NULL),
        OF_DEV_AUXDATA("fsl,imx53-sdma", MX53_SDMA_BASE_ADDR, "imx35-sdma", NULL),
        OF_DEV_AUXDATA("fsl,imx53-wdt", MX53_WDOG1_BASE_ADDR, "imx2-wdt.0", NULL),
        { /* sentinel */ }
index 47c91f7185d2fb7cdef048388e5cf82620e68a87..978b6dd00de401e7662e0fc1e7d1aa003df57e20 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/system_misc.h>
-#include <mach/common.h>
-#include <mach/cpuidle.h>
-#include <mach/hardware.h>
 
+#include "common.h"
+#include "cpuidle.h"
+#include "hardware.h"
 
 void imx6q_restart(char mode, const char *cmd)
 {
index 0330078ff7880a34c94e275c19d128b989762355..2e536ea53444f8007cecd23308fb15155b2bb0b4 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
 
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-mx3.h>
-
+#include "common.h"
 #include "devices-imx31.h"
+#include "hardware.h"
+#include "iomux-mx3.h"
 
 #define KZM_ARM11_IO_ADDRESS(x) (IOMEM(                                        \
        IMX_IO_P2V_MODULE(x, MX31_CS4) ?:                               \
index 667f359a2e8b037e8d6a08933cf20435195e849d..06b483783e68d7abcff369b306dbda29c8a80574 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-mx1.h>
-
+#include "common.h"
 #include "devices-imx1.h"
+#include "hardware.h"
+#include "iomux-mx1.h"
 
 static const int mx1ads_pins[] __initconst = {
        /* UART1 */
index ed22e3fe6ec888d08840d9b6cbc839c9ccfdf4d6..6adb3136bb08be1380b7d79e767e3153c3432536 100644 (file)
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/physmap.h>
 #include <linux/gpio.h>
-#include <mach/common.h>
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
-#include <mach/iomux-mx21.h>
 
+#include "common.h"
 #include "devices-imx21.h"
+#include "hardware.h"
+#include "iomux-mx21.h"
 
 /*
  * Memory-mapped I/O on MX21ADS base board
index ce247fd1269ae094a57dc95065ba2256effb7e65..b1b03aa55bb8eec8352a7ccc69a2b5066c0bb546 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/usb/otg.h>
 
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/memory.h>
 #include <asm/mach/map.h>
-#include <mach/common.h>
-#include <mach/mx25.h>
-#include <mach/iomux-mx25.h>
 
+#include "common.h"
 #include "devices-imx25.h"
+#include "hardware.h"
+#include "iomux-mx25.h"
+#include "mx25.h"
 
 #define MX25PDK_CAN_PWDN       IMX_GPIO_NR(4, 6)
 
index 05996f39005c2dfcd2a6eb1df57b4fc92b2abc03..d0e547fa925fe40556d86b04d54ad3ef1c353be0 100644 (file)
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/iomux-mx27.h>
-#include <mach/ulpi.h>
-#include <mach/3ds_debugboard.h>
 
+#include "3ds_debugboard.h"
+#include "common.h"
 #include "devices-imx27.h"
+#include "hardware.h"
+#include "iomux-mx27.h"
+#include "ulpi.h"
 
 #define SD1_EN_GPIO            IMX_GPIO_NR(2, 25)
 #define OTG_PHY_RESET_GPIO     IMX_GPIO_NR(2, 23)
index 7dc59bac0e55cf8e30e1151064622a53cf172205..3d036f57f0e6c7558b890ec3fb26c337ffaac5fe 100644 (file)
 #include <linux/mtd/physmap.h>
 #include <linux/i2c.h>
 #include <linux/irq.h>
-#include <mach/common.h>
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
-#include <mach/iomux-mx27.h>
 
+#include "common.h"
 #include "devices-imx27.h"
+#include "hardware.h"
+#include "iomux-mx27.h"
 
 /*
  * Base address of PBC controller, CS4
index 8915f937b7d54e00735bf2de1dd4c03730d2d5f9..bc301befdd06a2d9356bcb258710fd475113ac19 100644 (file)
 
 #include <media/soc_camera.h>
 
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/memory.h>
 #include <asm/mach/map.h>
 #include <asm/memblock.h>
-#include <mach/common.h>
-#include <mach/iomux-mx3.h>
-#include <mach/3ds_debugboard.h>
-#include <mach/ulpi.h>
 
+#include "3ds_debugboard.h"
+#include "common.h"
 #include "devices-imx31.h"
+#include "hardware.h"
+#include "iomux-mx3.h"
+#include "ulpi.h"
 
 static int mx31_3ds_pins[] = {
        /* UART1 */
@@ -393,7 +393,7 @@ static struct regulator_init_data gpo_init = {
 };
 
 static struct regulator_consumer_supply vmmc2_consumers[] = {
-       REGULATOR_SUPPLY("vmmc", "mxc-mmc.0"),
+       REGULATOR_SUPPLY("vmmc", "imx31-mmc.0"),
 };
 
 static struct regulator_init_data vmmc2_init = {
index e774b07f48d33c70c0a678f3547fc8d1962d15bf..8b56f8883f3278d58bc5668ff49dd2377bbe9e02 100644 (file)
@@ -28,8 +28,6 @@
 #include <asm/mach/time.h>
 #include <asm/memory.h>
 #include <asm/mach/map.h>
-#include <mach/common.h>
-#include <mach/iomux-mx3.h>
 
 #ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
 #include <linux/mfd/wm8350/audio.h>
 #include <linux/mfd/wm8350/pmic.h>
 #endif
 
+#include "common.h"
 #include "devices-imx31.h"
+#include "hardware.h"
+#include "iomux-mx3.h"
 
 /* Base address of PBC controller */
 #define PBC_BASE_ADDRESS       MX31_CS4_BASE_ADDR_VIRT
index 34b9bf075daff783eb332ab652347ac1e159b84f..08b9965c8b36658d75b5e93b5c05616864628088 100644 (file)
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/iomux-mx3.h>
-#include <mach/board-mx31lilly.h>
-#include <mach/ulpi.h>
-
+#include "board-mx31lilly.h"
+#include "common.h"
 #include "devices-imx31.h"
+#include "hardware.h"
+#include "iomux-mx3.h"
+#include "ulpi.h"
 
 /*
  * This file contains module-specific initialization routines for LILLY-1131.
index ef57cff5abfbf8bd72607e23395963bbe5d4d895..bdcd92e59518f054d15ca78c5b8c35032deedc98 100644 (file)
 #include <asm/page.h>
 #include <asm/setup.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/board-mx31lite.h>
-#include <mach/iomux-mx3.h>
-#include <mach/ulpi.h>
-
+#include "board-mx31lite.h"
+#include "common.h"
 #include "devices-imx31.h"
+#include "hardware.h"
+#include "iomux-mx3.h"
+#include "ulpi.h"
 
 /*
  * This file contains the module-specific initialization routines.
index 459e754ef8c9162accb2d6b5c698af67cc52fa4d..2517cfa9f26bbb4519045f2653236dad709c9cb0 100644 (file)
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
 #include <asm/memblock.h>
-#include <mach/board-mx31moboard.h>
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-mx3.h>
-#include <mach/ulpi.h>
 #include <linux/platform_data/asoc-imx-ssi.h>
 
+#include "board-mx31moboard.h"
+#include "common.h"
 #include "devices-imx31.h"
+#include "hardware.h"
+#include "iomux-mx3.h"
+#include "ulpi.h"
 
 static unsigned int moboard_pins[] = {
        /* UART0 */
@@ -175,11 +175,11 @@ static const struct spi_imx_master moboard_spi1_pdata __initconst = {
 
 static struct regulator_consumer_supply sdhc_consumers[] = {
        {
-               .dev_name = "mxc-mmc.0",
+               .dev_name = "imx31-mmc.0",
                .supply = "sdhc0_vcc",
        },
        {
-               .dev_name = "mxc-mmc.1",
+               .dev_name = "imx31-mmc.1",
                .supply = "sdhc1_vcc",
        },
 };
index 504983c68aa8309bc8971ddbb18d8e35fb270505..5277da45d60c75a5ce7d7041745d7b9420485517 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/memblock.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/iomux-mx35.h>
-#include <mach/3ds_debugboard.h>
 #include <video/platform_lcd.h>
 
 #include <media/soc_camera.h>
 
+#include "3ds_debugboard.h"
+#include "common.h"
 #include "devices-imx35.h"
+#include "hardware.h"
+#include "iomux-mx35.h"
 
 #define GPIO_MC9S08DZ60_GPS_ENABLE 0
 #define GPIO_MC9S08DZ60_HDD_ENABLE 4
index 42b66e8d9615be75b2a4e4a3238ef04cedef360c..0c1f88a80bdc79080b0a2157db3fa39d73dabb61 100644 (file)
 #include <linux/delay.h>
 #include <linux/io.h>
 
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-mx50.h>
-
 #include <asm/irq.h>
 #include <asm/setup.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 
+#include "common.h"
 #include "devices-imx50.h"
+#include "hardware.h"
+#include "iomux-mx50.h"
 
 #define FEC_EN         IMX_GPIO_NR(6, 23)
 #define FEC_RESET_B    IMX_GPIO_NR(4, 12)
index 9ee84a4af63931c915a1d297a22a68ccaf1e688b..abc25bd1107be1e58cb0d889dd9aef27bd997320 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/iomux-mx51.h>
-#include <mach/3ds_debugboard.h>
-
+#include "3ds_debugboard.h"
+#include "common.h"
 #include "devices-imx51.h"
+#include "hardware.h"
+#include "iomux-mx51.h"
 
 #define MX51_3DS_ECSPI2_CS     (GPIO_PORTC + 28)
 
index 7b31cbde8775409312da8d8b749c293c3ced850f..d9a84ca2199ac2391463787b66e6661542e6e064 100644 (file)
 #include <linux/spi/flash.h>
 #include <linux/spi/spi.h>
 
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-mx51.h>
-
 #include <asm/setup.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 
+#include "common.h"
 #include "devices-imx51.h"
 #include "cpu_op-mx51.h"
+#include "hardware.h"
+#include "iomux-mx51.h"
 
 #define BABBAGE_USB_HUB_RESET  IMX_GPIO_NR(1, 7)
 #define BABBAGE_USBH1_STP      IMX_GPIO_NR(1, 27)
index 0bf6d30aa32d71de42f0068c6c7663a2ffb4ac01..f4a8c7e108e19d05410388b7000c72b57a1ad97a 100644 (file)
 #include <linux/mtd/physmap.h>
 #include <linux/i2c.h>
 #include <linux/irq.h>
-#include <mach/common.h>
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
 #include <linux/gpio.h>
-#include <mach/iomux-mx27.h>
 #include <linux/i2c/pca953x.h>
 
+#include "common.h"
 #include "devices-imx27.h"
+#include "hardware.h"
+#include "iomux-mx27.h"
 
 static const int mxt_td60_pins[] __initconst = {
        /* UART0 */
index de8516b7d69f36a77c51f44dcc224077f05d021e..eee369fa94a29ad5893e728e2240faaabcc1ae75 100644 (file)
 
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-mx27.h>
 #include <asm/mach/time.h>
-#include <mach/ulpi.h>
 
+#include "common.h"
 #include "devices-imx27.h"
+#include "hardware.h"
+#include "iomux-mx27.h"
+#include "ulpi.h"
 
 #define OTG_PHY_CS_GPIO (GPIO_PORTB + 23)
 #define USBH2_PHY_CS_GPIO (GPIO_PORTB + 24)
index e3c45130fb3cc8bad1929bdcd68b6227b2cc298f..547fef133f658f46d6627277a18cd9a3225c2907 100644 (file)
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
 #include <asm/memblock.h>
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-mx3.h>
-#include <mach/ulpi.h>
 
+#include "common.h"
 #include "devices-imx31.h"
+#include "hardware.h"
+#include "iomux-mx3.h"
 #include "pcm037.h"
+#include "ulpi.h"
 
 static enum pcm037_board_variant pcm037_instance = PCM037_PCM970;
 
index 11ffa81ad17db2d9501286df2201371ce3fdc0cc..8fd8255068eed31bce063e3db0d3b8a9f903c605 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/spi/spi.h>
 
-#include <mach/common.h>
-#include <mach/iomux-mx3.h>
-
 #include <asm/mach-types.h>
 
 #include "pcm037.h"
+#include "common.h"
 #include "devices-imx31.h"
+#include "iomux-mx3.h"
 
 static unsigned int pcm037_eet_pins[] = {
        /* Reserve and hardwire GPIO 57 high - S6E63D6 chipselect */
index 95f49d936fd3bd442e6b806ac5945d62050a3ba8..4aa0d0798605d5cf2fc20ee64b26d2c1e0f7ed6d 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 
-#include <mach/board-pcm038.h>
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-mx27.h>
-#include <mach/ulpi.h>
-
+#include "board-pcm038.h"
+#include "common.h"
 #include "devices-imx27.h"
+#include "hardware.h"
+#include "iomux-mx27.h"
+#include "ulpi.h"
 
 static const int pcm038_pins[] __initconst = {
        /* UART1 */
@@ -212,7 +211,7 @@ static const struct spi_imx_master pcm038_spi0_data __initconst = {
 
 static struct regulator_consumer_supply sdhc1_consumers[] = {
        {
-               .dev_name = "mxc-mmc.1",
+               .dev_name = "imx21-mmc.1",
                .supply = "sdhc_vcc",
        },
 };
index e4bd4387e344e653394a3b203ca91cbb7ec5cda0..92445440221eba9f2aace35fc1c3e6cd205a2e4b 100644 (file)
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/iomux-mx35.h>
-#include <mach/ulpi.h>
-
+#include "common.h"
 #include "devices-imx35.h"
+#include "hardware.h"
+#include "iomux-mx35.h"
+#include "ulpi.h"
 
 static const struct fb_videomode fb_modedb[] = {
        {
index fb25fbd3122633baae6bc964cbfac7779acd014f..96d9a91f8a3bb15efda2f4cb2be9a80b16db2a69 100644 (file)
 #include <linux/mtd/nand.h>
 #include <linux/gpio.h>
 
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
-#include <mach/common.h>
 #include <asm/page.h>
 #include <asm/setup.h>
-#include <mach/iomux-mx3.h>
 
+#include "common.h"
 #include "devices-imx31.h"
+#include "hardware.h"
+#include "iomux-mx3.h"
 
 /* FPGA defines */
 #define QONG_FPGA_VERSION(major, minor, rev)   \
index 67ff38e9a3ca3434e9b16b4daba6f908eec77715..fc970409dbaf1cd782d6f7e86350469508a7ffca 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-mx1.h>
-
+#include "common.h"
 #include "devices-imx1.h"
+#include "hardware.h"
+#include "iomux-mx1.h"
 
 /*
  * This scb9328 has a 32MiB flash
index 39eb7960e2a425a7ff604427b23e337fb697caed..3aecf91e428988bb364c3b0e46558aa6337ede8a 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/iomux-mx35.h>
-
 #include <linux/i2c.h>
 #include <linux/i2c/at24.h>
 #include <linux/mfd/mc13xxx.h>
 
+#include "common.h"
 #include "devices-imx35.h"
+#include "hardware.h"
+#include "iomux-mx35.h"
 
 #define GPIO_LCDPWR    IMX_GPIO_NR(1, 2)
 #define GPIO_PMIC_INT  IMX_GPIO_NR(2, 0)
index 6d60d51868bc83932667cd7488a364e0b3f9efb6..7a146671e65a8768572840b138da9a3987f8cb49 100644 (file)
 
 #include <asm/mach/map.h>
 
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-v1.h>
+#include "common.h"
+#include "devices/devices-common.h"
+#include "hardware.h"
+#include "iomux-v1.h"
 
 static struct map_desc imx_io_desc[] __initdata = {
        imx_map_entry(MX1, IO, MT_DEVICE),
@@ -58,5 +59,7 @@ void __init imx1_soc_init(void)
                                                MX1_GPIO_INT_PORTC, 0);
        mxc_register_gpio("imx1-gpio", 3, MX1_GPIO4_BASE_ADDR, SZ_256,
                                                MX1_GPIO_INT_PORTD, 0);
+       imx_add_imx_dma("imx1-dma", MX1_DMA_BASE_ADDR,
+                       MX1_DMA_INT, MX1_DMA_ERR);
        pinctrl_provide_dummies();
 }
index d056dad0940dd3688d785fb721d7ed13939afbe0..d8ccd3a8ec531bec988e6a90353148983d8d7713 100644 (file)
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/pinctrl/machine.h>
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/devices-common.h>
 #include <asm/pgtable.h>
 #include <asm/mach/map.h>
-#include <mach/iomux-v1.h>
+
+#include "common.h"
+#include "devices/devices-common.h"
+#include "hardware.h"
+#include "iomux-v1.h"
 
 /* MX21 memory map definition */
 static struct map_desc imx21_io_desc[] __initdata = {
@@ -81,6 +82,8 @@ static const struct resource imx21_audmux_res[] __initconst = {
 
 void __init imx21_soc_init(void)
 {
+       mxc_device_init();
+
        mxc_register_gpio("imx21-gpio", 0, MX21_GPIO1_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
        mxc_register_gpio("imx21-gpio", 1, MX21_GPIO2_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
        mxc_register_gpio("imx21-gpio", 2, MX21_GPIO3_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
@@ -89,7 +92,8 @@ void __init imx21_soc_init(void)
        mxc_register_gpio("imx21-gpio", 5, MX21_GPIO6_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
 
        pinctrl_provide_dummies();
-       imx_add_imx_dma();
+       imx_add_imx_dma("imx21-dma", MX21_DMA_BASE_ADDR,
+                       MX21_INT_DMACH0, 0); /* No ERR irq */
        platform_device_register_simple("imx21-audmux", 0, imx21_audmux_res,
                                        ARRAY_SIZE(imx21_audmux_res));
 }
index f3f5c6542ab4850beca756ea0168d0ed659a8c0b..9357707bb7afc4fa5bbb586fcf1ac6fcb8a9bfc0 100644 (file)
 #include <asm/pgtable.h>
 #include <asm/mach/map.h>
 
-#include <mach/common.h>
-#include <mach/devices-common.h>
-#include <mach/hardware.h>
-#include <mach/mx25.h>
-#include <mach/iomux-v3.h>
+#include "common.h"
+#include "devices/devices-common.h"
+#include "hardware.h"
+#include "iomux-v3.h"
+#include "mx25.h"
 
 /*
  * This table defines static virtual address mappings for I/O regions.
@@ -89,6 +89,8 @@ static const struct resource imx25_audmux_res[] __initconst = {
 
 void __init imx25_soc_init(void)
 {
+       mxc_device_init();
+
        /* i.mx25 has the i.mx35 type gpio */
        mxc_register_gpio("imx35-gpio", 0, MX25_GPIO1_BASE_ADDR, SZ_16K, MX25_INT_GPIO1, 0);
        mxc_register_gpio("imx35-gpio", 1, MX25_GPIO2_BASE_ADDR, SZ_16K, MX25_INT_GPIO2, 0);
index e7e24afc45edb6f83a7fbc9de56a13568a6d348a..4f1be65a7b5fe62a6531a09d70aa623283086d6b 100644 (file)
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/pinctrl/machine.h>
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/devices-common.h>
 #include <asm/pgtable.h>
 #include <asm/mach/map.h>
-#include <mach/iomux-v1.h>
+
+#include "common.h"
+#include "devices/devices-common.h"
+#include "hardware.h"
+#include "iomux-v1.h"
 
 /* MX27 memory map definition */
 static struct map_desc imx27_io_desc[] __initdata = {
@@ -81,6 +82,8 @@ static const struct resource imx27_audmux_res[] __initconst = {
 
 void __init imx27_soc_init(void)
 {
+       mxc_device_init();
+
        /* i.mx27 has the i.mx21 type gpio */
        mxc_register_gpio("imx21-gpio", 0, MX27_GPIO1_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
        mxc_register_gpio("imx21-gpio", 1, MX27_GPIO2_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
@@ -90,7 +93,8 @@ void __init imx27_soc_init(void)
        mxc_register_gpio("imx21-gpio", 5, MX27_GPIO6_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
 
        pinctrl_provide_dummies();
-       imx_add_imx_dma();
+       imx_add_imx_dma("imx27-dma", MX27_DMA_BASE_ADDR,
+                       MX27_INT_DMACH0, 0); /* No ERR irq */
        /* imx27 has the imx21 type audmux */
        platform_device_register_simple("imx21-audmux", 0, imx27_audmux_res,
                                        ARRAY_SIZE(imx27_audmux_res));
index b5deb0554552d1bbe586fcf2b7fd2d1bc0a33c06..cefa047c4053f681b6932353218ef67d5633badd 100644 (file)
 #include <asm/hardware/cache-l2x0.h>
 #include <asm/mach/map.h>
 
-#include <mach/common.h>
-#include <mach/devices-common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-v3.h>
-
+#include "common.h"
 #include "crmregs-imx3.h"
+#include "devices/devices-common.h"
+#include "hardware.h"
+#include "iomux-v3.h"
 
 void __iomem *mx3_ccm_base;
 
@@ -175,6 +174,8 @@ void __init imx31_soc_init(void)
 
        imx3_init_l2x0();
 
+       mxc_device_init();
+
        mxc_register_gpio("imx31-gpio", 0, MX31_GPIO1_BASE_ADDR, SZ_16K, MX31_INT_GPIO1, 0);
        mxc_register_gpio("imx31-gpio", 1, MX31_GPIO2_BASE_ADDR, SZ_16K, MX31_INT_GPIO2, 0);
        mxc_register_gpio("imx31-gpio", 2, MX31_GPIO3_BASE_ADDR, SZ_16K, MX31_INT_GPIO3, 0);
@@ -271,6 +272,8 @@ void __init imx35_soc_init(void)
 
        imx3_init_l2x0();
 
+       mxc_device_init();
+
        mxc_register_gpio("imx35-gpio", 0, MX35_GPIO1_BASE_ADDR, SZ_16K, MX35_INT_GPIO1, 0);
        mxc_register_gpio("imx35-gpio", 1, MX35_GPIO2_BASE_ADDR, SZ_16K, MX35_INT_GPIO2, 0);
        mxc_register_gpio("imx35-gpio", 2, MX35_GPIO3_BASE_ADDR, SZ_16K, MX35_INT_GPIO3, 0);
index acb0aadb425541baabff4dc82f7d6a0b34c8ad09..f92caf1b30bacc5a86bd05ba1320e01eaafed014 100644 (file)
 
 #include <asm/mach/map.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/devices-common.h>
-#include <mach/iomux-v3.h>
+#include "common.h"
+#include "devices/devices-common.h"
+#include "hardware.h"
+#include "iomux-v3.h"
 
 /*
  * Define the MX50 memory map.
@@ -138,6 +138,8 @@ static const struct resource imx51_audmux_res[] __initconst = {
 
 void __init imx50_soc_init(void)
 {
+       mxc_device_init();
+
        /* i.mx50 has the i.mx35 type gpio */
        mxc_register_gpio("imx35-gpio", 0, MX50_GPIO1_BASE_ADDR, SZ_16K, MX50_INT_GPIO1_LOW, MX50_INT_GPIO1_HIGH);
        mxc_register_gpio("imx35-gpio", 1, MX50_GPIO2_BASE_ADDR, SZ_16K, MX50_INT_GPIO2_LOW, MX50_INT_GPIO2_HIGH);
@@ -153,6 +155,8 @@ void __init imx50_soc_init(void)
 
 void __init imx51_soc_init(void)
 {
+       mxc_device_init();
+
        /* i.mx51 has the i.mx35 type gpio */
        mxc_register_gpio("imx35-gpio", 0, MX51_GPIO1_BASE_ADDR, SZ_16K, MX51_INT_GPIO1_LOW, MX51_INT_GPIO1_HIGH);
        mxc_register_gpio("imx35-gpio", 1, MX51_GPIO2_BASE_ADDR, SZ_16K, MX51_INT_GPIO2_LOW, MX51_INT_GPIO2_HIGH);
index 29e890f92055ef697f72f0b32b3fb7009a9a1c68..d4361b80c5fba0c60d5436bbdd0401ffd97b9a3f 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/iomux-mx3.h>
-#include <mach/board-mx31lilly.h>
-
+#include "board-mx31lilly.h"
+#include "common.h"
 #include "devices-imx31.h"
+#include "hardware.h"
+#include "iomux-mx3.h"
 
 /*
  * This file contains board-specific initialization routines for the
index 83d17d9e0bc8677fd62ef31949ef55c0b64e72e4..5a160b7e4fceb9232c6b2c2db5b1138b3377a232 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/iomux-mx3.h>
-#include <mach/board-mx31lite.h>
-
+#include "board-mx31lite.h"
+#include "common.h"
 #include "devices-imx31.h"
+#include "hardware.h"
+#include "iomux-mx3.h"
 
 /*
  * This file contains board-specific initialization routines for the
index cc285e50728601e9a7a83e369a27d9768a520c99..52d5b1574721adf5b2e7518bc5bb62b236c6171c 100644 (file)
 
 #include <linux/usb/otg.h>
 
-#include <mach/common.h>
-#include <mach/iomux-mx3.h>
-#include <mach/hardware.h>
-#include <mach/ulpi.h>
-
+#include "common.h"
 #include "devices-imx31.h"
+#include "hardware.h"
+#include "iomux-mx3.h"
+#include "ulpi.h"
 
 static unsigned int devboard_pins[] = {
        /* UART1 */
index 135c90e3a45f15b4969d61d10b9ae60c7383e223..a4f43e90f3c12afe42b9db69f3b4f038838a133c 100644 (file)
 
 #include <linux/usb/otg.h>
 
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-mx3.h>
-#include <mach/ulpi.h>
-
 #include <media/soc_camera.h>
 
+#include "common.h"
 #include "devices-imx31.h"
+#include "hardware.h"
+#include "iomux-mx3.h"
+#include "ulpi.h"
 
 static unsigned int marxbot_pins[] = {
        /* SDHC2 */
index fabb801e799420ad269519b109821aa4f6a69b58..04ae45dbfaa724a3bae40d11a8e3106239069ae0 100644 (file)
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
 
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/iomux-mx3.h>
-#include <mach/board-mx31moboard.h>
-#include <mach/ulpi.h>
-
 #include <media/soc_camera.h>
 
+#include "board-mx31moboard.h"
+#include "common.h"
 #include "devices-imx31.h"
+#include "hardware.h"
+#include "iomux-mx3.h"
+#include "ulpi.h"
 
 static unsigned int smartbot_pins[] = {
        /* UART1 */
index 9917e2ff51da9bdd6cf74823044dfcd985faba02..51c608234089a689bce5c92276cccb4d3a8d9e74 100644 (file)
 
 #include <asm/mach/arch.h>
 
-#include <mach/common.h>
-#include <mach/iomux-mx27.h>
-#include <mach/hardware.h>
-
+#include "common.h"
 #include "devices-imx27.h"
+#include "hardware.h"
+#include "iomux-mx27.h"
 
 static const int pcm970_pins[] __initconst = {
        /* SDHC */
index 2ac43e1a2dfd0b2028d13702b63b654656f8ea7c..3777b805b76ba8645c50c41993f8ba06b550927d 100644 (file)
@@ -16,8 +16,9 @@
 #include <asm/smp_scu.h>
 #include <asm/hardware/gic.h>
 #include <asm/mach/map.h>
-#include <mach/common.h>
-#include <mach/hardware.h>
+
+#include "common.h"
+#include "hardware.h"
 
 static void __iomem *scu_base;
 
index 6fcffa7db978d4b025bf6eed72ea4b0b99c417c7..56d02d064fbf941c3b070cced2bf2f2e88a9056e 100644 (file)
@@ -10,7 +10,8 @@
 #include <linux/kernel.h>
 #include <linux/suspend.h>
 #include <linux/io.h>
-#include <mach/hardware.h>
+
+#include "hardware.h"
 
 static int mx27_suspend_enter(suspend_state_t state)
 {
index 822103bdb7092eab3ba63c3260f9da4f587abc2f..6a07006ff0f48136591ff0909636cd73b774bf08 100644 (file)
@@ -9,10 +9,11 @@
  * http://www.gnu.org/copyleft/gpl.html
  */
 #include <linux/io.h>
-#include <mach/common.h>
-#include <mach/hardware.h>
-#include <mach/devices-common.h>
+
+#include "common.h"
 #include "crmregs-imx3.h"
+#include "devices/devices-common.h"
+#include "hardware.h"
 
 /*
  * Set cpu low power mode before WFI instruction. This function is called
index 19621ed1ffa5852900e2ab285e3ea1c2b4c1c357..2e063c2deb9e2078edbccdfb0a52fd8dca9c7284 100644 (file)
 #include <asm/cacheflush.h>
 #include <asm/system_misc.h>
 #include <asm/tlbflush.h>
-#include <mach/common.h>
-#include <mach/cpuidle.h>
-#include <mach/hardware.h>
+
+#include "common.h"
+#include "cpuidle.h"
 #include "crm-regs-imx5.h"
+#include "hardware.h"
 
 /*
  * The WAIT_UNCLOCKED_POWER_OFF state only requires <= 500ns to exit.
index f7b0c2b1b90529849050dc45243b75f4bb4d0e68..a17543da602da4d8c5504961434bba5bfa2551b2 100644 (file)
@@ -18,8 +18,9 @@
 #include <asm/proc-fns.h>
 #include <asm/suspend.h>
 #include <asm/hardware/cache-l2x0.h>
-#include <mach/common.h>
-#include <mach/hardware.h>
+
+#include "common.h"
+#include "hardware.h"
 
 extern unsigned long phys_l2x0_saved_regs;
 
similarity index 97%
rename from arch/arm/plat-mxc/system.c
rename to arch/arm/mach-imx/system.c
index 3da78cfc5a94b6563d8276a0daa149edd3d9f954..695e0d73bf85e12308f878bcbfd322280b67ba76 100644 (file)
 #include <linux/err.h>
 #include <linux/delay.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
 #include <asm/system_misc.h>
 #include <asm/proc-fns.h>
 #include <asm/mach-types.h>
 
+#include "common.h"
+#include "hardware.h"
+
 static void __iomem *wdog_base;
 
 /*
similarity index 99%
rename from arch/arm/plat-mxc/time.c
rename to arch/arm/mach-imx/time.c
index a17abcf983259064ff2a87664d81d3610b6ef3b1..f017302f6d09c94d5d97d4d63f47311d8ace4e7a 100644 (file)
 #include <linux/clk.h>
 #include <linux/err.h>
 
-#include <mach/hardware.h>
 #include <asm/sched_clock.h>
 #include <asm/mach/time.h>
-#include <mach/common.h>
+
+#include "common.h"
+#include "hardware.h"
 
 /*
  * There are 2 versions of the timer hardware on Freescale MXC hardware.
similarity index 98%
rename from arch/arm/plat-mxc/tzic.c
rename to arch/arm/mach-imx/tzic.c
index 3ed1adbc09f882bbafc0fe35fee22467a96734f8..9721161f208f10a0d8e65bd9ad69d762e8b85228 100644 (file)
 #include <asm/mach/irq.h>
 #include <asm/exception.h>
 
-#include <mach/hardware.h>
-#include <mach/common.h>
-#include <mach/irqs.h>
-
+#include "common.h"
+#include "hardware.h"
 #include "irq-common.h"
 
 /*
similarity index 99%
rename from arch/arm/plat-mxc/ulpi.c
rename to arch/arm/mach-imx/ulpi.c
index d2963427184f64ae942ad7e02a70ea4cf27addc9..0f051957d10cf0ebc6cdc2c9e5102ffc672c4bda 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
 
-#include <mach/ulpi.h>
+#include "ulpi.h"
 
 /* ULPIVIEW register bits */
 #define ULPIVW_WU              (1 << 31)       /* Wakeup */
index cd169c386161a58fc4f42702ec008f83c3194722..f0e69cbc5baaefa8a0372a485408687d2395be07 100644 (file)
@@ -3,7 +3,8 @@
 #
 
 # Common support
-obj-y := io.o id.o sram.o time.o irq.o mux.o flash.o serial.o devices.o dma.o
+obj-y := io.o id.o sram-init.o sram.o time.o irq.o mux.o flash.o \
+        serial.o devices.o dma.o
 obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o
 
 ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
index e255164ff087ebbb40dcd7e167abbeab71ca27d3..a8fce3ccc707fcea16c27f9edd8a47ef8961d2a0 100644 (file)
@@ -625,7 +625,6 @@ MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
        .atag_offset    = 0x100,
        .map_io         = ams_delta_map_io,
        .init_early     = omap1_init_early,
-       .reserve        = omap_reserve,
        .init_irq       = omap1_init_irq,
        .init_machine   = ams_delta_init,
        .init_late      = ams_delta_init_late,
index 4b6de70c47a686576795c1a59db319590a53efb8..e067f221f0f9b0bf9fd1309d6a406a5b0ba6ee76 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <plat/tc.h>
+#include <mach/tc.h>
 #include <mach/mux.h>
 #include <mach/flash.h>
-#include <plat/fpga.h>
 #include <linux/platform_data/keypad-omap.h>
 
 #include <mach/hardware.h>
 
 #include "iomap.h"
 #include "common.h"
+#include "fpga.h"
 
 /* fsample is pretty close to p2-sample */
 
@@ -123,9 +123,9 @@ static struct resource smc91x_resources[] = {
 
 static void __init fsample_init_smc91x(void)
 {
-       fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
+       __raw_writeb(1, H2P2_DBG_FPGA_LAN_RESET);
        mdelay(50);
-       fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
+       __raw_writeb(__raw_readb(H2P2_DBG_FPGA_LAN_RESET) & ~1,
                   H2P2_DBG_FPGA_LAN_RESET);
        mdelay(50);
 }
@@ -362,7 +362,6 @@ MACHINE_START(OMAP_FSAMPLE, "OMAP730 F-Sample")
        .atag_offset    = 0x100,
        .map_io         = omap_fsample_map_io,
        .init_early     = omap1_init_early,
-       .reserve        = omap_reserve,
        .init_irq       = omap1_init_irq,
        .init_machine   = omap_fsample_init,
        .init_late      = omap1_init_late,
index 4ec579fdd366e15c034c07d186eeb3c16dacf4cb..608e7d2a27789b63c6aee7a90259083f7679b124 100644 (file)
@@ -81,7 +81,6 @@ MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
        .atag_offset    = 0x100,
        .map_io         = omap16xx_map_io,
        .init_early     = omap1_init_early,
-       .reserve        = omap_reserve,
        .init_irq       = omap1_init_irq,
        .init_machine   = omap_generic_init,
        .init_late      = omap1_init_late,
index e1362ce48497e53bc60ef3d81e9ee309f0601bfe..7119ef28e0adf2e7869da0d4238fe0b30ea677c7 100644 (file)
  */
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
-
+#include <linux/platform_data/gpio-omap.h>
 #include <linux/i2c/tps65010.h>
 
-#include <plat/mmc.h>
-
 #include "board-h2.h"
+#include "mmc.h"
 
 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
index 376f7f29ef77391fc8de34c9cb8bb6264abdef09..9134b646f01b2760b245c9791929b781370e67a5 100644 (file)
@@ -39,8 +39,8 @@
 #include <asm/mach/map.h>
 
 #include <mach/mux.h>
-#include <plat/dma.h>
-#include <plat/tc.h>
+#include <plat-omap/dma-omap.h>
+#include <mach/tc.h>
 #include <mach/irda.h>
 #include <linux/platform_data/keypad-omap.h>
 #include <mach/flash.h>
@@ -50,6 +50,7 @@
 
 #include "common.h"
 #include "board-h2.h"
+#include "dma.h"
 
 /* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
 #define OMAP1610_ETHR_START            0x04000300
@@ -458,7 +459,6 @@ MACHINE_START(OMAP_H2, "TI-H2")
        .atag_offset    = 0x100,
        .map_io         = omap16xx_map_io,
        .init_early     = omap1_init_early,
-       .reserve        = omap_reserve,
        .init_irq       = omap1_init_irq,
        .init_machine   = h2_init,
        .init_late      = omap1_init_late,
index c74daace8cd686482d3c440eb6a4d1a0472947c7..17d77914d769233d4c1360ef5159a3df98cda596 100644 (file)
@@ -16,9 +16,8 @@
 
 #include <linux/i2c/tps65010.h>
 
-#include <plat/mmc.h>
-
 #include "board-h3.h"
+#include "mmc.h"
 
 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
index ededdb7ef28c021aa2f43ed4dcacbb8fe1c6e723..bf213d1d807534bb0ed21674db4d3a72ca3c60fa 100644 (file)
@@ -41,9 +41,9 @@
 #include <asm/mach/map.h>
 
 #include <mach/mux.h>
-#include <plat/tc.h>
+#include <mach/tc.h>
 #include <linux/platform_data/keypad-omap.h>
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 #include <mach/flash.h>
 
 #include <mach/hardware.h>
@@ -452,7 +452,6 @@ MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
        .atag_offset    = 0x100,
        .map_io         = omap16xx_map_io,
        .init_early     = omap1_init_early,
-       .reserve        = omap_reserve,
        .init_irq       = omap1_init_irq,
        .init_machine   = h3_init,
        .init_late      = omap1_init_late,
index 87ab2086ef9653a4dce67b93f0cc6d1916048b2e..356f816c84a6603c0fab318581f31074f42de95c 100644 (file)
@@ -43,7 +43,7 @@
 #include <asm/mach/arch.h>
 
 #include <mach/omap7xx.h>
-#include <plat/mmc.h>
+#include "mmc.h"
 
 #include <mach/irqs.h>
 #include <mach/usb.h>
@@ -600,7 +600,6 @@ MACHINE_START(HERALD, "HTC Herald")
        .atag_offset    = 0x100,
        .map_io         = htcherald_map_io,
        .init_early     = omap1_init_early,
-       .reserve        = omap_reserve,
        .init_irq       = omap1_init_irq,
        .init_machine   = htcherald_init,
        .init_late      = omap1_init_late,
index db5f7d2976e7286af4d89e52d2c3d7ba02d5a4c0..f8033fab0f82f4c674bf92446a8af244df9b6d57 100644 (file)
 
 #include <mach/mux.h>
 #include <mach/flash.h>
-#include <plat/fpga.h>
-#include <plat/tc.h>
+#include <mach/tc.h>
 #include <linux/platform_data/keypad-omap.h>
-#include <plat/mmc.h>
 
 #include <mach/hardware.h>
 #include <mach/usb.h>
 
 #include "iomap.h"
 #include "common.h"
+#include "mmc.h"
 
 /* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
 #define INNOVATOR1610_ETHR_START       0x04000300
@@ -215,7 +214,7 @@ static struct platform_device *innovator1510_devices[] __initdata = {
 
 static int innovator_get_pendown_state(void)
 {
-       return !(fpga_read(OMAP1510_FPGA_TOUCHSCREEN) & (1 << 5));
+       return !(__raw_readb(OMAP1510_FPGA_TOUCHSCREEN) & (1 << 5));
 }
 
 static const struct ads7846_platform_data innovator1510_ts_info = {
@@ -279,7 +278,7 @@ static struct platform_device *innovator1610_devices[] __initdata = {
 static void __init innovator_init_smc91x(void)
 {
        if (cpu_is_omap1510()) {
-               fpga_write(fpga_read(OMAP1510_FPGA_RST) & ~1,
+               __raw_writeb(__raw_readb(OMAP1510_FPGA_RST) & ~1,
                           OMAP1510_FPGA_RST);
                udelay(750);
        } else {
@@ -335,10 +334,10 @@ static int mmc_set_power(struct device *dev, int slot, int power_on,
                                int vdd)
 {
        if (power_on)
-               fpga_write(fpga_read(OMAP1510_FPGA_POWER) | (1 << 3),
+               __raw_writeb(__raw_readb(OMAP1510_FPGA_POWER) | (1 << 3),
                                OMAP1510_FPGA_POWER);
        else
-               fpga_write(fpga_read(OMAP1510_FPGA_POWER) & ~(1 << 3),
+               __raw_writeb(__raw_readb(OMAP1510_FPGA_POWER) & ~(1 << 3),
                                OMAP1510_FPGA_POWER);
 
        return 0;
@@ -390,14 +389,14 @@ static void __init innovator_init(void)
                omap_cfg_reg(UART3_TX);
                omap_cfg_reg(UART3_RX);
 
-               reg = fpga_read(OMAP1510_FPGA_POWER);
+               reg = __raw_readb(OMAP1510_FPGA_POWER);
                reg |= OMAP1510_FPGA_PCR_COM1_EN;
-               fpga_write(reg, OMAP1510_FPGA_POWER);
+               __raw_writeb(reg, OMAP1510_FPGA_POWER);
                udelay(10);
 
-               reg = fpga_read(OMAP1510_FPGA_POWER);
+               reg = __raw_readb(OMAP1510_FPGA_POWER);
                reg |= OMAP1510_FPGA_PCR_COM2_EN;
-               fpga_write(reg, OMAP1510_FPGA_POWER);
+               __raw_writeb(reg, OMAP1510_FPGA_POWER);
                udelay(10);
 
                platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices));
@@ -437,6 +436,7 @@ static void __init innovator_init(void)
  */
 static void __init innovator_map_io(void)
 {
+#ifdef CONFIG_ARCH_OMAP15XX
        omap15xx_map_io();
 
        iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
@@ -444,9 +444,10 @@ static void __init innovator_map_io(void)
 
        /* Dump the Innovator FPGA rev early - useful info for support. */
        pr_debug("Innovator FPGA Rev %d.%d Board Rev %d\n",
-                       fpga_read(OMAP1510_FPGA_REV_HIGH),
-                       fpga_read(OMAP1510_FPGA_REV_LOW),
-                       fpga_read(OMAP1510_FPGA_BOARD_REV));
+                       __raw_readb(OMAP1510_FPGA_REV_HIGH),
+                       __raw_readb(OMAP1510_FPGA_REV_LOW),
+                       __raw_readb(OMAP1510_FPGA_BOARD_REV));
+#endif
 }
 
 MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
@@ -454,7 +455,6 @@ MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
        .atag_offset    = 0x100,
        .map_io         = innovator_map_io,
        .init_early     = omap1_init_early,
-       .reserve        = omap_reserve,
        .init_irq       = omap1_init_irq,
        .init_machine   = innovator_init,
        .init_late      = omap1_init_late,
index 7d5c06d6a52a4428cf9243d44f4239ee92616c98..3e8ead67e4598db020424fd4bb2003359a714ccf 100644 (file)
 #include <asm/mach/map.h>
 
 #include <mach/mux.h>
-#include <plat/mmc.h>
-#include <plat/clock.h>
 
 #include <mach/hardware.h>
 #include <mach/usb.h>
 
 #include "common.h"
+#include "clock.h"
+#include "mmc.h"
 
 #define ADS7846_PENDOWN_GPIO   15
 
@@ -251,7 +251,6 @@ MACHINE_START(NOKIA770, "Nokia 770")
        .atag_offset    = 0x100,
        .map_io         = omap16xx_map_io,
        .init_early     = omap1_init_early,
-       .reserve        = omap_reserve,
        .init_irq       = omap1_init_irq,
        .init_machine   = omap_nokia770_init,
        .init_late      = omap1_init_late,
index 5973945a8741a79ddeffcb2146046c88268169e9..872ea47cd28a810c61fa31c95a1c9ef61ad364bb 100644 (file)
@@ -48,7 +48,7 @@
 
 #include <mach/flash.h>
 #include <mach/mux.h>
-#include <plat/tc.h>
+#include <mach/tc.h>
 
 #include <mach/hardware.h>
 #include <mach/usb.h>
@@ -606,7 +606,6 @@ MACHINE_START(OMAP_OSK, "TI-OSK")
        .atag_offset    = 0x100,
        .map_io         = omap16xx_map_io,
        .init_early     = omap1_init_early,
-       .reserve        = omap_reserve,
        .init_irq       = omap1_init_irq,
        .init_machine   = osk_init,
        .init_late      = omap1_init_late,
index 1c578d58923ab703179196fda89adf18336bcc00..584b6fab894bb4c5978a30fb2045ec339de0e623 100644 (file)
@@ -36,8 +36,8 @@
 
 #include <mach/flash.h>
 #include <mach/mux.h>
-#include <plat/tc.h>
-#include <plat/dma.h>
+#include <mach/tc.h>
+#include <plat-omap/dma-omap.h>
 #include <mach/irda.h>
 #include <linux/platform_data/keypad-omap.h>
 
@@ -45,6 +45,7 @@
 #include <mach/usb.h>
 
 #include "common.h"
+#include "dma.h"
 
 #define PALMTE_USBDETECT_GPIO  0
 #define PALMTE_USB_OR_DC_GPIO  1
@@ -264,7 +265,6 @@ MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
        .atag_offset    = 0x100,
        .map_io         = omap15xx_map_io,
        .init_early     = omap1_init_early,
-       .reserve        = omap_reserve,
        .init_irq       = omap1_init_irq,
        .init_machine   = omap_palmte_init,
        .init_late      = omap1_init_late,
index 97158095083ccdd87c9784087d535a34fe2df9fe..fbc986bfe69e1770e5201145febcc4e171778c24 100644 (file)
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
 #include <linux/platform_data/omap1_bl.h>
+#include <linux/platform_data/leds-omap.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <plat/led.h>
 #include <mach/flash.h>
 #include <mach/mux.h>
-#include <plat/dma.h>
-#include <plat/tc.h>
+#include <plat-omap/dma-omap.h>
+#include <mach/tc.h>
 #include <mach/irda.h>
 #include <linux/platform_data/keypad-omap.h>
 
@@ -45,6 +45,7 @@
 #include <mach/usb.h>
 
 #include "common.h"
+#include "dma.h"
 
 #define PALMTT_USBDETECT_GPIO  0
 #define PALMTT_CABLE_GPIO      1
@@ -310,7 +311,6 @@ MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
        .atag_offset    = 0x100,
        .map_io         = omap15xx_map_io,
        .init_early     = omap1_init_early,
-       .reserve        = omap_reserve,
        .init_irq       = omap1_init_irq,
        .init_machine   = omap_palmtt_init,
        .init_late      = omap1_init_late,
index e311032e7eebb3abbbd7540843b96de3ec314302..60d917a9376326e26a385ccc542213c2e94f0ca9 100644 (file)
@@ -38,8 +38,8 @@
 
 #include <mach/flash.h>
 #include <mach/mux.h>
-#include <plat/dma.h>
-#include <plat/tc.h>
+#include <plat-omap/dma-omap.h>
+#include <mach/tc.h>
 #include <mach/irda.h>
 #include <linux/platform_data/keypad-omap.h>
 
@@ -47,6 +47,7 @@
 #include <mach/usb.h>
 
 #include "common.h"
+#include "dma.h"
 
 #define PALMZ71_USBDETECT_GPIO 0
 #define PALMZ71_PENIRQ_GPIO    6
@@ -326,7 +327,6 @@ MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
        .atag_offset    = 0x100,
        .map_io         = omap15xx_map_io,
        .init_early     = omap1_init_early,
-       .reserve        = omap_reserve,
        .init_irq       = omap1_init_irq,
        .init_machine   = omap_palmz71_init,
        .init_late      = omap1_init_late,
index 198b05417bfcd49a6c9194e182743b3e5ebf7464..9a7e483ed6fded7c2db6684963e35dd7879d14ac 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <plat/tc.h>
+#include <mach/tc.h>
 #include <mach/mux.h>
-#include <plat/fpga.h>
 #include <mach/flash.h>
 
 #include <mach/hardware.h>
 
 #include "iomap.h"
 #include "common.h"
+#include "fpga.h"
 
 static const unsigned int p2_keymap[] = {
        KEY(0, 0, KEY_UP),
@@ -231,9 +231,9 @@ static struct omap_lcd_config perseus2_lcd_config __initdata = {
 
 static void __init perseus2_init_smc91x(void)
 {
-       fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
+       __raw_writeb(1, H2P2_DBG_FPGA_LAN_RESET);
        mdelay(50);
-       fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
+       __raw_writeb(__raw_readb(H2P2_DBG_FPGA_LAN_RESET) & ~1,
                   H2P2_DBG_FPGA_LAN_RESET);
        mdelay(50);
 }
@@ -324,7 +324,6 @@ MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
        .atag_offset    = 0x100,
        .map_io         = omap_perseus2_map_io,
        .init_early     = omap1_init_early,
-       .reserve        = omap_reserve,
        .init_irq       = omap1_init_irq,
        .init_machine   = omap_perseus2_init,
        .init_late      = omap1_init_late,
index 5932d56e17bf559642b397f7df96deea24eaaf26..4fcf19c78a086e2c4a0529ca5ad85ef85dda3050 100644 (file)
 #include <linux/platform_device.h>
 
 #include <mach/hardware.h>
-#include <plat/mmc.h>
 #include <mach/board-sx1.h>
 
+#include "mmc.h"
+
 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
 static int mmc_set_power(struct device *dev, int slot, int power_on,
index 13bf2cc56814a988a03e7043f161ce741ce4e3ea..1ebc7e08d6e5b9cad9ce1386007c387d4fb0963f 100644 (file)
 
 #include <mach/flash.h>
 #include <mach/mux.h>
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 #include <mach/irda.h>
-#include <plat/tc.h>
+#include <mach/tc.h>
 #include <mach/board-sx1.h>
 
 #include <mach/hardware.h>
 #include <mach/usb.h>
 
 #include "common.h"
+#include "dma.h"
 
 /* Write to I2C device */
 int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value)
@@ -403,7 +404,6 @@ MACHINE_START(SX1, "OMAP310 based Siemens SX1")
        .atag_offset    = 0x100,
        .map_io         = omap15xx_map_io,
        .init_early     = omap1_init_early,
-       .reserve        = omap_reserve,
        .init_irq       = omap1_init_irq,
        .init_machine   = omap_sx1_init,
        .init_late      = omap1_init_late,
index ad75e3411d462c0fc62e5012a4b4801b397a6962..abf705f49b19777e21884f3795432e1cb709f84e 100644 (file)
@@ -34,7 +34,7 @@
 #include <mach/board-voiceblue.h>
 #include <mach/flash.h>
 #include <mach/mux.h>
-#include <plat/tc.h>
+#include <mach/tc.h>
 
 #include <mach/hardware.h>
 #include <mach/usb.h>
@@ -286,7 +286,6 @@ MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910")
        .atag_offset    = 0x100,
        .map_io         = omap15xx_map_io,
        .init_early     = omap1_init_early,
-       .reserve        = omap_reserve,
        .init_irq       = omap1_init_irq,
        .init_machine   = voiceblue_init,
        .init_late      = omap1_init_late,
index 638f4070fc7025a7d692607b28a5ed5a6888880c..4f5fd4a084c06971e2faa21a255bae822a295043 100644 (file)
@@ -12,6 +12,7 @@
  * published by the Free Software Foundation.
  */
 #include <linux/kernel.h>
+#include <linux/export.h>
 #include <linux/list.h>
 #include <linux/errno.h>
 #include <linux/err.h>
 
 #include <asm/mach-types.h>
 
-#include <plat/cpu.h>
-#include <plat/usb.h>
-#include <plat/clock.h>
-#include <plat/sram.h>
-#include <plat/clkdev_omap.h>
-
 #include <mach/hardware.h>
 
+#include "soc.h"
 #include "iomap.h"
 #include "clock.h"
 #include "opp.h"
+#include "sram.h"
 
 __u32 arm_idlect1_mask;
 struct clk *api_ck_p, *ck_dpll1_p, *ck_ref_p;
 
+static LIST_HEAD(clocks);
+static DEFINE_MUTEX(clocks_mutex);
+static DEFINE_SPINLOCK(clockfw_lock);
+
 /*
  * Omap1 specific clock functions
  */
@@ -607,3 +608,497 @@ void omap1_clk_disable_unused(struct clk *clk)
 }
 
 #endif
+
+
+int clk_enable(struct clk *clk)
+{
+       unsigned long flags;
+       int ret;
+
+       if (clk == NULL || IS_ERR(clk))
+               return -EINVAL;
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+       ret = omap1_clk_enable(clk);
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+
+       return ret;
+}
+EXPORT_SYMBOL(clk_enable);
+
+void clk_disable(struct clk *clk)
+{
+       unsigned long flags;
+
+       if (clk == NULL || IS_ERR(clk))
+               return;
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+       if (clk->usecount == 0) {
+               pr_err("Trying disable clock %s with 0 usecount\n",
+                      clk->name);
+               WARN_ON(1);
+               goto out;
+       }
+
+       omap1_clk_disable(clk);
+
+out:
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+}
+EXPORT_SYMBOL(clk_disable);
+
+unsigned long clk_get_rate(struct clk *clk)
+{
+       unsigned long flags;
+       unsigned long ret;
+
+       if (clk == NULL || IS_ERR(clk))
+               return 0;
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+       ret = clk->rate;
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+
+       return ret;
+}
+EXPORT_SYMBOL(clk_get_rate);
+
+/*
+ * Optional clock functions defined in include/linux/clk.h
+ */
+
+long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+       unsigned long flags;
+       long ret;
+
+       if (clk == NULL || IS_ERR(clk))
+               return 0;
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+       ret = omap1_clk_round_rate(clk, rate);
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+
+       return ret;
+}
+EXPORT_SYMBOL(clk_round_rate);
+
+int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+       unsigned long flags;
+       int ret = -EINVAL;
+
+       if (clk == NULL || IS_ERR(clk))
+               return ret;
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+       ret = omap1_clk_set_rate(clk, rate);
+       if (ret == 0)
+               propagate_rate(clk);
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+
+       return ret;
+}
+EXPORT_SYMBOL(clk_set_rate);
+
+int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+       WARN_ONCE(1, "clk_set_parent() not implemented for OMAP1\n");
+
+       return -EINVAL;
+}
+EXPORT_SYMBOL(clk_set_parent);
+
+struct clk *clk_get_parent(struct clk *clk)
+{
+       return clk->parent;
+}
+EXPORT_SYMBOL(clk_get_parent);
+
+/*
+ * OMAP specific clock functions shared between omap1 and omap2
+ */
+
+int __initdata mpurate;
+
+/*
+ * By default we use the rate set by the bootloader.
+ * You can override this with mpurate= cmdline option.
+ */
+static int __init omap_clk_setup(char *str)
+{
+       get_option(&str, &mpurate);
+
+       if (!mpurate)
+               return 1;
+
+       if (mpurate < 1000)
+               mpurate *= 1000000;
+
+       return 1;
+}
+__setup("mpurate=", omap_clk_setup);
+
+/* Used for clocks that always have same value as the parent clock */
+unsigned long followparent_recalc(struct clk *clk)
+{
+       return clk->parent->rate;
+}
+
+/*
+ * Used for clocks that have the same value as the parent clock,
+ * divided by some factor
+ */
+unsigned long omap_fixed_divisor_recalc(struct clk *clk)
+{
+       WARN_ON(!clk->fixed_div);
+
+       return clk->parent->rate / clk->fixed_div;
+}
+
+void clk_reparent(struct clk *child, struct clk *parent)
+{
+       list_del_init(&child->sibling);
+       if (parent)
+               list_add(&child->sibling, &parent->children);
+       child->parent = parent;
+
+       /* now do the debugfs renaming to reattach the child
+          to the proper parent */
+}
+
+/* Propagate rate to children */
+void propagate_rate(struct clk *tclk)
+{
+       struct clk *clkp;
+
+       list_for_each_entry(clkp, &tclk->children, sibling) {
+               if (clkp->recalc)
+                       clkp->rate = clkp->recalc(clkp);
+               propagate_rate(clkp);
+       }
+}
+
+static LIST_HEAD(root_clks);
+
+/**
+ * recalculate_root_clocks - recalculate and propagate all root clocks
+ *
+ * Recalculates all root clocks (clocks with no parent), which if the
+ * clock's .recalc is set correctly, should also propagate their rates.
+ * Called at init.
+ */
+void recalculate_root_clocks(void)
+{
+       struct clk *clkp;
+
+       list_for_each_entry(clkp, &root_clks, sibling) {
+               if (clkp->recalc)
+                       clkp->rate = clkp->recalc(clkp);
+               propagate_rate(clkp);
+       }
+}
+
+/**
+ * clk_preinit - initialize any fields in the struct clk before clk init
+ * @clk: struct clk * to initialize
+ *
+ * Initialize any struct clk fields needed before normal clk initialization
+ * can run.  No return value.
+ */
+void clk_preinit(struct clk *clk)
+{
+       INIT_LIST_HEAD(&clk->children);
+}
+
+int clk_register(struct clk *clk)
+{
+       if (clk == NULL || IS_ERR(clk))
+               return -EINVAL;
+
+       /*
+        * trap out already registered clocks
+        */
+       if (clk->node.next || clk->node.prev)
+               return 0;
+
+       mutex_lock(&clocks_mutex);
+       if (clk->parent)
+               list_add(&clk->sibling, &clk->parent->children);
+       else
+               list_add(&clk->sibling, &root_clks);
+
+       list_add(&clk->node, &clocks);
+       if (clk->init)
+               clk->init(clk);
+       mutex_unlock(&clocks_mutex);
+
+       return 0;
+}
+EXPORT_SYMBOL(clk_register);
+
+void clk_unregister(struct clk *clk)
+{
+       if (clk == NULL || IS_ERR(clk))
+               return;
+
+       mutex_lock(&clocks_mutex);
+       list_del(&clk->sibling);
+       list_del(&clk->node);
+       mutex_unlock(&clocks_mutex);
+}
+EXPORT_SYMBOL(clk_unregister);
+
+void clk_enable_init_clocks(void)
+{
+       struct clk *clkp;
+
+       list_for_each_entry(clkp, &clocks, node)
+               if (clkp->flags & ENABLE_ON_INIT)
+                       clk_enable(clkp);
+}
+
+/**
+ * omap_clk_get_by_name - locate OMAP struct clk by its name
+ * @name: name of the struct clk to locate
+ *
+ * Locate an OMAP struct clk by its name.  Assumes that struct clk
+ * names are unique.  Returns NULL if not found or a pointer to the
+ * struct clk if found.
+ */
+struct clk *omap_clk_get_by_name(const char *name)
+{
+       struct clk *c;
+       struct clk *ret = NULL;
+
+       mutex_lock(&clocks_mutex);
+
+       list_for_each_entry(c, &clocks, node) {
+               if (!strcmp(c->name, name)) {
+                       ret = c;
+                       break;
+               }
+       }
+
+       mutex_unlock(&clocks_mutex);
+
+       return ret;
+}
+
+int omap_clk_enable_autoidle_all(void)
+{
+       struct clk *c;
+       unsigned long flags;
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+
+       list_for_each_entry(c, &clocks, node)
+               if (c->ops->allow_idle)
+                       c->ops->allow_idle(c);
+
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+
+       return 0;
+}
+
+int omap_clk_disable_autoidle_all(void)
+{
+       struct clk *c;
+       unsigned long flags;
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+
+       list_for_each_entry(c, &clocks, node)
+               if (c->ops->deny_idle)
+                       c->ops->deny_idle(c);
+
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+
+       return 0;
+}
+
+/*
+ * Low level helpers
+ */
+static int clkll_enable_null(struct clk *clk)
+{
+       return 0;
+}
+
+static void clkll_disable_null(struct clk *clk)
+{
+}
+
+const struct clkops clkops_null = {
+       .enable         = clkll_enable_null,
+       .disable        = clkll_disable_null,
+};
+
+/*
+ * Dummy clock
+ *
+ * Used for clock aliases that are needed on some OMAPs, but not others
+ */
+struct clk dummy_ck = {
+       .name   = "dummy",
+       .ops    = &clkops_null,
+};
+
+/*
+ *
+ */
+
+#ifdef CONFIG_OMAP_RESET_CLOCKS
+/*
+ * Disable any unused clocks left on by the bootloader
+ */
+static int __init clk_disable_unused(void)
+{
+       struct clk *ck;
+       unsigned long flags;
+
+       pr_info("clock: disabling unused clocks to save power\n");
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+       list_for_each_entry(ck, &clocks, node) {
+               if (ck->ops == &clkops_null)
+                       continue;
+
+               if (ck->usecount > 0 || !ck->enable_reg)
+                       continue;
+
+               omap1_clk_disable_unused(ck);
+       }
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+
+       return 0;
+}
+late_initcall(clk_disable_unused);
+late_initcall(omap_clk_enable_autoidle_all);
+#endif
+
+#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
+/*
+ *     debugfs support to trace clock tree hierarchy and attributes
+ */
+
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
+
+static struct dentry *clk_debugfs_root;
+
+static int clk_dbg_show_summary(struct seq_file *s, void *unused)
+{
+       struct clk *c;
+       struct clk *pa;
+
+       mutex_lock(&clocks_mutex);
+       seq_printf(s, "%-30s %-30s %-10s %s\n",
+                  "clock-name", "parent-name", "rate", "use-count");
+
+       list_for_each_entry(c, &clocks, node) {
+               pa = c->parent;
+               seq_printf(s, "%-30s %-30s %-10lu %d\n",
+                          c->name, pa ? pa->name : "none", c->rate,
+                          c->usecount);
+       }
+       mutex_unlock(&clocks_mutex);
+
+       return 0;
+}
+
+static int clk_dbg_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, clk_dbg_show_summary, inode->i_private);
+}
+
+static const struct file_operations debug_clock_fops = {
+       .open           = clk_dbg_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = single_release,
+};
+
+static int clk_debugfs_register_one(struct clk *c)
+{
+       int err;
+       struct dentry *d;
+       struct clk *pa = c->parent;
+
+       d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root);
+       if (!d)
+               return -ENOMEM;
+       c->dent = d;
+
+       d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usecount);
+       if (!d) {
+               err = -ENOMEM;
+               goto err_out;
+       }
+       d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
+       if (!d) {
+               err = -ENOMEM;
+               goto err_out;
+       }
+       d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
+       if (!d) {
+               err = -ENOMEM;
+               goto err_out;
+       }
+       return 0;
+
+err_out:
+       debugfs_remove_recursive(c->dent);
+       return err;
+}
+
+static int clk_debugfs_register(struct clk *c)
+{
+       int err;
+       struct clk *pa = c->parent;
+
+       if (pa && !pa->dent) {
+               err = clk_debugfs_register(pa);
+               if (err)
+                       return err;
+       }
+
+       if (!c->dent) {
+               err = clk_debugfs_register_one(c);
+               if (err)
+                       return err;
+       }
+       return 0;
+}
+
+static int __init clk_debugfs_init(void)
+{
+       struct clk *c;
+       struct dentry *d;
+       int err;
+
+       d = debugfs_create_dir("clock", NULL);
+       if (!d)
+               return -ENOMEM;
+       clk_debugfs_root = d;
+
+       list_for_each_entry(c, &clocks, node) {
+               err = clk_debugfs_register(c);
+               if (err)
+                       goto err_out;
+       }
+
+       d = debugfs_create_file("summary", S_IRUGO,
+               d, NULL, &debug_clock_fops);
+       if (!d)
+               return -ENOMEM;
+
+       return 0;
+err_out:
+       debugfs_remove_recursive(clk_debugfs_root);
+       return err;
+}
+late_initcall(clk_debugfs_init);
+
+#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
index 3d04f4f67676280a591f7bbcfb003c426fdba2dc..1e4918a3a5ee61a9509491be3ca6ed6cf2dad66a 100644 (file)
 #define __ARCH_ARM_MACH_OMAP1_CLOCK_H
 
 #include <linux/clk.h>
+#include <linux/list.h>
 
-#include <plat/clock.h>
+#include <linux/clkdev.h>
+
+struct module;
+struct clk;
+
+struct omap_clk {
+       u16                             cpu;
+       struct clk_lookup               lk;
+};
+
+#define CLK(dev, con, ck, cp)          \
+       {                               \
+                .cpu = cp,             \
+               .lk = {                 \
+                       .dev_id = dev,  \
+                       .con_id = con,  \
+                       .clk = ck,      \
+               },                      \
+       }
+
+/* Platform flags for the clkdev-OMAP integration code */
+#define CK_310         (1 << 0)
+#define CK_7XX         (1 << 1)        /* 7xx, 850 */
+#define CK_1510                (1 << 2)
+#define CK_16XX                (1 << 3)        /* 16xx, 17xx, 5912 */
+#define CK_1710                (1 << 4)        /* 1710 extra for rate selection */
+
+
+/* Temporary, needed during the common clock framework conversion */
+#define __clk_get_name(clk)    (clk->name)
+#define __clk_get_parent(clk)  (clk->parent)
+#define __clk_get_rate(clk)    (clk->rate)
+
+/**
+ * struct clkops - some clock function pointers
+ * @enable: fn ptr that enables the current clock in hardware
+ * @disable: fn ptr that enables the current clock in hardware
+ * @find_idlest: function returning the IDLEST register for the clock's IP blk
+ * @find_companion: function returning the "companion" clk reg for the clock
+ * @allow_idle: fn ptr that enables autoidle for the current clock in hardware
+ * @deny_idle: fn ptr that disables autoidle for the current clock in hardware
+ *
+ * A "companion" clk is an accompanying clock to the one being queried
+ * that must be enabled for the IP module connected to the clock to
+ * become accessible by the hardware.  Neither @find_idlest nor
+ * @find_companion should be needed; that information is IP
+ * block-specific; the hwmod code has been created to handle this, but
+ * until hwmod data is ready and drivers have been converted to use PM
+ * runtime calls in place of clk_enable()/clk_disable(), @find_idlest and
+ * @find_companion must, unfortunately, remain.
+ */
+struct clkops {
+       int                     (*enable)(struct clk *);
+       void                    (*disable)(struct clk *);
+       void                    (*find_idlest)(struct clk *, void __iomem **,
+                                              u8 *, u8 *);
+       void                    (*find_companion)(struct clk *, void __iomem **,
+                                                 u8 *);
+       void                    (*allow_idle)(struct clk *);
+       void                    (*deny_idle)(struct clk *);
+};
+
+/*
+ * struct clk.flags possibilities
+ *
+ * XXX document the rest of the clock flags here
+ *
+ * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL
+ *     bits share the same register.  This flag allows the
+ *     omap4_dpllmx*() code to determine which GATE_CTRL bit field
+ *     should be used.  This is a temporary solution - a better approach
+ *     would be to associate clock type-specific data with the clock,
+ *     similar to the struct dpll_data approach.
+ */
+#define ENABLE_REG_32BIT       (1 << 0)        /* Use 32-bit access */
+#define CLOCK_IDLE_CONTROL     (1 << 1)
+#define CLOCK_NO_IDLE_PARENT   (1 << 2)
+#define ENABLE_ON_INIT         (1 << 3)        /* Enable upon framework init */
+#define INVERT_ENABLE          (1 << 4)        /* 0 enables, 1 disables */
+#define CLOCK_CLKOUTX2         (1 << 5)
+
+/**
+ * struct clk - OMAP struct clk
+ * @node: list_head connecting this clock into the full clock list
+ * @ops: struct clkops * for this clock
+ * @name: the name of the clock in the hardware (used in hwmod data and debug)
+ * @parent: pointer to this clock's parent struct clk
+ * @children: list_head connecting to the child clks' @sibling list_heads
+ * @sibling: list_head connecting this clk to its parent clk's @children
+ * @rate: current clock rate
+ * @enable_reg: register to write to enable the clock (see @enable_bit)
+ * @recalc: fn ptr that returns the clock's current rate
+ * @set_rate: fn ptr that can change the clock's current rate
+ * @round_rate: fn ptr that can round the clock's current rate
+ * @init: fn ptr to do clock-specific initialization
+ * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
+ * @usecount: number of users that have requested this clock to be enabled
+ * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div
+ * @flags: see "struct clk.flags possibilities" above
+ * @rate_offset: bitshift for rate selection bitfield (OMAP1 only)
+ * @src_offset: bitshift for source selection bitfield (OMAP1 only)
+ *
+ * XXX @rate_offset, @src_offset should probably be removed and OMAP1
+ * clock code converted to use clksel.
+ *
+ * XXX @usecount is poorly named.  It should be "enable_count" or
+ * something similar.  "users" in the description refers to kernel
+ * code (core code or drivers) that have called clk_enable() and not
+ * yet called clk_disable(); the usecount of parent clocks is also
+ * incremented by the clock code when clk_enable() is called on child
+ * clocks and decremented by the clock code when clk_disable() is
+ * called on child clocks.
+ *
+ * XXX @clkdm, @usecount, @children, @sibling should be marked for
+ * internal use only.
+ *
+ * @children and @sibling are used to optimize parent-to-child clock
+ * tree traversals.  (child-to-parent traversals use @parent.)
+ *
+ * XXX The notion of the clock's current rate probably needs to be
+ * separated from the clock's target rate.
+ */
+struct clk {
+       struct list_head        node;
+       const struct clkops     *ops;
+       const char              *name;
+       struct clk              *parent;
+       struct list_head        children;
+       struct list_head        sibling;        /* node for children */
+       unsigned long           rate;
+       void __iomem            *enable_reg;
+       unsigned long           (*recalc)(struct clk *);
+       int                     (*set_rate)(struct clk *, unsigned long);
+       long                    (*round_rate)(struct clk *, unsigned long);
+       void                    (*init)(struct clk *);
+       u8                      enable_bit;
+       s8                      usecount;
+       u8                      fixed_div;
+       u8                      flags;
+       u8                      rate_offset;
+       u8                      src_offset;
+#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
+       struct dentry           *dent;  /* For visible tree hierarchy */
+#endif
+};
+
+struct clk_functions {
+       int             (*clk_enable)(struct clk *clk);
+       void            (*clk_disable)(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);
+       void            (*clk_allow_idle)(struct clk *clk);
+       void            (*clk_deny_idle)(struct clk *clk);
+       void            (*clk_disable_unused)(struct clk *clk);
+};
+
+extern int mpurate;
+
+extern int clk_init(struct clk_functions *custom_clocks);
+extern void clk_preinit(struct clk *clk);
+extern int clk_register(struct clk *clk);
+extern void clk_reparent(struct clk *child, struct clk *parent);
+extern void clk_unregister(struct clk *clk);
+extern void propagate_rate(struct clk *clk);
+extern void recalculate_root_clocks(void);
+extern unsigned long followparent_recalc(struct clk *clk);
+extern void clk_enable_init_clocks(void);
+unsigned long omap_fixed_divisor_recalc(struct clk *clk);
+extern struct clk *omap_clk_get_by_name(const char *name);
+extern int omap_clk_enable_autoidle_all(void);
+extern int omap_clk_disable_autoidle_all(void);
+
+extern const struct clkops clkops_null;
+
+extern struct clk dummy_ck;
 
 int omap1_clk_init(void);
 void omap1_clk_late_init(void);
index 9b45f4b0ee22833897d3dfa27d636c26fe5b5fcf..cb7c6ae2e3fc66f4a0744bf7930e7e1cd635ee87 100644 (file)
 
 #include <asm/mach-types.h>  /* for machine_is_* */
 
-#include <plat/clock.h>
-#include <plat/cpu.h>
-#include <plat/clkdev_omap.h>
-#include <plat/sram.h> /* for omap_sram_reprogram_clock() */
+#include "soc.h"
 
 #include <mach/hardware.h>
 #include <mach/usb.h>   /* for OTG_BASE */
 
 #include "iomap.h"
 #include "clock.h"
+#include "sram.h"
 
 /* Some ARM_IDLECT1 bit shifts - used in struct arm_idlect1_clk */
 #define IDL_CLKOUT_ARM_SHIFT                   12
@@ -765,14 +763,6 @@ static struct omap_clk omap_clks[] = {
  * init
  */
 
-static struct clk_functions omap1_clk_functions = {
-       .clk_enable             = omap1_clk_enable,
-       .clk_disable            = omap1_clk_disable,
-       .clk_round_rate         = omap1_clk_round_rate,
-       .clk_set_rate           = omap1_clk_set_rate,
-       .clk_disable_unused     = omap1_clk_disable_unused,
-};
-
 static void __init omap1_show_rates(void)
 {
        pr_notice("Clocking rate (xtal/DPLL1/MPU): %ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
@@ -803,8 +793,6 @@ int __init omap1_clk_init(void)
        if (!cpu_is_omap15xx())
                omap_writew(0, SOFT_REQ_REG2);
 
-       clk_init(&omap1_clk_functions);
-
        /* By default all idlect1 clocks are allowed to idle */
        arm_idlect1_mask = ~0;
 
index c2552b24f9f295381b36132cc4d59b850ade8d3f..b53e0854422f13a37435eb16c24c75cad7bf03bc 100644 (file)
 #ifndef __ARCH_ARM_MACH_OMAP1_COMMON_H
 #define __ARCH_ARM_MACH_OMAP1_COMMON_H
 
-#include <plat/common.h>
 #include <linux/mtd/mtd.h>
+#include <linux/i2c-omap.h>
+
+#include <plat/i2c.h>
 
 #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
 void omap7xx_map_io(void);
@@ -38,6 +40,7 @@ static inline void omap7xx_map_io(void)
 #endif
 
 #ifdef CONFIG_ARCH_OMAP15XX
+void omap1510_fpga_init_irq(void);
 void omap15xx_map_io(void);
 #else
 static inline void omap15xx_map_io(void)
@@ -90,4 +93,6 @@ extern int ocpi_enable(void);
 static inline int ocpi_enable(void) { return 0; }
 #endif
 
+extern u32 omap1_get_reset_sources(void);
+
 #endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */
index d3fec92c54cb5d5d852974c9e9c3ec7ad58e72bc..0af635205e8a75d4500c9ee25617ab614f51fd11 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/spi/spi.h>
 
+#include <linux/platform_data/omap-wd-timer.h>
+
 #include <asm/mach/map.h>
 
-#include <plat/tc.h>
+#include <mach/tc.h>
 #include <mach/mux.h>
-#include <plat/dma.h>
-#include <plat/mmc.h>
 
 #include <mach/omap7xx.h>
 #include <mach/camera.h>
@@ -30,6 +30,9 @@
 
 #include "common.h"
 #include "clock.h"
+#include "dma.h"
+#include "mmc.h"
+#include "sram.h"
 
 #if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
 
@@ -175,6 +178,13 @@ static int __init omap_mmc_add(const char *name, int id, unsigned long base,
        res[3].name = "tx";
        res[3].flags = IORESOURCE_DMA;
 
+       if (cpu_is_omap7xx())
+               data->slots[0].features = MMC_OMAP7XX;
+       if (cpu_is_omap15xx())
+               data->slots[0].features = MMC_OMAP15XX;
+       if (cpu_is_omap16xx())
+               data->slots[0].features = MMC_OMAP16XX;
+
        ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
        if (ret == 0)
                ret = platform_device_add_data(pdev, data, sizeof(*data));
@@ -439,18 +449,31 @@ static struct resource wdt_resources[] = {
 };
 
 static struct platform_device omap_wdt_device = {
-       .name      = "omap_wdt",
-       .id          = -1,
+       .name           = "omap_wdt",
+       .id             = -1,
        .num_resources  = ARRAY_SIZE(wdt_resources),
        .resource       = wdt_resources,
 };
 
 static int __init omap_init_wdt(void)
 {
+       struct omap_wd_timer_platform_data pdata;
+       int ret;
+
        if (!cpu_is_omap16xx())
                return -ENODEV;
 
-       return platform_device_register(&omap_wdt_device);
+       pdata.read_reset_sources = omap1_get_reset_sources;
+
+       ret = platform_device_register(&omap_wdt_device);
+       if (!ret) {
+               ret = platform_device_add_data(&omap_wdt_device, &pdata,
+                                              sizeof(pdata));
+               if (ret)
+                       platform_device_del(&omap_wdt_device);
+       }
+
+       return ret;
 }
 subsys_initcall(omap_init_wdt);
 #endif
index 29007fef84cd8d884aaddd1c295897afa0c824ed..978aed85d3283f5983430b6accca96c5d614c637 100644 (file)
 #include <linux/device.h>
 #include <linux/io.h>
 
-#include <plat/dma.h>
-#include <plat/tc.h>
+#include <plat-omap/dma-omap.h>
+#include <mach/tc.h>
 
 #include <mach/irqs.h>
 
+#include "dma.h"
+
 #define OMAP1_DMA_BASE                 (0xfffed800)
 #define OMAP1_LOGICAL_DMA_CH_COUNT     17
 #define OMAP1_DMA_STRIDE               0x40
@@ -319,6 +321,9 @@ static int __init omap1_system_dma_init(void)
                d->dev_caps = ENABLE_1510_MODE;
        enable_1510_mode = d->dev_caps & ENABLE_1510_MODE;
 
+       if (cpu_is_omap16xx())
+               d->dev_caps = ENABLE_16XX_MODE;
+
        d->dev_caps             |= SRC_PORT;
        d->dev_caps             |= DST_PORT;
        d->dev_caps             |= SRC_INDEX;
diff --git a/arch/arm/mach-omap1/dma.h b/arch/arm/mach-omap1/dma.h
new file mode 100644 (file)
index 0000000..da6345d
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ *  OMAP1 DMA channel definitions
+ *
+ * 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
+ */
+
+#ifndef __OMAP1_DMA_CHANNEL_H
+#define __OMAP1_DMA_CHANNEL_H
+
+/* DMA channels for omap1 */
+#define OMAP_DMA_NO_DEVICE             0
+#define OMAP_DMA_MCSI1_TX              1
+#define OMAP_DMA_MCSI1_RX              2
+#define OMAP_DMA_I2C_RX                        3
+#define OMAP_DMA_I2C_TX                        4
+#define OMAP_DMA_EXT_NDMA_REQ          5
+#define OMAP_DMA_EXT_NDMA_REQ2         6
+#define OMAP_DMA_UWIRE_TX              7
+#define OMAP_DMA_MCBSP1_TX             8
+#define OMAP_DMA_MCBSP1_RX             9
+#define OMAP_DMA_MCBSP3_TX             10
+#define OMAP_DMA_MCBSP3_RX             11
+#define OMAP_DMA_UART1_TX              12
+#define OMAP_DMA_UART1_RX              13
+#define OMAP_DMA_UART2_TX              14
+#define OMAP_DMA_UART2_RX              15
+#define OMAP_DMA_MCBSP2_TX             16
+#define OMAP_DMA_MCBSP2_RX             17
+#define OMAP_DMA_UART3_TX              18
+#define OMAP_DMA_UART3_RX              19
+#define OMAP_DMA_CAMERA_IF_RX          20
+#define OMAP_DMA_MMC_TX                        21
+#define OMAP_DMA_MMC_RX                        22
+#define OMAP_DMA_NAND                  23
+#define OMAP_DMA_IRQ_LCD_LINE          24
+#define OMAP_DMA_MEMORY_STICK          25
+#define OMAP_DMA_USB_W2FC_RX0          26
+#define OMAP_DMA_USB_W2FC_RX1          27
+#define OMAP_DMA_USB_W2FC_RX2          28
+#define OMAP_DMA_USB_W2FC_TX0          29
+#define OMAP_DMA_USB_W2FC_TX1          30
+#define OMAP_DMA_USB_W2FC_TX2          31
+
+/* These are only for 1610 */
+#define OMAP_DMA_CRYPTO_DES_IN         32
+#define OMAP_DMA_SPI_TX                        33
+#define OMAP_DMA_SPI_RX                        34
+#define OMAP_DMA_CRYPTO_HASH           35
+#define OMAP_DMA_CCP_ATTN              36
+#define OMAP_DMA_CCP_FIFO_NOT_EMPTY    37
+#define OMAP_DMA_CMT_APE_TX_CHAN_0     38
+#define OMAP_DMA_CMT_APE_RV_CHAN_0     39
+#define OMAP_DMA_CMT_APE_TX_CHAN_1     40
+#define OMAP_DMA_CMT_APE_RV_CHAN_1     41
+#define OMAP_DMA_CMT_APE_TX_CHAN_2     42
+#define OMAP_DMA_CMT_APE_RV_CHAN_2     43
+#define OMAP_DMA_CMT_APE_TX_CHAN_3     44
+#define OMAP_DMA_CMT_APE_RV_CHAN_3     45
+#define OMAP_DMA_CMT_APE_TX_CHAN_4     46
+#define OMAP_DMA_CMT_APE_RV_CHAN_4     47
+#define OMAP_DMA_CMT_APE_TX_CHAN_5     48
+#define OMAP_DMA_CMT_APE_RV_CHAN_5     49
+#define OMAP_DMA_CMT_APE_TX_CHAN_6     50
+#define OMAP_DMA_CMT_APE_RV_CHAN_6     51
+#define OMAP_DMA_CMT_APE_TX_CHAN_7     52
+#define OMAP_DMA_CMT_APE_RV_CHAN_7     53
+#define OMAP_DMA_MMC2_TX               54
+#define OMAP_DMA_MMC2_RX               55
+#define OMAP_DMA_CRYPTO_DES_OUT                56
+
+#endif /* __OMAP1_DMA_CHANNEL_H */
index 73ae6169aa4a01829654f0c92f1958d1629cb432..b3fb531af94e7767d556a5730d5b62c171c22b63 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 
-#include <plat/tc.h>
+#include <mach/tc.h>
 #include <mach/flash.h>
 
 #include <mach/hardware.h>
index 29ec50fc688dcedc44af04b40d8dd998c8d8e088..8bd71b2d0967ced750781e1a9b9b25cbb520044f 100644 (file)
 #include <asm/irq.h>
 #include <asm/mach/irq.h>
 
-#include <plat/fpga.h>
-
 #include <mach/hardware.h>
 
 #include "iomap.h"
+#include "common.h"
+#include "fpga.h"
 
 static void fpga_mask_irq(struct irq_data *d)
 {
diff --git a/arch/arm/mach-omap1/fpga.h b/arch/arm/mach-omap1/fpga.h
new file mode 100644 (file)
index 0000000..4b4307a
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Interrupt handler for OMAP-1510 FPGA
+ *
+ * Copyright (C) 2001 RidgeRun, Inc.
+ * Author: Greg Lonnon <glonnon@ridgerun.com>
+ *
+ * Copyright (C) 2002 MontaVista Software, Inc.
+ *
+ * Separated FPGA interrupts from innovator1510.c and cleaned up for 2.6
+ * Copyright (C) 2004 Nokia Corporation by Tony Lindrgen <tony@atomide.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 __ASM_ARCH_OMAP_FPGA_H
+#define __ASM_ARCH_OMAP_FPGA_H
+
+/*
+ * ---------------------------------------------------------------------------
+ *  H2/P2 Debug board FPGA
+ * ---------------------------------------------------------------------------
+ */
+/* maps in the FPGA registers and the ETHR registers */
+#define H2P2_DBG_FPGA_BASE             0xE8000000              /* VA */
+#define H2P2_DBG_FPGA_SIZE             SZ_4K                   /* SIZE */
+#define H2P2_DBG_FPGA_START            0x04000000              /* PA */
+
+#define H2P2_DBG_FPGA_ETHR_START       (H2P2_DBG_FPGA_START + 0x300)
+#define H2P2_DBG_FPGA_FPGA_REV         IOMEM(H2P2_DBG_FPGA_BASE + 0x10)        /* FPGA Revision */
+#define H2P2_DBG_FPGA_BOARD_REV                IOMEM(H2P2_DBG_FPGA_BASE + 0x12)        /* Board Revision */
+#define H2P2_DBG_FPGA_GPIO             IOMEM(H2P2_DBG_FPGA_BASE + 0x14)        /* GPIO outputs */
+#define H2P2_DBG_FPGA_LEDS             IOMEM(H2P2_DBG_FPGA_BASE + 0x16)        /* LEDs outputs */
+#define H2P2_DBG_FPGA_MISC_INPUTS      IOMEM(H2P2_DBG_FPGA_BASE + 0x18)        /* Misc inputs */
+#define H2P2_DBG_FPGA_LAN_STATUS       IOMEM(H2P2_DBG_FPGA_BASE + 0x1A)        /* LAN Status line */
+#define H2P2_DBG_FPGA_LAN_RESET                IOMEM(H2P2_DBG_FPGA_BASE + 0x1C)        /* LAN Reset line */
+
+/* LEDs definition on debug board (16 LEDs, all physically green) */
+#define H2P2_DBG_FPGA_LED_GREEN                (1 << 15)
+#define H2P2_DBG_FPGA_LED_AMBER                (1 << 14)
+#define H2P2_DBG_FPGA_LED_RED          (1 << 13)
+#define H2P2_DBG_FPGA_LED_BLUE         (1 << 12)
+/*  cpu0 load-meter LEDs */
+#define H2P2_DBG_FPGA_LOAD_METER       (1 << 0)        // A bit of fun on our board ...
+#define H2P2_DBG_FPGA_LOAD_METER_SIZE  11
+#define H2P2_DBG_FPGA_LOAD_METER_MASK  ((1 << H2P2_DBG_FPGA_LOAD_METER_SIZE) - 1)
+
+#define H2P2_DBG_FPGA_P2_LED_TIMER             (1 << 0)
+#define H2P2_DBG_FPGA_P2_LED_IDLE              (1 << 1)
+
+#endif
index 98e6f39224a4ee42449b847f997889b0842cb4c6..02b3eb2e201c2fe63670a5b6f64c3a8161eb06fd 100644 (file)
@@ -19,6 +19,8 @@
 #include <linux/gpio.h>
 #include <linux/platform_data/gpio-omap.h>
 
+#include <mach/irqs.h>
+
 #define OMAP1_MPUIO_VBASE              OMAP1_MPUIO_BASE
 #define OMAP1510_GPIO_BASE             0xFFFCE000
 
index 33f419236b1725e4f277837754ce353336cc6384..b9952a258d8201aac40880c8ac01bc1cabdba008 100644 (file)
@@ -19,6 +19,8 @@
 #include <linux/gpio.h>
 #include <linux/platform_data/gpio-omap.h>
 
+#include <mach/irqs.h>
+
 #define OMAP1610_GPIO1_BASE            0xfffbe400
 #define OMAP1610_GPIO2_BASE            0xfffbec00
 #define OMAP1610_GPIO3_BASE            0xfffbb400
index 958ce9acee954c871fd67bcef67763c5a8021cce..f5819b2b7cbec631c7012a5f64bb88b12ed3ab2b 100644 (file)
@@ -19,6 +19,8 @@
 #include <linux/gpio.h>
 #include <linux/platform_data/gpio-omap.h>
 
+#include <mach/irqs.h>
+
 #define OMAP7XX_GPIO1_BASE             0xfffbc000
 #define OMAP7XX_GPIO2_BASE             0xfffbc800
 #define OMAP7XX_GPIO3_BASE             0xfffbd000
index a0551a6d7451efe3b851e0abb961c74be6038c35..faca808cb3d9565828123fe9ec4e94f16f2f81fe 100644 (file)
  *
  */
 
-#include <plat/i2c.h>
+#include <linux/i2c-omap.h>
 #include <mach/mux.h>
-#include <plat/cpu.h>
+#include "soc.h"
+
+#include <plat/i2c.h>
+
+#define OMAP_I2C_SIZE          0x3f
+#define OMAP1_I2C_BASE         0xfffb3800
+#define OMAP1_INT_I2C          (32 + 4)
+
+static const char name[] = "omap_i2c";
 
-void __init omap1_i2c_mux_pins(int bus_id)
+static struct resource i2c_resources[2] = {
+};
+
+static struct platform_device omap_i2c_devices[1] = {
+};
+
+static void __init omap1_i2c_mux_pins(int bus_id)
 {
        if (cpu_is_omap7xx()) {
                omap_cfg_reg(I2C_7XX_SDA);
@@ -33,3 +47,47 @@ void __init omap1_i2c_mux_pins(int bus_id)
                omap_cfg_reg(I2C_SCL);
        }
 }
+
+int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *pdata,
+                               int bus_id)
+{
+       struct platform_device *pdev;
+       struct resource *res;
+
+       if (bus_id > 1)
+               return -EINVAL;
+
+       omap1_i2c_mux_pins(bus_id);
+
+       pdev = &omap_i2c_devices[bus_id - 1];
+       pdev->id = bus_id;
+       pdev->name = name;
+       pdev->num_resources = ARRAY_SIZE(i2c_resources);
+       res = i2c_resources;
+       res[0].start = OMAP1_I2C_BASE;
+       res[0].end = res[0].start + OMAP_I2C_SIZE;
+       res[0].flags = IORESOURCE_MEM;
+       res[1].start = OMAP1_INT_I2C;
+       res[1].flags = IORESOURCE_IRQ;
+       pdev->resource = res;
+
+       /* all OMAP1 have IP version 1 register set */
+       pdata->rev = OMAP_I2C_IP_VERSION_1;
+
+       /* all OMAP1 I2C are implemented like this */
+       pdata->flags = OMAP_I2C_FLAG_NO_FIFO |
+                      OMAP_I2C_FLAG_SIMPLE_CLOCK |
+                      OMAP_I2C_FLAG_16BIT_DATA_REG |
+                      OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK;
+
+       /* how the cpu bus is wired up differs for 7xx only */
+
+       if (cpu_is_omap7xx())
+               pdata->flags |= OMAP_I2C_FLAG_BUS_SHIFT_1;
+       else
+               pdata->flags |= OMAP_I2C_FLAG_BUS_SHIFT_2;
+
+       pdev->dev.platform_data = pdata;
+
+       return platform_device_register(pdev);
+}
index a1b846aacdaf15419d6ce45a55953fadf10c2967..52de382fc8047148f272dd57d7dd01354ec33801 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/io.h>
 #include <asm/system_info.h>
 
-#include <plat/cpu.h>
+#include "soc.h"
 
 #include <mach/hardware.h>
 
index 2b36a281dc842a55757459860164369b763edd28..5c1a26c9f49059c646d54ec60a63dc79ef8dab17 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <linux/serial_reg.h>
 
-#include <plat/serial.h>
+#include "serial.h"
 
                .pushsection .data
 omap_uart_phys:        .word   0x0
index 88f08cab17179d375f49169918305baffd6b32f0..78a8c6c2476460eec32da12eaedfe997d4a3699f 100644 (file)
@@ -13,8 +13,6 @@
 #include <mach/hardware.h>
 #include <mach/irqs.h>
 
-#include "../../iomap.h"
-
                .macro  get_irqnr_preamble, base, tmp
                .endm
 
diff --git a/arch/arm/mach-omap1/include/mach/gpio.h b/arch/arm/mach-omap1/include/mach/gpio.h
deleted file mode 100644 (file)
index ebf86c0..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/*
- * arch/arm/mach-omap1/include/mach/gpio.h
- */
index 84248d250adb8eeda35da1093eb7a19f70cfb6f0..5875a5098d35ff43211c8a54730998fcc92d1119 100644 (file)
@@ -39,7 +39,7 @@
 #include <asm/sizes.h>
 #ifndef __ASSEMBLER__
 #include <asm/types.h>
-#include <plat/cpu.h>
+#include <mach/soc.h>
 
 /*
  * NOTE: Please use ioremap + __raw_read/write where possible instead of these
@@ -51,7 +51,7 @@ extern void omap_writeb(u8 v, u32 pa);
 extern void omap_writew(u16 v, u32 pa);
 extern void omap_writel(u32 v, u32 pa);
 
-#include <plat/tc.h>
+#include <mach/tc.h>
 
 /* Almost all documentation for chip and board memory maps assumes
  * BM is clear.  Most devel boards have a switch to control booting
@@ -72,7 +72,10 @@ static inline u32 omap_cs3_phys(void)
 
 #endif /* ifndef __ASSEMBLER__ */
 
-#include <plat/serial.h>
+#define OMAP1_IO_OFFSET                0x01000000      /* Virtual IO = 0xfefb0000 */
+#define OMAP1_IO_ADDRESS(pa)   IOMEM((pa) - OMAP1_IO_OFFSET)
+
+#include <mach/serial.h>
 
 /*
  * ---------------------------------------------------------------------------
index 901082def9bd1ef72de49654a141e50724c7d22e..3c2530523111029df93a1e5b472fdd1c2ad3560d 100644 (file)
@@ -19,7 +19,7 @@
  * because of the strncmp().
  */
 #if defined(CONFIG_ARCH_OMAP15XX) && !defined(__ASSEMBLER__)
-#include <plat/cpu.h>
+#include <mach/soc.h>
 
 /*
  * OMAP-1510 Local Bus address offset
index 8fe05d6137c0abfaf2a7d8f1c2ec9125e5ff6087..3d235244bf5c401e7840ea9509e96da10f78cf25 100644 (file)
 
 #define OMAP1510_DSP_MMU_BASE  (0xfffed200)
 
+/*
+ * ---------------------------------------------------------------------------
+ *  OMAP-1510 FPGA
+ * ---------------------------------------------------------------------------
+ */
+#define OMAP1510_FPGA_BASE             0xE8000000              /* VA */
+#define OMAP1510_FPGA_SIZE             SZ_4K
+#define OMAP1510_FPGA_START            0x08000000              /* PA */
+
+/* Revision */
+#define OMAP1510_FPGA_REV_LOW                  IOMEM(OMAP1510_FPGA_BASE + 0x0)
+#define OMAP1510_FPGA_REV_HIGH                 IOMEM(OMAP1510_FPGA_BASE + 0x1)
+#define OMAP1510_FPGA_LCD_PANEL_CONTROL                IOMEM(OMAP1510_FPGA_BASE + 0x2)
+#define OMAP1510_FPGA_LED_DIGIT                        IOMEM(OMAP1510_FPGA_BASE + 0x3)
+#define INNOVATOR_FPGA_HID_SPI                 IOMEM(OMAP1510_FPGA_BASE + 0x4)
+#define OMAP1510_FPGA_POWER                    IOMEM(OMAP1510_FPGA_BASE + 0x5)
+
+/* Interrupt status */
+#define OMAP1510_FPGA_ISR_LO                   IOMEM(OMAP1510_FPGA_BASE + 0x6)
+#define OMAP1510_FPGA_ISR_HI                   IOMEM(OMAP1510_FPGA_BASE + 0x7)
+
+/* Interrupt mask */
+#define OMAP1510_FPGA_IMR_LO                   IOMEM(OMAP1510_FPGA_BASE + 0x8)
+#define OMAP1510_FPGA_IMR_HI                   IOMEM(OMAP1510_FPGA_BASE + 0x9)
+
+/* Reset registers */
+#define OMAP1510_FPGA_HOST_RESET               IOMEM(OMAP1510_FPGA_BASE + 0xa)
+#define OMAP1510_FPGA_RST                      IOMEM(OMAP1510_FPGA_BASE + 0xb)
+
+#define OMAP1510_FPGA_AUDIO                    IOMEM(OMAP1510_FPGA_BASE + 0xc)
+#define OMAP1510_FPGA_DIP                      IOMEM(OMAP1510_FPGA_BASE + 0xe)
+#define OMAP1510_FPGA_FPGA_IO                  IOMEM(OMAP1510_FPGA_BASE + 0xf)
+#define OMAP1510_FPGA_UART1                    IOMEM(OMAP1510_FPGA_BASE + 0x14)
+#define OMAP1510_FPGA_UART2                    IOMEM(OMAP1510_FPGA_BASE + 0x15)
+#define OMAP1510_FPGA_OMAP1510_STATUS          IOMEM(OMAP1510_FPGA_BASE + 0x16)
+#define OMAP1510_FPGA_BOARD_REV                        IOMEM(OMAP1510_FPGA_BASE + 0x18)
+#define INNOVATOR_FPGA_CAM_USB_CONTROL         IOMEM(OMAP1510_FPGA_BASE + 0x20c)
+#define OMAP1510P1_PPT_DATA                    IOMEM(OMAP1510_FPGA_BASE + 0x100)
+#define OMAP1510P1_PPT_STATUS                  IOMEM(OMAP1510_FPGA_BASE + 0x101)
+#define OMAP1510P1_PPT_CONTROL                 IOMEM(OMAP1510_FPGA_BASE + 0x102)
+
+#define OMAP1510_FPGA_TOUCHSCREEN              IOMEM(OMAP1510_FPGA_BASE + 0x204)
+
+#define INNOVATOR_FPGA_INFO                    IOMEM(OMAP1510_FPGA_BASE + 0x205)
+#define INNOVATOR_FPGA_LCD_BRIGHT_LO           IOMEM(OMAP1510_FPGA_BASE + 0x206)
+#define INNOVATOR_FPGA_LCD_BRIGHT_HI           IOMEM(OMAP1510_FPGA_BASE + 0x207)
+#define INNOVATOR_FPGA_LED_GRN_LO              IOMEM(OMAP1510_FPGA_BASE + 0x208)
+#define INNOVATOR_FPGA_LED_GRN_HI              IOMEM(OMAP1510_FPGA_BASE + 0x209)
+#define INNOVATOR_FPGA_LED_RED_LO              IOMEM(OMAP1510_FPGA_BASE + 0x20a)
+#define INNOVATOR_FPGA_LED_RED_HI              IOMEM(OMAP1510_FPGA_BASE + 0x20b)
+#define INNOVATOR_FPGA_EXP_CONTROL             IOMEM(OMAP1510_FPGA_BASE + 0x20d)
+#define INNOVATOR_FPGA_ISR2                    IOMEM(OMAP1510_FPGA_BASE + 0x20e)
+#define INNOVATOR_FPGA_IMR2                    IOMEM(OMAP1510_FPGA_BASE + 0x210)
+
+#define OMAP1510_FPGA_ETHR_START               (OMAP1510_FPGA_START + 0x300)
+
+/*
+ * Power up Giga UART driver, turn on HID clock.
+ * Turn off BT power, since we're not using it and it
+ * draws power.
+ */
+#define OMAP1510_FPGA_RESET_VALUE              0x42
+
+#define OMAP1510_FPGA_PCR_IF_PD0               (1 << 7)
+#define OMAP1510_FPGA_PCR_COM2_EN              (1 << 6)
+#define OMAP1510_FPGA_PCR_COM1_EN              (1 << 5)
+#define OMAP1510_FPGA_PCR_EXP_PD0              (1 << 4)
+#define OMAP1510_FPGA_PCR_EXP_PD1              (1 << 3)
+#define OMAP1510_FPGA_PCR_48MHZ_CLK            (1 << 2)
+#define OMAP1510_FPGA_PCR_4MHZ_CLK             (1 << 1)
+#define OMAP1510_FPGA_PCR_RSRVD_BIT0           (1 << 0)
+
+/*
+ * Innovator/OMAP1510 FPGA HID register bit definitions
+ */
+#define OMAP1510_FPGA_HID_SCLK (1<<0)  /* output */
+#define OMAP1510_FPGA_HID_MOSI (1<<1)  /* output */
+#define OMAP1510_FPGA_HID_nSS  (1<<2)  /* output 0/1 chip idle/select */
+#define OMAP1510_FPGA_HID_nHSUS        (1<<3)  /* output 0/1 host active/suspended */
+#define OMAP1510_FPGA_HID_MISO (1<<4)  /* input */
+#define OMAP1510_FPGA_HID_ATN  (1<<5)  /* input  0/1 chip idle/ATN */
+#define OMAP1510_FPGA_HID_rsrvd        (1<<6)
+#define OMAP1510_FPGA_HID_RESETn (1<<7)        /* output - 0/1 USAR reset/run */
+
+/* The FPGA IRQ is cascaded through GPIO_13 */
+#define OMAP1510_INT_FPGA              (IH_GPIO_BASE + 13)
+
+/* IRQ Numbers for interrupts muxed through the FPGA */
+#define OMAP1510_INT_FPGA_ATN          (OMAP_FPGA_IRQ_BASE + 0)
+#define OMAP1510_INT_FPGA_ACK          (OMAP_FPGA_IRQ_BASE + 1)
+#define OMAP1510_INT_FPGA2             (OMAP_FPGA_IRQ_BASE + 2)
+#define OMAP1510_INT_FPGA3             (OMAP_FPGA_IRQ_BASE + 3)
+#define OMAP1510_INT_FPGA4             (OMAP_FPGA_IRQ_BASE + 4)
+#define OMAP1510_INT_FPGA5             (OMAP_FPGA_IRQ_BASE + 5)
+#define OMAP1510_INT_FPGA6             (OMAP_FPGA_IRQ_BASE + 6)
+#define OMAP1510_INT_FPGA7             (OMAP_FPGA_IRQ_BASE + 7)
+#define OMAP1510_INT_FPGA8             (OMAP_FPGA_IRQ_BASE + 8)
+#define OMAP1510_INT_FPGA9             (OMAP_FPGA_IRQ_BASE + 9)
+#define OMAP1510_INT_FPGA10            (OMAP_FPGA_IRQ_BASE + 10)
+#define OMAP1510_INT_FPGA11            (OMAP_FPGA_IRQ_BASE + 11)
+#define OMAP1510_INT_FPGA12            (OMAP_FPGA_IRQ_BASE + 12)
+#define OMAP1510_INT_ETHER             (OMAP_FPGA_IRQ_BASE + 13)
+#define OMAP1510_INT_FPGAUART1         (OMAP_FPGA_IRQ_BASE + 14)
+#define OMAP1510_INT_FPGAUART2         (OMAP_FPGA_IRQ_BASE + 15)
+#define OMAP1510_INT_FPGA_TS           (OMAP_FPGA_IRQ_BASE + 16)
+#define OMAP1510_INT_FPGA17            (OMAP_FPGA_IRQ_BASE + 17)
+#define OMAP1510_INT_FPGA_CAM          (OMAP_FPGA_IRQ_BASE + 18)
+#define OMAP1510_INT_FPGA_RTC_A                (OMAP_FPGA_IRQ_BASE + 19)
+#define OMAP1510_INT_FPGA_RTC_B                (OMAP_FPGA_IRQ_BASE + 20)
+#define OMAP1510_INT_FPGA_CD           (OMAP_FPGA_IRQ_BASE + 21)
+#define OMAP1510_INT_FPGA22            (OMAP_FPGA_IRQ_BASE + 22)
+#define OMAP1510_INT_FPGA23            (OMAP_FPGA_IRQ_BASE + 23)
+
 #endif /*  __ASM_ARCH_OMAP15XX_H */
 
diff --git a/arch/arm/mach-omap1/include/mach/serial.h b/arch/arm/mach-omap1/include/mach/serial.h
new file mode 100644 (file)
index 0000000..2ce6a2d
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2009 Texas Instruments
+ * Added OMAP4 support- Santosh Shilimkar <santosh.shilimkar@ti.com>
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __ASM_ARCH_SERIAL_H
+#define __ASM_ARCH_SERIAL_H
+
+#include <linux/init.h>
+
+/*
+ * Memory entry used for the DEBUG_LL UART configuration, relative to
+ * start of RAM. See also uncompress.h and debug-macro.S.
+ *
+ * Note that using a memory location for storing the UART configuration
+ * has at least two limitations:
+ *
+ * 1. Kernel uncompress code cannot overlap OMAP_UART_INFO as the
+ *    uncompress code could then partially overwrite itself
+ * 2. We assume printascii is called at least once before paging_init,
+ *    and addruart has a chance to read OMAP_UART_INFO
+ */
+#define OMAP_UART_INFO_OFS     0x3ffc
+
+/* OMAP1 serial ports */
+#define OMAP1_UART1_BASE       0xfffb0000
+#define OMAP1_UART2_BASE       0xfffb0800
+#define OMAP1_UART3_BASE       0xfffb9800
+
+#define OMAP_PORT_SHIFT                2
+#define OMAP7XX_PORT_SHIFT     0
+
+#define OMAP1510_BASE_BAUD     (12000000/16)
+#define OMAP16XX_BASE_BAUD     (48000000/16)
+
+/*
+ * DEBUG_LL port encoding stored into the UART1 scratchpad register by
+ * decomp_setup in uncompress.h
+ */
+#define OMAP1UART1             11
+#define OMAP1UART2             12
+#define OMAP1UART3             13
+
+#ifndef __ASSEMBLER__
+extern void omap_serial_init(void);
+#endif
+
+#endif
diff --git a/arch/arm/mach-omap1/include/mach/soc.h b/arch/arm/mach-omap1/include/mach/soc.h
new file mode 100644 (file)
index 0000000..6cf9c1c
--- /dev/null
@@ -0,0 +1,229 @@
+/*
+ * OMAP cpu type detection
+ *
+ * Copyright (C) 2004, 2008 Nokia Corporation
+ *
+ * Copyright (C) 2009-11 Texas Instruments.
+ *
+ * Written by Tony Lindgren <tony.lindgren@nokia.com>
+ *
+ * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ASM_ARCH_OMAP_CPU_H
+#define __ASM_ARCH_OMAP_CPU_H
+
+#ifndef __ASSEMBLY__
+
+#include <linux/bitops.h>
+
+/*
+ * Test if multicore OMAP support is needed
+ */
+#undef MULTI_OMAP1
+#undef OMAP_NAME
+
+#ifdef CONFIG_ARCH_OMAP730
+# ifdef OMAP_NAME
+#  undef  MULTI_OMAP1
+#  define MULTI_OMAP1
+# else
+#  define OMAP_NAME omap730
+# endif
+#endif
+#ifdef CONFIG_ARCH_OMAP850
+# ifdef OMAP_NAME
+#  undef  MULTI_OMAP1
+#  define MULTI_OMAP1
+# else
+#  define OMAP_NAME omap850
+# endif
+#endif
+#ifdef CONFIG_ARCH_OMAP15XX
+# ifdef OMAP_NAME
+#  undef  MULTI_OMAP1
+#  define MULTI_OMAP1
+# else
+#  define OMAP_NAME omap1510
+# endif
+#endif
+#ifdef CONFIG_ARCH_OMAP16XX
+# ifdef OMAP_NAME
+#  undef  MULTI_OMAP1
+#  define MULTI_OMAP1
+# else
+#  define OMAP_NAME omap16xx
+# endif
+#endif
+
+/*
+ * omap_rev bits:
+ * CPU id bits (0730, 1510, 1710, 2422...)     [31:16]
+ * CPU revision        (See _REV_ defined in cpu.h)    [15:08]
+ * CPU class bits (15xx, 16xx, 24xx, 34xx...)  [07:00]
+ */
+unsigned int omap_rev(void);
+
+/*
+ * Get the CPU revision for OMAP devices
+ */
+#define GET_OMAP_REVISION()    ((omap_rev() >> 8) & 0xff)
+
+/*
+ * Macros to group OMAP into cpu classes.
+ * These can be used in most places.
+ * cpu_is_omap7xx():   True for OMAP730, OMAP850
+ * cpu_is_omap15xx():  True for OMAP1510, OMAP5910 and OMAP310
+ * cpu_is_omap16xx():  True for OMAP1610, OMAP5912 and OMAP1710
+ */
+#define GET_OMAP_CLASS (omap_rev() & 0xff)
+
+#define IS_OMAP_CLASS(class, id)                       \
+static inline int is_omap ##class (void)               \
+{                                                      \
+       return (GET_OMAP_CLASS == (id)) ? 1 : 0;        \
+}
+
+#define GET_OMAP_SUBCLASS      ((omap_rev() >> 20) & 0x0fff)
+
+#define IS_OMAP_SUBCLASS(subclass, id)                 \
+static inline int is_omap ##subclass (void)            \
+{                                                      \
+       return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0;     \
+}
+
+IS_OMAP_CLASS(7xx, 0x07)
+IS_OMAP_CLASS(15xx, 0x15)
+IS_OMAP_CLASS(16xx, 0x16)
+
+#define cpu_is_omap7xx()               0
+#define cpu_is_omap15xx()              0
+#define cpu_is_omap16xx()              0
+
+#if defined(MULTI_OMAP1)
+# if defined(CONFIG_ARCH_OMAP730)
+#  undef  cpu_is_omap7xx
+#  define cpu_is_omap7xx()             is_omap7xx()
+# endif
+# if defined(CONFIG_ARCH_OMAP850)
+#  undef  cpu_is_omap7xx
+#  define cpu_is_omap7xx()             is_omap7xx()
+# endif
+# if defined(CONFIG_ARCH_OMAP15XX)
+#  undef  cpu_is_omap15xx
+#  define cpu_is_omap15xx()            is_omap15xx()
+# endif
+# if defined(CONFIG_ARCH_OMAP16XX)
+#  undef  cpu_is_omap16xx
+#  define cpu_is_omap16xx()            is_omap16xx()
+# endif
+#else
+# if defined(CONFIG_ARCH_OMAP730)
+#  undef  cpu_is_omap7xx
+#  define cpu_is_omap7xx()             1
+# endif
+# if defined(CONFIG_ARCH_OMAP850)
+#  undef  cpu_is_omap7xx
+#  define cpu_is_omap7xx()             1
+# endif
+# if defined(CONFIG_ARCH_OMAP15XX)
+#  undef  cpu_is_omap15xx
+#  define cpu_is_omap15xx()            1
+# endif
+# if defined(CONFIG_ARCH_OMAP16XX)
+#  undef  cpu_is_omap16xx
+#  define cpu_is_omap16xx()            1
+# endif
+#endif
+
+/*
+ * Macros to detect individual cpu types.
+ * These are only rarely needed.
+ * cpu_is_omap310():   True for OMAP310
+ * cpu_is_omap1510():  True for OMAP1510
+ * cpu_is_omap1610():  True for OMAP1610
+ * cpu_is_omap1611():  True for OMAP1611
+ * cpu_is_omap5912():  True for OMAP5912
+ * cpu_is_omap1621():  True for OMAP1621
+ * cpu_is_omap1710():  True for OMAP1710
+ */
+#define GET_OMAP_TYPE  ((omap_rev() >> 16) & 0xffff)
+
+#define IS_OMAP_TYPE(type, id)                         \
+static inline int is_omap ##type (void)                        \
+{                                                      \
+       return (GET_OMAP_TYPE == (id)) ? 1 : 0;         \
+}
+
+IS_OMAP_TYPE(310, 0x0310)
+IS_OMAP_TYPE(1510, 0x1510)
+IS_OMAP_TYPE(1610, 0x1610)
+IS_OMAP_TYPE(1611, 0x1611)
+IS_OMAP_TYPE(5912, 0x1611)
+IS_OMAP_TYPE(1621, 0x1621)
+IS_OMAP_TYPE(1710, 0x1710)
+
+#define cpu_is_omap310()               0
+#define cpu_is_omap1510()              0
+#define cpu_is_omap1610()              0
+#define cpu_is_omap5912()              0
+#define cpu_is_omap1611()              0
+#define cpu_is_omap1621()              0
+#define cpu_is_omap1710()              0
+
+/* These are needed to compile common code */
+#ifdef CONFIG_ARCH_OMAP1
+#define cpu_is_omap242x()              0
+#define cpu_is_omap2430()              0
+#define cpu_is_omap243x()              0
+#define cpu_is_omap24xx()              0
+#define cpu_is_omap34xx()              0
+#define cpu_is_omap44xx()              0
+#define soc_is_omap54xx()              0
+#define soc_is_am33xx()                        0
+#define cpu_class_is_omap1()           1
+#define cpu_class_is_omap2()           0
+#endif
+
+/*
+ * Whether we have MULTI_OMAP1 or not, we still need to distinguish
+ * between 310 vs. 1510 and 1611B/5912 vs. 1710.
+ */
+
+#if defined(CONFIG_ARCH_OMAP15XX)
+# undef  cpu_is_omap310
+# undef  cpu_is_omap1510
+# define cpu_is_omap310()              is_omap310()
+# define cpu_is_omap1510()             is_omap1510()
+#endif
+
+#if defined(CONFIG_ARCH_OMAP16XX)
+# undef  cpu_is_omap1610
+# undef  cpu_is_omap1611
+# undef  cpu_is_omap5912
+# undef  cpu_is_omap1621
+# undef  cpu_is_omap1710
+# define cpu_is_omap1610()             is_omap1610()
+# define cpu_is_omap1611()             is_omap1611()
+# define cpu_is_omap5912()             is_omap5912()
+# define cpu_is_omap1621()             is_omap1621()
+# define cpu_is_omap1710()             is_omap1710()
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif
index 0ff22dc075c7826e9c37052da426d9e675c00b12..ad6fbe7d83f2d04d897da79678ff1d577006fc8e 100644 (file)
@@ -1,5 +1,122 @@
 /*
- * arch/arm/mach-omap1/include/mach/uncompress.h
+ * arch/arm/plat-omap/include/mach/uncompress.h
+ *
+ * Serial port stubs for kernel decompress status messages
+ *
+ * Initially based on:
+ * linux-2.4.15-rmk1-dsplinux1.6/arch/arm/plat-omap/include/mach1510/uncompress.h
+ * Copyright (C) 2000 RidgeRun, Inc.
+ * Author: Greg Lonnon <glonnon@ridgerun.com>
+ *
+ * Rewritten by:
+ * Author: <source@mvista.com>
+ * 2004 (c) MontaVista Software, Inc.
+ *
+ * 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 <plat/uncompress.h>
+#include <linux/types.h>
+#include <linux/serial_reg.h>
+
+#include <asm/memory.h>
+#include <asm/mach-types.h>
+
+#include "serial.h"
+
+#define MDR1_MODE_MASK                 0x07
+
+volatile u8 *uart_base;
+int uart_shift;
+
+/*
+ * Store the DEBUG_LL uart number into memory.
+ * See also debug-macro.S, and serial.c for related code.
+ */
+static void set_omap_uart_info(unsigned char port)
+{
+       /*
+        * Get address of some.bss variable and round it down
+        * a la CONFIG_AUTO_ZRELADDR.
+        */
+       u32 ram_start = (u32)&uart_shift & 0xf8000000;
+       u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS);
+       *uart_info = port;
+}
+
+static void putc(int c)
+{
+       if (!uart_base)
+               return;
+
+       /* Check for UART 16x mode */
+       if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0)
+               return;
+
+       while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
+               barrier();
+       uart_base[UART_TX << uart_shift] = c;
+}
+
+static inline void flush(void)
+{
+}
+
+/*
+ * Macros to configure UART1 and debug UART
+ */
+#define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id)              \
+       if (machine_is_##mach()) {                                      \
+               uart_base = (volatile u8 *)(dbg_uart);                  \
+               uart_shift = (dbg_shft);                                \
+               port = (dbg_id);                                        \
+               set_omap_uart_info(port);                               \
+               break;                                                  \
+       }
+
+#define DEBUG_LL_OMAP7XX(p, mach)                                      \
+       _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, \
+               OMAP1UART##p)
+
+#define DEBUG_LL_OMAP1(p, mach)                                                \
+       _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT,    \
+               OMAP1UART##p)
+
+static inline void arch_decomp_setup(void)
+{
+       int port = 0;
+
+       /*
+        * Initialize the port based on the machine ID from the bootloader.
+        * Note that we're using macros here instead of switch statement
+        * as machine_is functions are optimized out for the boards that
+        * are not selected.
+        */
+       do {
+               /* omap7xx/8xx based boards using UART1 with shift 0 */
+               DEBUG_LL_OMAP7XX(1, herald);
+               DEBUG_LL_OMAP7XX(1, omap_perseus2);
+
+               /* omap15xx/16xx based boards using UART1 */
+               DEBUG_LL_OMAP1(1, ams_delta);
+               DEBUG_LL_OMAP1(1, nokia770);
+               DEBUG_LL_OMAP1(1, omap_h2);
+               DEBUG_LL_OMAP1(1, omap_h3);
+               DEBUG_LL_OMAP1(1, omap_innovator);
+               DEBUG_LL_OMAP1(1, omap_osk);
+               DEBUG_LL_OMAP1(1, omap_palmte);
+               DEBUG_LL_OMAP1(1, omap_palmz71);
+
+               /* omap15xx/16xx based boards using UART2 */
+               DEBUG_LL_OMAP1(2, omap_palmtt);
+
+               /* omap15xx/16xx based boards using UART3 */
+               DEBUG_LL_OMAP1(3, sx1);
+       } while (0);
+}
+
+/*
+ * nothing to do
+ */
+#define arch_decomp_wdog()
index 6a5baab1f4cb690a46eb2086a97af7ca9babeaa1..5a3b80617a11e13ab32839a8f1766ed5b3ba96bf 100644 (file)
@@ -17,8 +17,8 @@
 #include <asm/mach/map.h>
 
 #include <mach/mux.h>
-#include <plat/tc.h>
-#include <plat/dma.h>
+#include <mach/tc.h>
+#include <plat-omap/dma-omap.h>
 
 #include "iomap.h"
 #include "common.h"
@@ -134,7 +134,6 @@ void __init omap1_init_early(void)
         */
        omap1_clk_init();
        omap1_mux_init();
-       omap_init_consistent_dma_size();
 }
 
 void __init omap1_init_late(void)
index 330c4716b028e5eabc8b4fd8c025d40c60c0e876..f4e2d7a21365b00214095893fab10d7772ad1e3e 100644 (file)
@@ -22,9 +22,6 @@
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#define OMAP1_IO_OFFSET                0x01000000      /* Virtual IO = 0xfefb0000 */
-#define OMAP1_IO_ADDRESS(pa)   IOMEM((pa) - OMAP1_IO_OFFSET)
-
 /*
  * ----------------------------------------------------------------------------
  * Omap1 specific IO mapping
index 6995fb6a33454d17f1f05d967f4c75ed2bb4d1e6..122ef67939a232cf2c2260e8ceae68870c7d7de9 100644 (file)
@@ -45,7 +45,7 @@
 #include <asm/irq.h>
 #include <asm/mach/irq.h>
 
-#include <plat/cpu.h>
+#include "soc.h"
 
 #include <mach/hardware.h>
 
index ed42628611bc23953c7e05a33b6a19c3fee6a34a..7ed8c1857d5650856a477e46101127065a4f05f1 100644 (file)
 #include <linux/interrupt.h>
 #include <linux/io.h>
 
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 
 #include <mach/hardware.h>
 #include <mach/lcdc.h>
 
+#include "dma.h"
+
 int omap_lcd_dma_running(void)
 {
        /*
index bdc2e7541adb869fe27d20d2116225c74d2470a6..c6d8fdf92e9ca8fff8548cf1d5740a3220768bcb 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 #include <mach/mux.h>
-#include <plat/cpu.h>
+#include "soc.h"
 #include <linux/platform_data/asoc-ti-mcbsp.h>
 
 #include <mach/irqs.h>
 
 #include "iomap.h"
+#include "dma.h"
 
 #define DPS_RSTCT2_PER_EN      (1 << 0)
 #define DSP_RSTCT2_WD_PER_EN   (1 << 1)
diff --git a/arch/arm/mach-omap1/mmc.h b/arch/arm/mach-omap1/mmc.h
new file mode 100644 (file)
index 0000000..39c2b13
--- /dev/null
@@ -0,0 +1,18 @@
+#include <linux/mmc/host.h>
+#include <linux/platform_data/mmc-omap.h>
+
+#define OMAP15XX_NR_MMC                1
+#define OMAP16XX_NR_MMC                2
+#define OMAP1_MMC_SIZE         0x080
+#define OMAP1_MMC1_BASE                0xfffb7800
+#define OMAP1_MMC2_BASE                0xfffb7c00      /* omap16xx only */
+
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
+void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
+                               int nr_controllers);
+#else
+static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
+                               int nr_controllers)
+{
+}
+#endif
index 9cd4ddb51397dc56fecc26c7384b0564836eaf0d..8dcebe6d8882bb0e4c150fa1d2c22fbbb25fd90a 100644 (file)
@@ -10,7 +10,7 @@
  * published by the Free Software Foundation.
  */
 
-#include <plat/clkdev_omap.h>
+#include "clock.h"
 #include "opp.h"
 
 /*-------------------------------------------------------------------------
index 47ec16155483b057bce3f8c375430923e0d09db6..66d663a6ef3a3b1eadfa1a34735fcecf4e872ee4 100644 (file)
 #include <linux/io.h>
 #include <linux/atomic.h>
 
+#include <asm/fncpy.h>
 #include <asm/system_misc.h>
 #include <asm/irq.h>
 #include <asm/mach/time.h>
 #include <asm/mach/irq.h>
 
-#include <plat/cpu.h>
-#include <plat/clock.h>
-#include <plat/sram.h>
-#include <plat/tc.h>
+#include <mach/tc.h>
 #include <mach/mux.h>
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 #include <plat/dmtimer.h>
 
 #include <mach/irqs.h>
 
 #include "iomap.h"
+#include "clock.h"
 #include "pm.h"
+#include "sram.h"
 
 static unsigned int arm_sleep_save[ARM_SLEEP_SAVE_SIZE];
 static unsigned short dsp_sleep_save[DSP_SLEEP_SAVE_SIZE];
index 7868e75ad0772a95eaec0885696c52a12d3bac5a..3f2d396723930ce1a27985bc3dcf48d122576e9b 100644 (file)
@@ -19,8 +19,7 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 
-#include <plat/omap_device.h>
-#include <plat/omap-pm.h>
+#include "soc.h"
 
 #ifdef CONFIG_PM_RUNTIME
 static int omap1_pm_runtime_suspend(struct device *dev)
index b17709103866aeeb16394d760b3e6af33396a5c9..5eebd7e889d08b184ad2d0e7f5f26876b66bc619 100644 (file)
@@ -4,12 +4,24 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 
-#include <plat/prcm.h>
-
 #include <mach/hardware.h>
 
+#include "iomap.h"
 #include "common.h"
 
+/* ARM_SYSST bit shifts related to SoC reset sources */
+#define ARM_SYSST_POR_SHIFT                            5
+#define ARM_SYSST_EXT_RST_SHIFT                                4
+#define ARM_SYSST_ARM_WDRST_SHIFT                      2
+#define ARM_SYSST_GLOB_SWRST_SHIFT                     1
+
+/* Standardized reset source bits (across all OMAP SoCs) */
+#define OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT              0
+#define OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT              1
+#define OMAP_MPU_WD_RST_SRC_ID_SHIFT                   3
+#define OMAP_EXTWARM_RST_SRC_ID_SHIFT                  5
+
+
 void omap1_restart(char mode, const char *cmd)
 {
        /*
@@ -23,3 +35,28 @@ void omap1_restart(char mode, const char *cmd)
 
        omap_writew(1, ARM_RSTCT1);
 }
+
+/**
+ * omap1_get_reset_sources - return the source of the SoC's last reset
+ *
+ * Returns bits that represent the last reset source for the SoC.  The
+ * format is standardized across OMAPs for use by the OMAP watchdog.
+ */
+u32 omap1_get_reset_sources(void)
+{
+       u32 ret = 0;
+       u16 rs;
+
+       rs = __raw_readw(OMAP1_IO_ADDRESS(ARM_SYSST));
+
+       if (rs & (1 << ARM_SYSST_POR_SHIFT))
+               ret |= 1 << OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT;
+       if (rs & (1 << ARM_SYSST_EXT_RST_SHIFT))
+               ret |= 1 << OMAP_EXTWARM_RST_SRC_ID_SHIFT;
+       if (rs & (1 << ARM_SYSST_ARM_WDRST_SHIFT))
+               ret |= 1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT;
+       if (rs & (1 << ARM_SYSST_GLOB_SWRST_SHIFT))
+               ret |= 1 << OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT;
+
+       return ret;
+}
index b9d6834af835f27d4f41753dd7cf0aabb6a6ce37..d1ac08016f0bbaa99d9c6a99f38b4d38869b9675 100644 (file)
@@ -23,7 +23,6 @@
 #include <asm/mach-types.h>
 
 #include <mach/mux.h>
-#include <plat/fpga.h>
 
 #include "pm.h"
 
index 0e628743bd03ca0f8fe202c8ef0693c48fbd9246..a908c51839a43bc7b56c2db0abdc27fbc16f89fa 100644 (file)
@@ -36,6 +36,8 @@
 
 #include <asm/assembler.h>
 
+#include <mach/hardware.h>
+
 #include "iomap.h"
 #include "pm.h"
 
diff --git a/arch/arm/mach-omap1/soc.h b/arch/arm/mach-omap1/soc.h
new file mode 100644 (file)
index 0000000..69daf01
--- /dev/null
@@ -0,0 +1,4 @@
+/*
+ * We can move mach/soc.h here once the drivers are fixed
+ */
+#include <mach/soc.h>
diff --git a/arch/arm/mach-omap1/sram-init.c b/arch/arm/mach-omap1/sram-init.c
new file mode 100644 (file)
index 0000000..6431b0f
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * OMAP SRAM detection and management
+ *
+ * Copyright (C) 2005 Nokia Corporation
+ * Written by Tony Lindgren <tony@atomide.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/io.h>
+
+#include <asm/fncpy.h>
+#include <asm/tlb.h>
+#include <asm/cacheflush.h>
+
+#include <asm/mach/map.h>
+
+#include "soc.h"
+#include "sram.h"
+
+#define OMAP1_SRAM_PA          0x20000000
+#define SRAM_BOOTLOADER_SZ     0x80
+
+/*
+ * The amount of SRAM depends on the core type.
+ * Note that we cannot try to test for SRAM here because writes
+ * to secure SRAM will hang the system. Also the SRAM is not
+ * yet mapped at this point.
+ */
+static void __init omap_detect_and_map_sram(void)
+{
+       unsigned long omap_sram_skip = SRAM_BOOTLOADER_SZ;
+       unsigned long omap_sram_start = OMAP1_SRAM_PA;
+       unsigned long omap_sram_size;
+
+       if (cpu_is_omap7xx())
+               omap_sram_size = 0x32000;       /* 200K */
+       else if (cpu_is_omap15xx())
+               omap_sram_size = 0x30000;       /* 192K */
+       else if (cpu_is_omap1610() || cpu_is_omap1611() ||
+                       cpu_is_omap1621() || cpu_is_omap1710())
+               omap_sram_size = 0x4000;        /* 16K */
+       else {
+               pr_err("Could not detect SRAM size\n");
+               omap_sram_size = 0x4000;
+       }
+
+       omap_map_sram(omap_sram_start, omap_sram_size,
+               omap_sram_skip, 1);
+}
+
+static void (*_omap_sram_reprogram_clock)(u32 dpllctl, u32 ckctl);
+
+void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl)
+{
+       BUG_ON(!_omap_sram_reprogram_clock);
+       /* On 730, bit 13 must always be 1 */
+       if (cpu_is_omap7xx())
+               ckctl |= 0x2000;
+       _omap_sram_reprogram_clock(dpllctl, ckctl);
+}
+
+int __init omap_sram_init(void)
+{
+       omap_detect_and_map_sram();
+       _omap_sram_reprogram_clock =
+                       omap_sram_push(omap1_sram_reprogram_clock,
+                                       omap1_sram_reprogram_clock_sz);
+
+       return 0;
+}
diff --git a/arch/arm/mach-omap1/sram.h b/arch/arm/mach-omap1/sram.h
new file mode 100644 (file)
index 0000000..d5a6c83
--- /dev/null
@@ -0,0 +1,7 @@
+#include <plat/sram.h>
+
+extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl);
+
+/* Do not use these */
+extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
+extern unsigned long omap1_sram_reprogram_clock_sz;
index 74529549130cbafd05997bba066dd537c3632d77..89368195bf0834fefa1ffffbc074487beefef109 100644 (file)
@@ -50,6 +50,7 @@
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 
+#include <plat/counter-32k.h>
 #include <plat/dmtimer.h>
 
 #include <mach/hardware.h>
index 84267edd9421754135290582383a3f372bdd8fac..104fed366b8f4877f79d05b325f7e3b835f1b5c6 100644 (file)
@@ -301,7 +301,7 @@ static inline void otg_device_init(struct omap_usb_config *pdata)
 
 #endif
 
-u32 __init omap1_usb0_init(unsigned nwires, unsigned is_device)
+static u32 __init omap1_usb0_init(unsigned nwires, unsigned is_device)
 {
        u32     syscon1 = 0;
 
@@ -409,7 +409,7 @@ u32 __init omap1_usb0_init(unsigned nwires, unsigned is_device)
        return syscon1 << 16;
 }
 
-u32 __init omap1_usb1_init(unsigned nwires)
+static u32 __init omap1_usb1_init(unsigned nwires)
 {
        u32     syscon1 = 0;
 
@@ -475,7 +475,7 @@ bad:
        return syscon1 << 20;
 }
 
-u32 __init omap1_usb2_init(unsigned nwires, unsigned alt_pingroup)
+static u32 __init omap1_usb2_init(unsigned nwires, unsigned alt_pingroup)
 {
        u32     syscon1 = 0;
 
index fe40d9e488c96cdf1c68ba1d6dd7acc9631b360b..78cbb8c5992e4f96ee94e84c9960fec37f8fe245 100644 (file)
@@ -4,30 +4,37 @@
 
 # Common support
 obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \
-        common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o
-
-# INTCPS IP block support - XXX should be moved to drivers/
-obj-$(CONFIG_ARCH_OMAP2)               += irq.o
-obj-$(CONFIG_ARCH_OMAP3)               += irq.o
-obj-$(CONFIG_SOC_AM33XX)               += irq.o
-
-# Secure monitor API support
-obj-$(CONFIG_ARCH_OMAP3)               += omap-smc.o omap-secure.o
-obj-$(CONFIG_ARCH_OMAP4)               += omap-smc.o omap-secure.o
-obj-$(CONFIG_SOC_OMAP5)                        += omap-smc.o omap-secure.o
+        common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \
+        omap_device.o sram.o
+
+omap-2-3-common                                = irq.o
+hwmod-common                           = omap_hwmod.o \
+                                         omap_hwmod_common_data.o
+clock-common                           = clock.o clock_common_data.o \
+                                         clkt_dpll.o clkt_clksel.o
+secure-common                          = omap-smc.o omap-secure.o
+
+obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common)
+obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common)
+obj-$(CONFIG_ARCH_OMAP4) += prm44xx.o $(hwmod-common) $(secure-common)
+obj-$(CONFIG_SOC_AM33XX) += irq.o $(hwmod-common)
+obj-$(CONFIG_SOC_OMAP5)         += prm44xx.o $(hwmod-common) $(secure-common)
 
 ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
 obj-y += mcbsp.o
 endif
 
-obj-$(CONFIG_TWL4030_CORE)             += omap_twl.o
+obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
+obj-$(CONFIG_SOC_HAS_OMAP2_SDRC)       += sdrc.o
 
 # SMP support ONLY available for OMAP4
 
 obj-$(CONFIG_SMP)                      += omap-smp.o omap-headsmp.o
 obj-$(CONFIG_HOTPLUG_CPU)              += omap-hotplug.o
-obj-$(CONFIG_ARCH_OMAP4)               += omap4-common.o omap-wakeupgen.o
-obj-$(CONFIG_SOC_OMAP5)                        += omap4-common.o omap-wakeupgen.o
+omap-4-5-common                                =  omap4-common.o omap-wakeupgen.o \
+                                          sleep44xx.o
+obj-$(CONFIG_ARCH_OMAP4)               += $(omap-4-5-common)
+obj-$(CONFIG_SOC_OMAP5)                        += $(omap-4-5-common)
 
 plus_sec := $(call as-instr,.arch_extension sec,+sec)
 AFLAGS_omap-headsmp.o                  :=-Wa,-march=armv7-a$(plus_sec)
@@ -43,6 +50,11 @@ AFLAGS_sram242x.o                    :=-Wa,-march=armv6
 AFLAGS_sram243x.o                      :=-Wa,-march=armv6
 AFLAGS_sram34xx.o                      :=-Wa,-march=armv7-a
 
+# Restart code (OMAP4/5 currently in omap4-common.c)
+obj-$(CONFIG_SOC_OMAP2420)             += omap2-restart.o
+obj-$(CONFIG_SOC_OMAP2430)             += omap2-restart.o
+obj-$(CONFIG_ARCH_OMAP3)               += omap3-restart.o
+
 # Pin multiplexing
 obj-$(CONFIG_SOC_OMAP2420)             += mux2420.o
 obj-$(CONFIG_SOC_OMAP2430)             += mux2430.o
@@ -52,7 +64,6 @@ obj-$(CONFIG_ARCH_OMAP4)              += mux44xx.o
 # SMS/SDRC
 obj-$(CONFIG_ARCH_OMAP2)               += sdrc2xxx.o
 # obj-$(CONFIG_ARCH_OMAP3)             += sdrc3xxx.o
-obj-$(CONFIG_SOC_HAS_OMAP2_SDRC)       += sdrc.o
 
 # OPP table initialization
 ifeq ($(CONFIG_PM_OPP),y)
@@ -63,15 +74,16 @@ endif
 
 # Power Management
 ifeq ($(CONFIG_PM),y)
-obj-$(CONFIG_ARCH_OMAP2)               += pm24xx.o sleep24xx.o
+obj-$(CONFIG_ARCH_OMAP2)               += pm24xx.o
+obj-$(CONFIG_ARCH_OMAP2)               += sleep24xx.o
 obj-$(CONFIG_ARCH_OMAP3)               += pm34xx.o sleep34xx.o
 obj-$(CONFIG_ARCH_OMAP4)               += pm44xx.o omap-mpuss-lowpower.o
-obj-$(CONFIG_ARCH_OMAP4)               += sleep44xx.o
-obj-$(CONFIG_SOC_OMAP5)                        += omap-mpuss-lowpower.o sleep44xx.o
+obj-$(CONFIG_SOC_OMAP5)                        += omap-mpuss-lowpower.o
 obj-$(CONFIG_PM_DEBUG)                 += pm-debug.o
+obj-$(CONFIG_OMAP_PM_NOOP)             += omap-pm-noop.o
 
 obj-$(CONFIG_POWER_AVS_OMAP)           += sr_device.o
-obj-$(CONFIG_POWER_AVS_OMAP_CLASS3)    += smartreflex-class3.o
+obj-$(CONFIG_POWER_AVS_OMAP_CLASS3)    += smartreflex-class3.o
 
 AFLAGS_sleep24xx.o                     :=-Wa,-march=armv6
 AFLAGS_sleep34xx.o                     :=-Wa,-march=armv7-a$(plus_sec)
@@ -83,76 +95,82 @@ endif
 endif
 
 ifeq ($(CONFIG_CPU_IDLE),y)
-obj-$(CONFIG_ARCH_OMAP3)               += cpuidle34xx.o
-obj-$(CONFIG_ARCH_OMAP4)               += cpuidle44xx.o
+obj-$(CONFIG_ARCH_OMAP3)                += cpuidle34xx.o
+obj-$(CONFIG_ARCH_OMAP4)                += cpuidle44xx.o
 endif
 
 # PRCM
-obj-y                                  += prcm.o prm_common.o
-obj-$(CONFIG_ARCH_OMAP2)               += cm2xxx_3xxx.o prm2xxx_3xxx.o
-obj-$(CONFIG_ARCH_OMAP3)               += cm2xxx_3xxx.o prm2xxx_3xxx.o
+obj-y                                  += prm_common.o cm_common.o
+obj-$(CONFIG_ARCH_OMAP2)               += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o
+obj-$(CONFIG_ARCH_OMAP3)               += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o
 obj-$(CONFIG_ARCH_OMAP3)               += vc3xxx_data.o vp3xxx_data.o
 obj-$(CONFIG_SOC_AM33XX)               += prm33xx.o cm33xx.o
 omap-prcm-4-5-common                   =  cminst44xx.o cm44xx.o prm44xx.o \
                                           prcm_mpu44xx.o prminst44xx.o \
-                                          vc44xx_data.o vp44xx_data.o \
-                                          prm44xx.o
+                                          vc44xx_data.o vp44xx_data.o
 obj-$(CONFIG_ARCH_OMAP4)               += $(omap-prcm-4-5-common)
 obj-$(CONFIG_SOC_OMAP5)                        += $(omap-prcm-4-5-common)
 
 # OMAP voltage domains
-obj-y                                  += voltage.o vc.o vp.o
+voltagedomain-common                   := voltage.o vc.o vp.o
+obj-$(CONFIG_ARCH_OMAP2)               += $(voltagedomain-common)
 obj-$(CONFIG_ARCH_OMAP2)               += voltagedomains2xxx_data.o
+obj-$(CONFIG_ARCH_OMAP3)               += $(voltagedomain-common)
 obj-$(CONFIG_ARCH_OMAP3)               += voltagedomains3xxx_data.o
+obj-$(CONFIG_ARCH_OMAP4)               += $(voltagedomain-common)
 obj-$(CONFIG_ARCH_OMAP4)               += voltagedomains44xx_data.o
-obj-$(CONFIG_SOC_AM33XX)               += voltagedomains33xx_data.o
+obj-$(CONFIG_SOC_AM33XX)               += $(voltagedomain-common)
+obj-$(CONFIG_SOC_AM33XX)                += voltagedomains33xx_data.o
+obj-$(CONFIG_SOC_OMAP5)                        += $(voltagedomain-common)
 
 # OMAP powerdomain framework
-obj-y                                  += powerdomain.o powerdomain-common.o
+powerdomain-common                     += powerdomain.o powerdomain-common.o
+obj-$(CONFIG_ARCH_OMAP2)               += $(powerdomain-common)
 obj-$(CONFIG_ARCH_OMAP2)               += powerdomains2xxx_data.o
-obj-$(CONFIG_ARCH_OMAP2)               += powerdomain2xxx_3xxx.o
 obj-$(CONFIG_ARCH_OMAP2)               += powerdomains2xxx_3xxx_data.o
-obj-$(CONFIG_ARCH_OMAP3)               += powerdomain2xxx_3xxx.o
+obj-$(CONFIG_ARCH_OMAP3)               += $(powerdomain-common)
 obj-$(CONFIG_ARCH_OMAP3)               += powerdomains3xxx_data.o
 obj-$(CONFIG_ARCH_OMAP3)               += powerdomains2xxx_3xxx_data.o
-obj-$(CONFIG_ARCH_OMAP4)               += powerdomain44xx.o
+obj-$(CONFIG_ARCH_OMAP4)               += $(powerdomain-common)
 obj-$(CONFIG_ARCH_OMAP4)               += powerdomains44xx_data.o
-obj-$(CONFIG_SOC_AM33XX)               += powerdomain33xx.o
+obj-$(CONFIG_SOC_AM33XX)               += $(powerdomain-common)
 obj-$(CONFIG_SOC_AM33XX)               += powerdomains33xx_data.o
-obj-$(CONFIG_SOC_OMAP5)                        += powerdomain44xx.o
+obj-$(CONFIG_SOC_OMAP5)                        += $(powerdomain-common)
 
 # PRCM clockdomain control
-obj-y                                  += clockdomain.o
-obj-$(CONFIG_ARCH_OMAP2)               += clockdomain2xxx_3xxx.o
+clockdomain-common                     += clockdomain.o
+obj-$(CONFIG_ARCH_OMAP2)               += $(clockdomain-common)
 obj-$(CONFIG_ARCH_OMAP2)               += clockdomains2xxx_3xxx_data.o
 obj-$(CONFIG_SOC_OMAP2420)             += clockdomains2420_data.o
 obj-$(CONFIG_SOC_OMAP2430)             += clockdomains2430_data.o
-obj-$(CONFIG_ARCH_OMAP3)               += clockdomain2xxx_3xxx.o
+obj-$(CONFIG_ARCH_OMAP3)               += $(clockdomain-common)
 obj-$(CONFIG_ARCH_OMAP3)               += clockdomains2xxx_3xxx_data.o
 obj-$(CONFIG_ARCH_OMAP3)               += clockdomains3xxx_data.o
-obj-$(CONFIG_ARCH_OMAP4)               += clockdomain44xx.o
+obj-$(CONFIG_ARCH_OMAP4)               += $(clockdomain-common)
 obj-$(CONFIG_ARCH_OMAP4)               += clockdomains44xx_data.o
-obj-$(CONFIG_SOC_AM33XX)               += clockdomain33xx.o
+obj-$(CONFIG_SOC_AM33XX)               += $(clockdomain-common)
 obj-$(CONFIG_SOC_AM33XX)               += clockdomains33xx_data.o
-obj-$(CONFIG_SOC_OMAP5)                        += clockdomain44xx.o
+obj-$(CONFIG_SOC_OMAP5)                        += $(clockdomain-common)
 
 # Clock framework
-obj-y                                  += clock.o clock_common_data.o \
-                                          clkt_dpll.o clkt_clksel.o
-obj-$(CONFIG_ARCH_OMAP2)               += clock2xxx.o
-obj-$(CONFIG_ARCH_OMAP2)               += clkt2xxx_dpllcore.o clkt2xxx_sys.o
+obj-$(CONFIG_ARCH_OMAP2)               += $(clock-common) clock2xxx.o
+obj-$(CONFIG_ARCH_OMAP2)               += clkt2xxx_sys.o
+obj-$(CONFIG_ARCH_OMAP2)               += clkt2xxx_dpllcore.o
 obj-$(CONFIG_ARCH_OMAP2)               += clkt2xxx_virt_prcm_set.o
 obj-$(CONFIG_ARCH_OMAP2)               += clkt2xxx_apll.o clkt2xxx_osc.o
 obj-$(CONFIG_ARCH_OMAP2)               += clkt2xxx_dpll.o clkt_iclk.o
 obj-$(CONFIG_SOC_OMAP2420)             += clock2420_data.o
 obj-$(CONFIG_SOC_OMAP2430)             += clock2430.o clock2430_data.o
-obj-$(CONFIG_ARCH_OMAP3)               += clock3xxx.o
+obj-$(CONFIG_ARCH_OMAP3)               += $(clock-common) clock3xxx.o
 obj-$(CONFIG_ARCH_OMAP3)               += clock34xx.o clkt34xx_dpll3m2.o
-obj-$(CONFIG_ARCH_OMAP3)               += clock3517.o clock36xx.o clkt_iclk.o
+obj-$(CONFIG_ARCH_OMAP3)               += clock3517.o clock36xx.o
 obj-$(CONFIG_ARCH_OMAP3)               += dpll3xxx.o clock3xxx_data.o
-obj-$(CONFIG_ARCH_OMAP4)               += clock44xx_data.o
+obj-$(CONFIG_ARCH_OMAP3)               += clkt_iclk.o
+obj-$(CONFIG_ARCH_OMAP4)               += $(clock-common) clock44xx_data.o
 obj-$(CONFIG_ARCH_OMAP4)               += dpll3xxx.o dpll44xx.o
-obj-$(CONFIG_SOC_AM33XX)               += dpll3xxx.o clock33xx_data.o
+obj-$(CONFIG_SOC_AM33XX)               += $(clock-common) dpll3xxx.o
+obj-$(CONFIG_SOC_AM33XX)               += clock33xx_data.o
+obj-$(CONFIG_SOC_OMAP5)                        += $(clock-common)
 obj-$(CONFIG_SOC_OMAP5)                        += dpll3xxx.o dpll44xx.o
 
 # OMAP2 clock rate set data (old "OPP" data)
@@ -160,7 +178,6 @@ obj-$(CONFIG_SOC_OMAP2420)          += opp2420_data.o
 obj-$(CONFIG_SOC_OMAP2430)             += opp2430_data.o
 
 # hwmod data
-obj-y                                  += omap_hwmod_common_data.o
 obj-$(CONFIG_SOC_OMAP2420)             += omap_hwmod_2xxx_ipblock_data.o
 obj-$(CONFIG_SOC_OMAP2420)             += omap_hwmod_2xxx_3xxx_ipblock_data.o
 obj-$(CONFIG_SOC_OMAP2420)             += omap_hwmod_2xxx_interconnect_data.o
@@ -206,10 +223,10 @@ obj-$(CONFIG_MACH_OMAP_H4)                += board-h4.o
 obj-$(CONFIG_MACH_OMAP_2430SDP)                += board-2430sdp.o
 obj-$(CONFIG_MACH_OMAP_APOLLON)                += board-apollon.o
 obj-$(CONFIG_MACH_OMAP3_BEAGLE)                += board-omap3beagle.o
-obj-$(CONFIG_MACH_DEVKIT8000)          += board-devkit8000.o
+obj-$(CONFIG_MACH_DEVKIT8000)          += board-devkit8000.o
 obj-$(CONFIG_MACH_OMAP_LDP)            += board-ldp.o
-obj-$(CONFIG_MACH_OMAP3530_LV_SOM)     += board-omap3logic.o
-obj-$(CONFIG_MACH_OMAP3_TORPEDO)       += board-omap3logic.o
+obj-$(CONFIG_MACH_OMAP3530_LV_SOM)      += board-omap3logic.o
+obj-$(CONFIG_MACH_OMAP3_TORPEDO)        += board-omap3logic.o
 obj-$(CONFIG_MACH_ENCORE)              += board-omap3encore.o
 obj-$(CONFIG_MACH_OVERO)               += board-overo.o
 obj-$(CONFIG_MACH_OMAP3EVM)            += board-omap3evm.o
index 06c19bb7bca6aaca1df218f3ac18f19f12dbf819..43296c1af9ee85f13ee00326113d187a896503a7 100644 (file)
@@ -21,5 +21,6 @@
 #define AM33XX_SCM_BASE                0x44E10000
 #define AM33XX_CTRL_BASE       AM33XX_SCM_BASE
 #define AM33XX_PRCM_BASE       0x44E00000
+#define AM33XX_TAP_BASE                (AM33XX_CTRL_BASE + 0x3FC)
 
 #endif /* __ASM_ARCH_AM33XX_H */
index d0c54c573d3400dde7920d79e981b4f4c3982783..af11dcdb7e2c1372d436fbbe17ceab63826e0d14 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/err.h>
 #include <linux/davinci_emac.h>
 #include <asm/system.h>
-#include <plat/omap_device.h>
+#include "omap_device.h"
 #include "am35xx.h"
 #include "control.h"
 #include "am35xx-emac.h"
index 95b384d54f8aa847ff2c07b0cb33d3c94a2b1e64..4815ea6f8f5dfc11f34af1c8e848bd0ed8d866c0 100644 (file)
 #include <linux/io.h>
 #include <linux/gpio.h>
 
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
 #include "common.h"
-#include <plat/gpmc.h>
-#include <plat/usb.h>
+#include "gpmc.h"
 #include "gpmc-smc91x.h"
 
 #include <video/omapdss.h>
@@ -287,5 +285,5 @@ MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
        .init_machine   = omap_2430sdp_init,
        .init_late      = omap2430_init_late,
        .timer          = &omap2_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap2xxx_restart,
 MACHINE_END
index 96cd3693e1ae9990c621f8f44778775e1e2008cc..6601754f95128b65eaaa6b66141d598f24d6db9c 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <plat/usb.h>
 #include "common.h"
-#include <plat/dma.h>
-#include <plat/gpmc.h>
+#include <plat-omap/dma-omap.h>
 #include <video/omapdss.h>
 #include <video/omap-panel-tfp410.h>
 
+#include "gpmc.h"
 #include "gpmc-smc91x.h"
 
+#include "soc.h"
 #include "board-flash.h"
 #include "mux.h"
 #include "sdram-qimonda-hyb18m512160af-6.h"
@@ -597,5 +597,5 @@ MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
        .init_machine   = omap_3430sdp_init,
        .init_late      = omap3430_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index fc224ad86747a41362b884d33976f5882300339b..050aaa7712544fc9db648dbd48ad2e8e237e484b 100644 (file)
@@ -18,9 +18,8 @@
 
 #include "common.h"
 #include "gpmc-smc91x.h"
-#include <plat/usb.h>
 
-#include <mach/board-zoom.h>
+#include "board-zoom.h"
 
 #include "board-flash.h"
 #include "mux.h"
@@ -213,5 +212,5 @@ MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
        .init_machine   = omap_sdp_init,
        .init_late      = omap3630_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index 3669c120c7e8a7b29628273ea4dbf2d3bfac39b7..85dfa71e0dc62aad0588124a82cdc361bae3db72 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/leds.h>
 #include <linux/leds_pwm.h>
 #include <linux/platform_data/omap4-keypad.h>
+#include <linux/usb/musb.h>
 
 #include <asm/hardware/gic.h>
 #include <asm/mach-types.h>
@@ -34,8 +35,6 @@
 #include <asm/mach/map.h>
 
 #include "common.h"
-#include <plat/usb.h>
-#include <plat/mmc.h>
 #include "omap4-keypad.h"
 #include <video/omapdss.h>
 #include <video/omap-panel-nokia-dsi.h>
@@ -45,6 +44,7 @@
 
 #include "soc.h"
 #include "mux.h"
+#include "mmc.h"
 #include "hsmmc.h"
 #include "control.h"
 #include "common-board-devices.h"
@@ -881,5 +881,5 @@ MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
        .init_machine   = omap_4430sdp_init,
        .init_late      = omap4430_init_late,
        .timer          = &omap4_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap44xx_restart,
 MACHINE_END
index 318feadb1d6e7ed4f6df2f6a9b152969a2d0f286..51b96a1206d198dcdeef25ac5f76c0c06e9cb080 100644 (file)
@@ -26,7 +26,6 @@
 #include <asm/mach/map.h>
 
 #include "common.h"
-#include <plat/usb.h>
 
 #include "am35xx-emac.h"
 #include "mux.h"
@@ -94,5 +93,5 @@ MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
        .init_machine   = am3517_crane_init,
        .init_late      = am35xx_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index e16289755f2e39b98674f8a10654c9805950c7d3..4be58fd071f66c868b997689553ae642b2a23f16 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/can/platform/ti_hecc.h>
 #include <linux/davinci_emac.h>
 #include <linux/mmc/host.h>
+#include <linux/usb/musb.h>
 #include <linux/platform_data/gpio-omap.h>
 
 #include "am35xx.h"
@@ -33,7 +34,6 @@
 #include <asm/mach/map.h>
 
 #include "common.h"
-#include <plat/usb.h>
 #include <video/omapdss.h>
 #include <video/omap-panel-generic-dpi.h>
 #include <video/omap-panel-tfp410.h>
@@ -393,5 +393,5 @@ MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
        .init_machine   = am3517_evm_init,
        .init_late      = am35xx_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index cea3abace815716b4fea93aa1e9aae1c61238740..5d0a61f5416551b83ea0844af6eb66cbc0955727 100644 (file)
 #include <linux/clk.h>
 #include <linux/smc91x.h>
 #include <linux/gpio.h>
+#include <linux/platform_data/leds-omap.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
-#include <plat/led.h>
 #include "common.h"
-#include <plat/gpmc.h>
+#include "gpmc.h"
 
 #include <video/omapdss.h>
 #include <video/omap-panel-generic-dpi.h>
@@ -338,5 +338,5 @@ MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon")
        .init_machine   = omap_apollon_init,
        .init_late      = omap2420_init_late,
        .timer          = &omap2_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap2xxx_restart,
 MACHINE_END
index 376d26eb601c371b75b4c4af7a3105ebe30bf8c4..c8e37dc0089226e034b4e57b9d53c10075c41f4b 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include "common.h"
 #include <linux/platform_data/mtd-nand-omap2.h>
-#include <plat/gpmc.h>
-#include <plat/usb.h>
 #include <video/omapdss.h>
 #include <video/omap-panel-generic-dpi.h>
 #include <video/omap-panel-tfp410.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 
-#include <mach/hardware.h>
-
+#include "common.h"
 #include "mux.h"
 #include "sdram-micron-mt46h32m32lf-6.h"
 #include "hsmmc.h"
 #include "common-board-devices.h"
+#include "gpmc.h"
+#include "gpmc-nand.h"
 
 #define CM_T35_GPIO_PENDOWN            57
 #define SB_T35_USB_HUB_RESET_GPIO      167
@@ -181,7 +179,7 @@ static struct omap_nand_platform_data cm_t35_nand_data = {
 
 static void __init cm_t35_init_nand(void)
 {
-       if (gpmc_nand_init(&cm_t35_nand_data) < 0)
+       if (gpmc_nand_init(&cm_t35_nand_data, NULL) < 0)
                pr_err("CM-T35: Unable to register NAND device\n");
 }
 #else
@@ -753,18 +751,18 @@ MACHINE_START(CM_T35, "Compulab CM-T35")
        .init_machine   = cm_t35_init,
        .init_late      = omap35xx_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
 
 MACHINE_START(CM_T3730, "Compulab CM-T3730")
-       .atag_offset    = 0x100,
-       .reserve        = omap_reserve,
-       .map_io         = omap3_map_io,
-       .init_early     = omap3630_init_early,
-       .init_irq       = omap3_init_irq,
+       .atag_offset    = 0x100,
+       .reserve        = omap_reserve,
+       .map_io         = omap3_map_io,
+       .init_early     = omap3630_init_early,
+       .init_irq       = omap3_init_irq,
        .handle_irq     = omap3_intc_handle_irq,
-       .init_machine   = cm_t3730_init,
+       .init_machine   = cm_t3730_init,
        .init_late     = omap3630_init_late,
-       .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .timer          = &omap3_timer,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index 59c0a45f75b02aec82fbbb0d8ceb51a4a2879153..699caec8f9e21f2c30b16e6d6dcd2ab5336009a6 100644 (file)
@@ -39,9 +39,8 @@
 #include <asm/mach/map.h>
 
 #include "common.h"
-#include <plat/usb.h>
 #include <linux/platform_data/mtd-nand-omap2.h>
-#include <plat/gpmc.h>
+#include "gpmc.h"
 
 #include "am35xx.h"
 
@@ -49,6 +48,7 @@
 #include "control.h"
 #include "common-board-devices.h"
 #include "am35xx-emac.h"
+#include "gpmc-nand.h"
 
 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
 static struct gpio_led cm_t3517_leds[] = {
@@ -240,7 +240,7 @@ static struct omap_nand_platform_data cm_t3517_nand_data = {
 
 static void __init cm_t3517_init_nand(void)
 {
-       if (gpmc_nand_init(&cm_t3517_nand_data) < 0)
+       if (gpmc_nand_init(&cm_t3517_nand_data, NULL) < 0)
                pr_err("CM-T3517: NAND initialization failed\n");
 }
 #else
@@ -298,5 +298,5 @@ MACHINE_START(CM_T3517, "Compulab CM-T3517")
        .init_machine   = cm_t3517_init,
        .init_late      = am35xx_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index 1fd161e934c7e7df2d9eec52c3c35f3e8abfc964..7667eb749522dc5ff568a380ee1dfaa87efe5cc1 100644 (file)
@@ -39,9 +39,8 @@
 #include <asm/mach/flash.h>
 
 #include "common.h"
-#include <plat/gpmc.h>
+#include "gpmc.h"
 #include <linux/platform_data/mtd-nand-omap2.h>
-#include <plat/usb.h>
 #include <video/omapdss.h>
 #include <video/omap-panel-generic-dpi.h>
 #include <video/omap-panel-tfp410.h>
 #include "sdram-micron-mt46h32m32lf-6.h"
 #include "mux.h"
 #include "hsmmc.h"
+#include "board-flash.h"
 #include "common-board-devices.h"
 
+#define        NAND_CS                 0
+
 #define OMAP_DM9000_GPIO_IRQ   25
 #define OMAP3_DEVKIT_TS_GPIO   27
 
@@ -621,8 +623,9 @@ static void __init devkit8000_init(void)
 
        usb_musb_init(NULL);
        usbhs_init(&usbhs_bdata);
-       omap_nand_flash_init(NAND_BUSWIDTH_16, devkit8000_nand_partitions,
-                            ARRAY_SIZE(devkit8000_nand_partitions));
+       board_nand_init(devkit8000_nand_partitions,
+                       ARRAY_SIZE(devkit8000_nand_partitions), NAND_CS,
+                       NAND_BUSWIDTH_16, NULL);
        omap_twl4030_audio_init("omap3beagle");
 
        /* Ensure SDRC pins are mux'd for self-refresh */
@@ -640,5 +643,5 @@ MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000")
        .init_machine   = devkit8000_init,
        .init_late      = omap35xx_init_late,
        .timer          = &omap3_secure_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index e642acf9cad0e1132bf3edcd6398d02c05d4cdaa..c33adea0247c661fb1530b14e129c19f8f7d8390 100644 (file)
 #include <linux/mtd/physmap.h>
 #include <linux/io.h>
 
-#include <plat/cpu.h>
-#include <plat/gpmc.h>
 #include <linux/platform_data/mtd-nand-omap2.h>
 #include <linux/platform_data/mtd-onenand-omap2.h>
-#include <plat/tc.h>
 
+#include "soc.h"
 #include "common.h"
 #include "board-flash.h"
+#include "gpmc-onenand.h"
+#include "gpmc-nand.h"
 
 #define REG_FPGA_REV                   0x10
 #define REG_FPGA_DIP_SWITCH_INPUT2     0x60
@@ -104,36 +104,35 @@ __init board_onenand_init(struct mtd_partition *onenand_parts,
                defined(CONFIG_MTD_NAND_OMAP2_MODULE)
 
 /* Note that all values in this struct are in nanoseconds */
-static struct gpmc_timings nand_timings = {
+struct gpmc_timings nand_default_timings[1] = {
+       {
+               .sync_clk = 0,
 
-       .sync_clk = 0,
+               .cs_on = 0,
+               .cs_rd_off = 36,
+               .cs_wr_off = 36,
 
-       .cs_on = 0,
-       .cs_rd_off = 36,
-       .cs_wr_off = 36,
+               .adv_on = 6,
+               .adv_rd_off = 24,
+               .adv_wr_off = 36,
 
-       .adv_on = 6,
-       .adv_rd_off = 24,
-       .adv_wr_off = 36,
+               .we_off = 30,
+               .oe_off = 48,
 
-       .we_off = 30,
-       .oe_off = 48,
+               .access = 54,
+               .rd_cycle = 72,
+               .wr_cycle = 72,
 
-       .access = 54,
-       .rd_cycle = 72,
-       .wr_cycle = 72,
-
-       .wr_access = 30,
-       .wr_data_mux_bus = 0,
+               .wr_access = 30,
+               .wr_data_mux_bus = 0,
+       },
 };
 
-static struct omap_nand_platform_data board_nand_data = {
-       .gpmc_t         = &nand_timings,
-};
+static struct omap_nand_platform_data board_nand_data;
 
 void
-__init board_nand_init(struct mtd_partition *nand_parts,
-                       u8 nr_parts, u8 cs, int nand_type)
+__init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs,
+                               int nand_type, struct gpmc_timings *gpmc_t)
 {
        board_nand_data.cs              = cs;
        board_nand_data.parts           = nand_parts;
@@ -141,7 +140,7 @@ __init board_nand_init(struct mtd_partition *nand_parts,
        board_nand_data.devsize         = nand_type;
 
        board_nand_data.ecc_opt = OMAP_ECC_HAMMING_CODE_DEFAULT;
-       gpmc_nand_init(&board_nand_data);
+       gpmc_nand_init(&board_nand_data, gpmc_t);
 }
 #endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
 
@@ -238,5 +237,6 @@ void __init board_flash_init(struct flash_partitions partition_info[],
                pr_err("NAND: Unable to find configuration in GPMC\n");
        else
                board_nand_init(partition_info[2].parts,
-                       partition_info[2].nr_parts, nandcs, nand_type);
+                       partition_info[2].nr_parts, nandcs,
+                       nand_type, nand_default_timings);
 }
index c44b70d5202173a879519ea9ebf2cacdb1ac29d0..2fb5d41a9fae2679781a9c759913a032b1a69e9e 100644 (file)
@@ -12,7 +12,7 @@
  */
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
-#include <plat/gpmc.h>
+#include "gpmc.h"
 
 #define PDC_NOR                1
 #define PDC_NAND       2
@@ -40,12 +40,14 @@ static inline void board_flash_init(struct flash_partitions part[],
 #if defined(CONFIG_MTD_NAND_OMAP2) || \
                defined(CONFIG_MTD_NAND_OMAP2_MODULE)
 extern void board_nand_init(struct mtd_partition *nand_parts,
-                                       u8 nr_parts, u8 cs, int nand_type);
+               u8 nr_parts, u8 cs, int nand_type, struct gpmc_timings *gpmc_t);
+extern struct gpmc_timings nand_default_timings[];
 #else
 static inline void board_nand_init(struct mtd_partition *nand_parts,
-                                       u8 nr_parts, u8 cs, int nand_type)
+               u8 nr_parts, u8 cs, int nand_type, struct gpmc_timings *gpmc_t)
 {
 }
+#define        nand_default_timings    NULL
 #endif
 
 #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
index 601ecdfb1cf9b88217caf49a3d8a9eedc34e6411..f0715a369c44b80af01759e67c22cc2f274fba54 100644 (file)
@@ -57,7 +57,7 @@ DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
        .init_machine   = omap_generic_init,
        .timer          = &omap2_timer,
        .dt_compat      = omap242x_boards_compat,
-       .restart        = omap_prcm_restart,
+       .restart        = omap2xxx_restart,
 MACHINE_END
 #endif
 
@@ -76,7 +76,7 @@ DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
        .init_machine   = omap_generic_init,
        .timer          = &omap2_timer,
        .dt_compat      = omap243x_boards_compat,
-       .restart        = omap_prcm_restart,
+       .restart        = omap2xxx_restart,
 MACHINE_END
 #endif
 
@@ -95,7 +95,24 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
        .init_machine   = omap_generic_init,
        .timer          = &omap3_timer,
        .dt_compat      = omap3_boards_compat,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
+MACHINE_END
+
+static const char *omap3_gp_boards_compat[] __initdata = {
+       "ti,omap3-beagle",
+       NULL,
+};
+
+DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)")
+       .reserve        = omap_reserve,
+       .map_io         = omap3_map_io,
+       .init_early     = omap3430_init_early,
+       .init_irq       = omap_intc_of_init,
+       .handle_irq     = omap3_intc_handle_irq,
+       .init_machine   = omap_generic_init,
+       .timer          = &omap3_secure_timer,
+       .dt_compat      = omap3_gp_boards_compat,
+       .restart        = omap3xxx_restart,
 MACHINE_END
 #endif
 
@@ -134,7 +151,7 @@ DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
        .init_late      = omap4430_init_late,
        .timer          = &omap4_timer,
        .dt_compat      = omap4_boards_compat,
-       .restart        = omap_prcm_restart,
+       .restart        = omap44xx_restart,
 MACHINE_END
 #endif
 
@@ -154,6 +171,6 @@ DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
        .init_machine   = omap_generic_init,
        .timer          = &omap5_timer,
        .dt_compat      = omap5_boards_compat,
-       .restart        = omap_prcm_restart,
+       .restart        = omap44xx_restart,
 MACHINE_END
 #endif
index 8d04bf851af44e36568f4824a0d3cbb84760d566..b626dbe6f7bc0f891d74734cd4d7bbecc6f82edc 100644 (file)
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/input/matrix_keypad.h>
+#include <linux/mfd/menelaus.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <plat/menelaus.h>
-#include <plat/dma.h>
-#include <plat/gpmc.h>
-#include "debug-devices.h"
+#include <plat-omap/dma-omap.h>
+#include <plat/debug-devices.h>
 
 #include <video/omapdss.h>
 #include <video/omap-panel-generic-dpi.h>
@@ -42,6 +41,7 @@
 #include "common.h"
 #include "mux.h"
 #include "control.h"
+#include "gpmc.h"
 
 #define H4_FLASH_CS    0
 #define H4_SMC91X_CS   1
@@ -386,5 +386,5 @@ MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
        .init_machine   = omap_h4_init,
        .init_late      = omap2420_init_late,
        .timer          = &omap2_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap2xxx_restart,
 MACHINE_END
index 48d5e41dfbfabe3da59ef00f7457f5012cf2ec1a..cea5d529262809989042d2d1a799b5bc43816e1b 100644 (file)
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
-#include "common.h"
-#include <plat/gpmc.h>
-#include <plat/usb.h>
-
 #include <video/omapdss.h>
 #include <video/omap-panel-tfp410.h>
 #include <linux/platform_data/mtd-onenand-omap2.h>
 
+#include "common.h"
+#include "gpmc.h"
 #include "mux.h"
 #include "hsmmc.h"
 #include "sdram-numonyx-m65kxxxxam.h"
 #include "common-board-devices.h"
 #include "board-flash.h"
 #include "control.h"
+#include "gpmc-onenand.h"
 
 #define IGEP2_SMSC911X_CS       5
 #define IGEP2_SMSC911X_GPIO     176
@@ -175,7 +174,7 @@ static void __init igep_flash_init(void)
                pr_info("IGEP: initializing NAND memory device\n");
                board_nand_init(igep_flash_partitions,
                                ARRAY_SIZE(igep_flash_partitions),
-                               0, NAND_BUSWIDTH_16);
+                               0, NAND_BUSWIDTH_16, nand_default_timings);
        } else if (mux == IGEP_SYSBOOT_ONENAND) {
                pr_info("IGEP: initializing OneNAND memory device\n");
                board_onenand_init(igep_flash_partitions,
@@ -652,7 +651,7 @@ MACHINE_START(IGEP0020, "IGEP v2 board")
        .init_machine   = igep_init,
        .init_late      = omap35xx_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
 
 MACHINE_START(IGEP0030, "IGEP OMAP3 module")
@@ -665,5 +664,5 @@ MACHINE_START(IGEP0030, "IGEP OMAP3 module")
        .init_machine   = igep_init,
        .init_late      = omap35xx_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index ee8c3cfb95b392a50e207577679b7383dbc3aee1..0869f4f3d3e11264fce04e29b02c5e046f61193f 100644 (file)
@@ -35,9 +35,8 @@
 #include <asm/mach/map.h>
 
 #include "common.h"
-#include <plat/gpmc.h>
-#include <mach/board-zoom.h>
-#include <plat/usb.h>
+#include "board-zoom.h"
+#include "gpmc.h"
 #include "gpmc-smsc911x.h"
 
 #include <video/omapdss.h>
@@ -420,8 +419,8 @@ static void __init omap_ldp_init(void)
        omap_serial_init();
        omap_sdrc_init(NULL, NULL);
        usb_musb_init(NULL);
-       board_nand_init(ldp_nand_partitions,
-               ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0);
+       board_nand_init(ldp_nand_partitions, ARRAY_SIZE(ldp_nand_partitions),
+                       ZOOM_NAND_CS, 0, nand_default_timings);
 
        omap_hsmmc_init(mmc);
        ldp_display_init();
@@ -437,5 +436,5 @@ MACHINE_START(OMAP_LDP, "OMAP LDP board")
        .init_machine   = omap_ldp_init,
        .init_late      = omap3430_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index d95f727ca39a1c2297c98ff9f2aca78e170b1feb..a4e167c55c1d45b516c54c0cf4531353be0568df 100644 (file)
 #include <linux/usb/musb.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <linux/platform_data/mtd-onenand-omap2.h>
+#include <linux/mfd/menelaus.h>
 #include <sound/tlv320aic3x.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
 
 #include "common.h"
-#include <plat/menelaus.h>
-#include <plat/mmc.h>
+#include "mmc.h"
 
 #include "mux.h"
+#include "gpmc-onenand.h"
 
 #define TUSB6010_ASYNC_CS      1
 #define TUSB6010_SYNC_CS       4
@@ -689,7 +690,7 @@ MACHINE_START(NOKIA_N800, "Nokia N800")
        .init_machine   = n8x0_init_machine,
        .init_late      = omap2420_init_late,
        .timer          = &omap2_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap2xxx_restart,
 MACHINE_END
 
 MACHINE_START(NOKIA_N810, "Nokia N810")
@@ -702,7 +703,7 @@ MACHINE_START(NOKIA_N810, "Nokia N810")
        .init_machine   = n8x0_init_machine,
        .init_late      = omap2420_init_late,
        .timer          = &omap2_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap2xxx_restart,
 MACHINE_END
 
 MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
@@ -715,5 +716,5 @@ MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
        .init_machine   = n8x0_init_machine,
        .init_late      = omap2420_init_late,
        .timer          = &omap2_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap2xxx_restart,
 MACHINE_END
index d41ab98890ffcc45731c7625b3ad7f44d53bb855..22c483d5dfa829891fd8ec9ece81f35c94cf152b 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/flash.h>
 
-#include "common.h"
 #include <video/omapdss.h>
 #include <video/omap-panel-tfp410.h>
-#include <plat/gpmc.h>
 #include <linux/platform_data/mtd-nand-omap2.h>
-#include <plat/usb.h>
-#include <plat/omap_device.h>
 
+#include "common.h"
+#include "omap_device.h"
+#include "gpmc.h"
+#include "soc.h"
 #include "mux.h"
 #include "hsmmc.h"
 #include "pm.h"
+#include "board-flash.h"
 #include "common-board-devices.h"
 
+#define        NAND_CS 0
+
 /*
  * OMAP3 Beagle revision
  * Run time detection of Beagle revision is done by reading GPIO.
@@ -518,8 +521,9 @@ static void __init omap3_beagle_init(void)
 
        usb_musb_init(NULL);
        usbhs_init(&usbhs_bdata);
-       omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions,
-                            ARRAY_SIZE(omap3beagle_nand_partitions));
+       board_nand_init(omap3beagle_nand_partitions,
+                       ARRAY_SIZE(omap3beagle_nand_partitions), NAND_CS,
+                       NAND_BUSWIDTH_16, NULL);
        omap_twl4030_audio_init("omap3beagle");
 
        /* Ensure msecure is mux'd to be able to set the RTC. */
@@ -541,5 +545,5 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
        .init_machine   = omap3_beagle_init,
        .init_late      = omap3_init_late,
        .timer          = &omap3_secure_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index b9b776b6c954c9a519f6ae2dee868b815a79d990..54647d6286b4d401b1952e6f9768c94e3a616b16 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/spi/ads7846.h>
 #include <linux/i2c/twl.h>
 #include <linux/usb/otg.h>
+#include <linux/usb/musb.h>
 #include <linux/usb/nop-usb-xceiv.h>
 #include <linux/smsc911x.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <plat/usb.h>
 #include <linux/platform_data/mtd-nand-omap2.h>
 #include "common.h"
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <video/omapdss.h>
 #include <video/omap-panel-tfp410.h>
 
+#include "soc.h"
 #include "mux.h"
 #include "sdram-micron-mt46h32m32lf-6.h"
 #include "hsmmc.h"
 #include "common-board-devices.h"
+#include "board-flash.h"
+
+#define        NAND_CS                 0
 
 #define OMAP3_EVM_TS_GPIO      175
 #define OMAP3_EVM_EHCI_VBUS    22
@@ -731,8 +735,9 @@ static void __init omap3_evm_init(void)
        }
        usb_musb_init(&musb_board_data);
        usbhs_init(&usbhs_bdata);
-       omap_nand_flash_init(NAND_BUSWIDTH_16, omap3evm_nand_partitions,
-                            ARRAY_SIZE(omap3evm_nand_partitions));
+       board_nand_init(omap3evm_nand_partitions,
+                       ARRAY_SIZE(omap3evm_nand_partitions), NAND_CS,
+                       NAND_BUSWIDTH_16, NULL);
 
        omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
        omap3evm_init_smsc911x();
@@ -752,5 +757,5 @@ MACHINE_START(OMAP3EVM, "OMAP3 EVM")
        .init_machine   = omap3_evm_init,
        .init_late      = omap35xx_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index 7bd8253b5d1d61613ac6ad2e702a4efea26e5787..2a065ba6eb58b9c3da2c265d5616e19904263716 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include "gpmc-smsc911x.h"
-#include <plat/gpmc.h>
-#include <plat/sdrc.h>
-#include <plat/usb.h>
-
 #include "common.h"
 #include "mux.h"
 #include "hsmmc.h"
 #include "control.h"
 #include "common-board-devices.h"
+#include "gpmc.h"
+#include "gpmc-smsc911x.h"
 
 #define OMAP3LOGIC_SMSC911X_CS                 1
 
@@ -235,7 +232,7 @@ MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
        .init_machine   = omap3logic_init,
        .init_late      = omap35xx_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
 
 MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
@@ -248,5 +245,5 @@ MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
        .init_machine   = omap3logic_init,
        .init_late      = omap35xx_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index 00a1f4ae6e4497c7bf62584e13470556fa329428..a53a6683c1b8b103f88cb3e5e1019a04a6b751a4 100644 (file)
@@ -42,7 +42,6 @@
 #include <asm/mach/map.h>
 
 #include "common.h"
-#include <plat/usb.h>
 #include <video/omapdss.h>
 #include <linux/platform_data/mtd-nand-omap2.h>
 
@@ -50,6 +49,7 @@
 #include "sdram-micron-mt46h32m32lf-6.h"
 #include "hsmmc.h"
 #include "common-board-devices.h"
+#include "gpmc-nand.h"
 
 #define PANDORA_WIFI_IRQ_GPIO          21
 #define PANDORA_WIFI_NRESET_GPIO       23
@@ -602,7 +602,7 @@ static void __init omap3pandora_init(void)
        omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL);
        usbhs_init(&usbhs_bdata);
        usb_musb_init(NULL);
-       gpmc_nand_init(&pandora_nand_data);
+       gpmc_nand_init(&pandora_nand_data, NULL);
 
        /* Ensure SDRC pins are mux'd for self-refresh */
        omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
@@ -619,5 +619,5 @@ MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
        .init_machine   = omap3pandora_init,
        .init_late      = omap35xx_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index 731235eb319e7456c10a20d2405d4d54bf5cff5d..d8638b3b4f9407ccf959784b1798b8ac957e50f0 100644 (file)
@@ -40,9 +40,8 @@
 #include <asm/mach/flash.h>
 
 #include "common.h"
-#include <plat/gpmc.h>
+#include "gpmc.h"
 #include <linux/platform_data/mtd-nand-omap2.h>
-#include <plat/usb.h>
 #include <video/omapdss.h>
 #include <video/omap-panel-generic-dpi.h>
 #include <video/omap-panel-tfp410.h>
@@ -428,5 +427,5 @@ MACHINE_START(SBC3530, "OMAP3 STALKER")
        .init_machine           = omap3_stalker_init,
        .init_late              = omap35xx_init_late,
        .timer                  = &omap3_secure_timer,
-       .restart                = omap_prcm_restart,
+       .restart                = omap3xxx_restart,
 MACHINE_END
index 944ffc436577f9fce420cf088af116329cb26132..263cb9cfbf3783e1c95d540bd807d652276725f3 100644 (file)
 #include <asm/system_info.h>
 
 #include "common.h"
-#include <plat/gpmc.h>
+#include "gpmc.h"
 #include <linux/platform_data/mtd-nand-omap2.h>
-#include <plat/usb.h>
 
 #include "mux.h"
 #include "hsmmc.h"
+#include "board-flash.h"
 #include "common-board-devices.h"
 
 #include <asm/setup.h>
@@ -59,6 +59,8 @@
 #define TB_BL_PWM_TIMER                9
 #define TB_KILL_POWER_GPIO     168
 
+#define        NAND_CS                 0
+
 static unsigned long touchbook_revision;
 
 static struct mtd_partition omap3touchbook_nand_partitions[] = {
@@ -365,8 +367,9 @@ static void __init omap3_touchbook_init(void)
        omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata);
        usb_musb_init(NULL);
        usbhs_init(&usbhs_bdata);
-       omap_nand_flash_init(NAND_BUSWIDTH_16, omap3touchbook_nand_partitions,
-                            ARRAY_SIZE(omap3touchbook_nand_partitions));
+       board_nand_init(omap3touchbook_nand_partitions,
+                       ARRAY_SIZE(omap3touchbook_nand_partitions), NAND_CS,
+                       NAND_BUSWIDTH_16, NULL);
 
        /* Ensure SDRC pins are mux'd for self-refresh */
        omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
@@ -384,5 +387,5 @@ MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board")
        .init_machine   = omap3_touchbook_init,
        .init_late      = omap3430_init_late,
        .timer          = &omap3_secure_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index bfcd397e233c8750ee2d92f85b025d70c02c0699..12a3a24d5bb5e79079147da5a216f232460ca6d7 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/regulator/machine.h>
 #include <linux/regulator/fixed.h>
 #include <linux/ti_wilink_st.h>
+#include <linux/usb/musb.h>
 #include <linux/wl12xx.h>
 #include <linux/platform_data/omap-abe-twl6040.h>
 
 #include <asm/mach/map.h>
 #include <video/omapdss.h>
 
-#include "common.h"
-#include <plat/usb.h>
-#include <plat/mmc.h>
 #include <video/omap-panel-tfp410.h>
 
+#include "common.h"
 #include "soc.h"
+#include "mmc.h"
 #include "hsmmc.h"
 #include "control.h"
 #include "mux.h"
@@ -524,5 +524,5 @@ MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
        .init_machine   = omap4_panda_init,
        .init_late      = omap4430_init_late,
        .timer          = &omap4_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap44xx_restart,
 MACHINE_END
index b700685762b50b70242f823e22bf393b2ebe4943..140b73094aff14efcd38f421c4fb8b2b6a03e602 100644 (file)
 #include <video/omapdss.h>
 #include <video/omap-panel-generic-dpi.h>
 #include <video/omap-panel-tfp410.h>
-#include <plat/gpmc.h>
-#include <plat/usb.h>
 
+#include "common.h"
 #include "mux.h"
 #include "sdram-micron-mt46h32m32lf-6.h"
+#include "gpmc.h"
 #include "hsmmc.h"
+#include "board-flash.h"
 #include "common-board-devices.h"
 
+#define        NAND_CS                 0
+
 #define OVERO_GPIO_BT_XGATE    15
 #define OVERO_GPIO_W2W_NRESET  16
 #define OVERO_GPIO_PENDOWN     114
@@ -495,8 +498,8 @@ static void __init overo_init(void)
        omap_serial_init();
        omap_sdrc_init(mt46h32m32lf6_sdrc_params,
                                  mt46h32m32lf6_sdrc_params);
-       omap_nand_flash_init(0, overo_nand_partitions,
-                            ARRAY_SIZE(overo_nand_partitions));
+       board_nand_init(overo_nand_partitions,
+                       ARRAY_SIZE(overo_nand_partitions), NAND_CS, 0, NULL);
        usb_musb_init(NULL);
        usbhs_init(&usbhs_bdata);
        overo_spi_init();
@@ -550,5 +553,5 @@ MACHINE_START(OVERO, "Gumstix Overo")
        .init_machine   = overo_init,
        .init_late      = omap35xx_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index 45997bfbcbd2e8b14eb94930eb9e227180a3b286..cbcb1b2dc31faa4da395ccb5c399ee54f98fc8cf 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
 
-#include <plat/i2c.h>
-#include <plat/mmc.h>
-#include <plat/usb.h>
-#include <plat/gpmc.h>
 #include "common.h"
-#include <plat/serial.h>
-
 #include "mux.h"
+#include "gpmc.h"
+#include "mmc.h"
 #include "hsmmc.h"
 #include "sdram-nokia.h"
 #include "common-board-devices.h"
+#include "gpmc-onenand.h"
 
 static struct regulator_consumer_supply rm680_vemmc_consumers[] = {
        REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
@@ -151,7 +148,7 @@ MACHINE_START(NOKIA_RM680, "Nokia RM-680 board")
        .init_machine   = rm680_init,
        .init_late      = omap3630_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
 
 MACHINE_START(NOKIA_RM696, "Nokia RM-696 board")
@@ -164,5 +161,5 @@ MACHINE_START(NOKIA_RM696, "Nokia RM-696 board")
        .init_machine   = rm680_init,
        .init_late      = omap3630_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index 020e03c95bfe0843bdf9bac22f0077f6a4ce906f..07005fe40a2a65eecc529ea9d06fee342ff26150 100644 (file)
@@ -31,9 +31,7 @@
 #include <asm/system_info.h>
 
 #include "common.h"
-#include <plat/dma.h>
-#include <plat/gpmc.h>
-#include <plat/omap-pm.h>
+#include <plat-omap/dma-omap.h>
 #include "gpmc-smc91x.h"
 
 #include "board-rx51.h"
 #endif
 
 #include "mux.h"
+#include "omap-pm.h"
 #include "hsmmc.h"
 #include "common-board-devices.h"
+#include "gpmc.h"
+#include "gpmc-onenand.h"
 
 #define SYSTEM_REV_B_USES_VAUX3        0x1699
 #define SYSTEM_REV_S_USES_VAUX3 0x8
index 7bbb05d9689b806534b6b83bed6b1a2c6e1dd9cb..bf8f74b0ce3e745312089649f29f42340bb5e1dd 100644 (file)
 #include <linux/io.h>
 #include <linux/gpio.h>
 #include <linux/leds.h>
+#include <linux/usb/musb.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include "common.h"
-#include <plat/dma.h>
-#include <plat/gpmc.h>
-#include <plat/usb.h>
+#include <plat-omap/dma-omap.h>
 
+#include "common.h"
 #include "mux.h"
+#include "gpmc.h"
 #include "pm.h"
 #include "sdram-nokia.h"
 
@@ -127,5 +127,5 @@ MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
        .init_machine   = rx51_init,
        .init_late      = omap3430_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index c4f8833b4c3c66a7eaa433622be930e7f5833f97..1a3e056d63a76afbb9f5b621c9d3f41d08428fc7 100644 (file)
  */
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/usb/musb.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
 #include "common.h"
-#include <plat/usb.h>
 
 static struct omap_musb_board_data musb_board_data = {
        .set_phy_power  = ti81xx_musb_phy_power,
@@ -45,7 +46,7 @@ MACHINE_START(TI8168EVM, "ti8168evm")
        .timer          = &omap3_timer,
        .init_machine   = ti81xx_evm_init,
        .init_late      = ti81xx_init_late,
-       .restart        = omap_prcm_restart,
+       .restart        = omap44xx_restart,
 MACHINE_END
 
 MACHINE_START(TI8148EVM, "ti8148evm")
@@ -57,5 +58,5 @@ MACHINE_START(TI8148EVM, "ti8148evm")
        .timer          = &omap3_timer,
        .init_machine   = ti81xx_evm_init,
        .init_late      = ti81xx_init_late,
-       .restart        = omap_prcm_restart,
+       .restart        = omap44xx_restart,
 MACHINE_END
index afb2278a29f6456c07f7c2d06b0c7a07d5957ca1..42e5f231a799560866d5ed53e653c593a0b6a267 100644 (file)
 #include <linux/regulator/fixed.h>
 #include <linux/regulator/machine.h>
 
-#include <plat/gpmc.h>
+#include "gpmc.h"
 #include "gpmc-smsc911x.h"
 
-#include <mach/board-zoom.h>
+#include "board-zoom.h"
 
 #include "soc.h"
 #include "common.h"
index b940ab2259fb19705b892bc03a7f1b1ef1d36aa7..1c7c834a5b5f5fb819dc56b6c8bc01edfc62f4d8 100644 (file)
@@ -16,8 +16,9 @@
 #include <linux/spi/spi.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <video/omapdss.h>
-#include <mach/board-zoom.h>
+#include "board-zoom.h"
 
+#include "soc.h"
 #include "common.h"
 
 #define LCD_PANEL_RESET_GPIO_PROD      96
index c166fe1fdff9bbf1d92a276a72df028c8f89993f..26e07addc9d72b1c5540c1020043d171fe00a211 100644 (file)
@@ -26,9 +26,8 @@
 #include <asm/mach/map.h>
 
 #include "common.h"
-#include <plat/usb.h>
 
-#include <mach/board-zoom.h>
+#include "board-zoom.h"
 
 #include "mux.h"
 #include "hsmmc.h"
index 4994438e1f46cbdee5fee1f26d74afb2a596e7fb..d7fa31e672387043aedeaaa872e499d1219daa27 100644 (file)
@@ -22,9 +22,8 @@
 #include <asm/mach/arch.h>
 
 #include "common.h"
-#include <plat/usb.h>
 
-#include <mach/board-zoom.h>
+#include "board-zoom.h"
 
 #include "board-flash.h"
 #include "mux.h"
@@ -113,8 +112,9 @@ static void __init omap_zoom_init(void)
                usbhs_init(&usbhs_bdata);
        }
 
-       board_nand_init(zoom_nand_partitions, ARRAY_SIZE(zoom_nand_partitions),
-                                               ZOOM_NAND_CS, NAND_BUSWIDTH_16);
+       board_nand_init(zoom_nand_partitions,
+                       ARRAY_SIZE(zoom_nand_partitions), ZOOM_NAND_CS,
+                       NAND_BUSWIDTH_16, nand_default_timings);
        zoom_debugboard_init();
        zoom_peripherals_init();
 
@@ -138,7 +138,7 @@ MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
        .init_machine   = omap_zoom_init,
        .init_late      = omap3430_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
 
 MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
@@ -151,5 +151,5 @@ MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
        .init_machine   = omap_zoom_init,
        .init_late      = omap3630_init_late,
        .timer          = &omap3_timer,
-       .restart        = omap_prcm_restart,
+       .restart        = omap3xxx_restart,
 MACHINE_END
index c2d15212d64d768530e1b94b9d8cf4ad0ff8cec9..8c5b13e7ee61eaa8ab92a17c1ff3862de11ae2c3 100644 (file)
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/clock.h>
-#include <plat/prcm.h>
 
 #include "clock.h"
 #include "clock2xxx.h"
-#include "cm2xxx_3xxx.h"
+#include "cm2xxx.h"
 #include "cm-regbits-24xx.h"
 
 /* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */
 #define APLLS_CLKIN_13MHZ              2
 #define APLLS_CLKIN_12MHZ              3
 
-void __iomem *cm_idlest_pll;
-
 /* Private functions */
 
-/* Enable an APLL if off */
-static int omap2_clk_apll_enable(struct clk *clk, u32 status_mask)
-{
-       u32 cval, apll_mask;
-
-       apll_mask = EN_APLL_LOCKED << clk->enable_bit;
-
-       cval = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
-
-       if ((cval & apll_mask) == apll_mask)
-               return 0;   /* apll already enabled */
-
-       cval &= ~apll_mask;
-       cval |= apll_mask;
-       omap2_cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
-
-       omap2_cm_wait_idlest(cm_idlest_pll, status_mask,
-                            OMAP24XX_CM_IDLEST_VAL, __clk_get_name(clk));
-
-       /*
-        * REVISIT: Should we return an error code if omap2_wait_clock_ready()
-        * fails?
-        */
-       return 0;
-}
-
-static int omap2_clk_apll96_enable(struct clk *clk)
+static int _apll96_enable(struct clk *clk)
 {
-       return omap2_clk_apll_enable(clk, OMAP24XX_ST_96M_APLL_MASK);
+       return omap2xxx_cm_apll96_enable();
 }
 
-static int omap2_clk_apll54_enable(struct clk *clk)
+static int _apll54_enable(struct clk *clk)
 {
-       return omap2_clk_apll_enable(clk, OMAP24XX_ST_54M_APLL_MASK);
+       return omap2xxx_cm_apll54_enable();
 }
 
 static void _apll96_allow_idle(struct clk *clk)
@@ -98,28 +68,28 @@ static void _apll54_deny_idle(struct clk *clk)
        omap2xxx_cm_set_apll54_disable_autoidle();
 }
 
-/* Stop APLL */
-static void omap2_clk_apll_disable(struct clk *clk)
+static void _apll96_disable(struct clk *clk)
 {
-       u32 cval;
+       omap2xxx_cm_apll96_disable();
+}
 
-       cval = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
-       cval &= ~(EN_APLL_LOCKED << clk->enable_bit);
-       omap2_cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
+static void _apll54_disable(struct clk *clk)
+{
+       omap2xxx_cm_apll54_disable();
 }
 
 /* Public data */
 
 const struct clkops clkops_apll96 = {
-       .enable         = omap2_clk_apll96_enable,
-       .disable        = omap2_clk_apll_disable,
+       .enable         = _apll96_enable,
+       .disable        = _apll96_disable,
        .allow_idle     = _apll96_allow_idle,
        .deny_idle      = _apll96_deny_idle,
 };
 
 const struct clkops clkops_apll54 = {
-       .enable         = omap2_clk_apll54_enable,
-       .disable        = omap2_clk_apll_disable,
+       .enable         = _apll54_enable,
+       .disable        = _apll54_disable,
        .allow_idle     = _apll54_allow_idle,
        .deny_idle      = _apll54_deny_idle,
 };
index 1502a7bc20bb2dbaa67a129c1aa5e18cb1d389f3..399534c7843b353800de1740239d8dceecb87033 100644 (file)
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/clock.h>
-
 #include "clock.h"
-#include "cm2xxx_3xxx.h"
+#include "cm2xxx.h"
 #include "cm-regbits-24xx.h"
 
 /* Private functions */
index 4ae439222085d3839fc32663e51240c4620a175c..825e44cdf1cf80cb76fe25865a59f109d2b0e66f 100644 (file)
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/clock.h>
-#include <plat/sram.h>
-#include <plat/sdrc.h>
-
 #include "clock.h"
 #include "clock2xxx.h"
 #include "opp2xxx.h"
-#include "cm2xxx_3xxx.h"
+#include "cm2xxx.h"
 #include "cm-regbits-24xx.h"
+#include "sdrc.h"
+#include "sram.h"
 
 /* #define DOWN_VARIABLE_DPLL 1 */             /* Experimental */
 
+/*
+ * dpll_core_ck: pointer to the combined dpll_ck + core_ck on OMAP2xxx
+ * (currently defined as "dpll_ck" in the OMAP2xxx clock tree).  Set
+ * during dpll_ck init and used later by omap2xxx_clk_get_core_rate().
+ */
+static struct clk *dpll_core_ck;
+
 /**
  * omap2xxx_clk_get_core_rate - return the CORE_CLK rate
- * @clk: pointer to the combined dpll_ck + core_ck (currently "dpll_ck")
  *
  * Returns the CORE_CLK rate.  CORE_CLK can have one of three rate
  * sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz
  * struct clk *dpll_ck, which is a composite clock of dpll_ck and
  * core_ck.
  */
-unsigned long omap2xxx_clk_get_core_rate(struct clk *clk)
+unsigned long omap2xxx_clk_get_core_rate(void)
 {
        long long core_clk;
        u32 v;
 
-       core_clk = omap2_get_dpll_rate(clk);
+       WARN_ON(!dpll_core_ck);
+
+       core_clk = omap2_get_dpll_rate(dpll_core_ck);
 
        v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
        v &= OMAP24XX_CORE_CLK_SRC_MASK;
@@ -100,7 +106,7 @@ static long omap2_dpllcore_round_rate(unsigned long target_rate)
 
 unsigned long omap2_dpllcore_recalc(struct clk *clk)
 {
-       return omap2xxx_clk_get_core_rate(clk);
+       return omap2xxx_clk_get_core_rate();
 }
 
 int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
@@ -110,7 +116,7 @@ int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
        struct prcm_config tmpset;
        const struct dpll_data *dd;
 
-       cur_rate = omap2xxx_clk_get_core_rate(dclk);
+       cur_rate = omap2xxx_clk_get_core_rate();
        mult = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
        mult &= OMAP24XX_CORE_CLK_SRC_MASK;
 
@@ -171,3 +177,19 @@ int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
        return 0;
 }
 
+/**
+ * omap2xxx_clkt_dpllcore_init - clk init function for dpll_ck
+ * @clk: struct clk *dpll_ck
+ *
+ * Store a local copy of @clk in dpll_core_ck so other code can query
+ * the core rate without having to clk_get(), which can sleep.  Must
+ * only be called once.  No return value.  XXX If the clock
+ * registration process is ever changed such that dpll_ck is no longer
+ * statically defined, this code may need to change to increment some
+ * kind of use count on dpll_ck.
+ */
+void omap2xxx_clkt_dpllcore_init(struct clk *clk)
+{
+       WARN(dpll_core_ck, "dpll_core_ck already set - should never happen");
+       dpll_core_ck = clk;
+}
index c3460928b5e0df94b436bb72b688b7cea7fe9668..e1777371bb5e9813c4c41baf664eb2eb3e3170c2 100644 (file)
@@ -23,8 +23,6 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/clock.h>
-
 #include "clock.h"
 #include "clock2xxx.h"
 #include "prm2xxx_3xxx.h"
index 8693cfdac49afcc53dd213b93cb1eca21b3ccd3e..46683b3c2461be67fecb1422a7ae4da82ca954de 100644 (file)
@@ -22,8 +22,6 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/clock.h>
-
 #include "clock.h"
 #include "clock2xxx.h"
 #include "prm2xxx_3xxx.h"
index 3524f0e7b6d5b0db13975d978850dc6fc42f4480..1c2041fbd71820ad8de6fa1bd66cc1a20bb68e2d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP2xxx DVFS virtual clock functions
  *
- * Copyright (C) 2005-2008 Texas Instruments, Inc.
+ * Copyright (C) 2005-2008, 2012 Texas Instruments, Inc.
  * Copyright (C) 2004-2010 Nokia Corporation
  *
  * Contacts:
 #include <linux/cpufreq.h>
 #include <linux/slab.h>
 
-#include <plat/clock.h>
-#include <plat/sram.h>
-#include <plat/sdrc.h>
-
 #include "soc.h"
 #include "clock.h"
 #include "clock2xxx.h"
 #include "opp2xxx.h"
-#include "cm2xxx_3xxx.h"
+#include "cm2xxx.h"
 #include "cm-regbits-24xx.h"
+#include "sdrc.h"
+#include "sram.h"
 
 const struct prcm_config *curr_prcm_set;
 const struct prcm_config *rate_table;
 
+/*
+ * sys_ck_rate: the rate of the external high-frequency clock
+ * oscillator on the board.  Set by the SoC-specific clock init code.
+ * Once set during a boot, will not change.
+ */
+static unsigned long sys_ck_rate;
+
 /**
  * omap2_table_mpu_recalc - just return the MPU speed
  * @clk: virt_prcm_set struct clk
@@ -68,15 +73,14 @@ unsigned long omap2_table_mpu_recalc(struct clk *clk)
 long omap2_round_to_table_rate(struct clk *clk, unsigned long rate)
 {
        const struct prcm_config *ptr;
-       long highest_rate, sys_clk_rate;
+       long highest_rate;
 
        highest_rate = -EINVAL;
-       sys_clk_rate = __clk_get_rate(sclk);
 
        for (ptr = rate_table; ptr->mpu_speed; ptr++) {
                if (!(ptr->flags & cpu_mask))
                        continue;
-               if (ptr->xtal_speed != sys_clk_rate)
+               if (ptr->xtal_speed != sys_ck_rate)
                        continue;
 
                highest_rate = ptr->mpu_speed;
@@ -95,15 +99,12 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
        const struct prcm_config *prcm;
        unsigned long found_speed = 0;
        unsigned long flags;
-       long sys_clk_rate;
-
-       sys_clk_rate = __clk_get_rate(sclk);
 
        for (prcm = rate_table; prcm->mpu_speed; prcm++) {
                if (!(prcm->flags & cpu_mask))
                        continue;
 
-               if (prcm->xtal_speed != sys_clk_rate)
+               if (prcm->xtal_speed != sys_ck_rate)
                        continue;
 
                if (prcm->mpu_speed <= rate) {
@@ -119,7 +120,7 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
        }
 
        curr_prcm_set = prcm;
-       cur_rate = omap2xxx_clk_get_core_rate(dclk);
+       cur_rate = omap2xxx_clk_get_core_rate();
 
        if (prcm->dpll_speed == cur_rate / 2) {
                omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1);
@@ -169,3 +170,50 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
 
        return 0;
 }
+
+/**
+ * omap2xxx_clkt_vps_check_bootloader_rate - determine which of the rate
+ * table sets matches the current CORE DPLL hardware rate
+ *
+ * Check the MPU rate set by bootloader.  Sets the 'curr_prcm_set'
+ * global to point to the active rate set when found; otherwise, sets
+ * it to NULL.  No return value;
+ */
+void omap2xxx_clkt_vps_check_bootloader_rates(void)
+{
+       const struct prcm_config *prcm = NULL;
+       unsigned long rate;
+
+       rate = omap2xxx_clk_get_core_rate();
+       for (prcm = rate_table; prcm->mpu_speed; prcm++) {
+               if (!(prcm->flags & cpu_mask))
+                       continue;
+               if (prcm->xtal_speed != sys_ck_rate)
+                       continue;
+               if (prcm->dpll_speed <= rate)
+                       break;
+       }
+       curr_prcm_set = prcm;
+}
+
+/**
+ * omap2xxx_clkt_vps_late_init - store a copy of the sys_ck rate
+ *
+ * Store a copy of the sys_ck rate for later use by the OMAP2xxx DVFS
+ * code.  (The sys_ck rate does not -- or rather, must not -- change
+ * during kernel runtime.)  Must be called after we have a valid
+ * sys_ck rate, but before the virt_prcm_set clock rate is
+ * recalculated.  No return value.
+ */
+void omap2xxx_clkt_vps_late_init(void)
+{
+       struct clk *c;
+
+       c = clk_get(NULL, "sys_ck");
+       if (IS_ERR(c)) {
+               WARN(1, "could not locate sys_ck\n");
+       } else {
+               sys_ck_rate = clk_get_rate(c);
+               clk_put(c);
+       }
+}
index 7c6da2f731dc75683512af15df6510886f03c1e8..6cf298e262f61fdabdc85fd40f2e7bea00442abe 100644 (file)
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/clock.h>
-#include <plat/sram.h>
-#include <plat/sdrc.h>
-
 #include "clock.h"
 #include "clock3xxx.h"
 #include "clock34xx.h"
 #include "sdrc.h"
+#include "sram.h"
 
 #define CYCLES_PER_MHZ                 1000000
 
index 3ff22114d702468192c781fe12ae72144691e509..53646facda45fe246df6b6eb264e896a527441fa 100644 (file)
@@ -45,8 +45,6 @@
 #include <linux/io.h>
 #include <linux/bug.h>
 
-#include <plat/clock.h>
-
 #include "clock.h"
 
 /* Private functions */
index 80411142f4823c9626115fb5847f87f35d7f1d8c..8463cc3562450155ee1a5b6eee6f506ba9366d89 100644 (file)
@@ -21,8 +21,6 @@
 
 #include <asm/div64.h>
 
-#include <plat/clock.h>
-
 #include "soc.h"
 #include "clock.h"
 #include "cm-regbits-24xx.h"
index 3d43fba2542f2a477bb1e908bc2baaa45658dbbc..fe774a09dd0cf32dd11ab99a952943b9a1523cb9 100644 (file)
@@ -14,8 +14,6 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/clock.h>
-#include <plat/prcm.h>
 
 #include "clock.h"
 #include "clock2xxx.h"
index 961ac8f7e13d8c84a1cbb4587255ea685520bd18..e381d991092c83385964b9b75010eddc5107896f 100644 (file)
@@ -15,6 +15,7 @@
 #undef DEBUG
 
 #include <linux/kernel.h>
+#include <linux/export.h>
 #include <linux/list.h>
 #include <linux/errno.h>
 #include <linux/err.h>
 
 #include <asm/cpu.h>
 
-#include <plat/clock.h>
-#include <plat/prcm.h>
 
 #include <trace/events/power.h>
 
 #include "soc.h"
 #include "clockdomain.h"
 #include "clock.h"
-#include "cm2xxx_3xxx.h"
+#include "cm.h"
+#include "cm2xxx.h"
+#include "cm3xxx.h"
 #include "cm-regbits-24xx.h"
 #include "cm-regbits-34xx.h"
+#include "common.h"
+
+/*
+ * MAX_MODULE_ENABLE_WAIT: maximum of number of microseconds to wait
+ * for a module to indicate that it is no longer in idle
+ */
+#define MAX_MODULE_ENABLE_WAIT         100000
 
 u16 cpu_mask;
 
@@ -47,12 +55,50 @@ u16 cpu_mask;
  */
 static bool clkdm_control = true;
 
+static LIST_HEAD(clocks);
+static DEFINE_MUTEX(clocks_mutex);
+static DEFINE_SPINLOCK(clockfw_lock);
+
 /*
  * OMAP2+ specific clock functions
  */
 
 /* Private functions */
 
+
+/**
+ * _wait_idlest_generic - wait for a module to leave the idle state
+ * @reg: virtual address of module IDLEST register
+ * @mask: value to mask against to determine if the module is active
+ * @idlest: idle state indicator (0 or 1) for the clock
+ * @name: name of the clock (for printk)
+ *
+ * Wait for a module to leave idle, where its idle-status register is
+ * not inside the CM module.  Returns 1 if the module left idle
+ * promptly, or 0 if the module did not leave idle before the timeout
+ * elapsed.  XXX Deprecated - should be moved into drivers for the
+ * individual IP block that the IDLEST register exists in.
+ */
+static int _wait_idlest_generic(void __iomem *reg, u32 mask, u8 idlest,
+                               const char *name)
+{
+       int i = 0, ena = 0;
+
+       ena = (idlest) ? 0 : mask;
+
+       omap_test_timeout(((__raw_readl(reg) & mask) == ena),
+                         MAX_MODULE_ENABLE_WAIT, i);
+
+       if (i < MAX_MODULE_ENABLE_WAIT)
+               pr_debug("omap clock: module associated with clock %s ready after %d loops\n",
+                        name, i);
+       else
+               pr_err("omap clock: module associated with clock %s didn't enable in %d tries\n",
+                      name, MAX_MODULE_ENABLE_WAIT);
+
+       return (i < MAX_MODULE_ENABLE_WAIT) ? 1 : 0;
+};
+
 /**
  * _omap2_module_wait_ready - wait for an OMAP module to leave IDLE
  * @clk: struct clk * belonging to the module
@@ -66,7 +112,9 @@ static bool clkdm_control = true;
 static void _omap2_module_wait_ready(struct clk *clk)
 {
        void __iomem *companion_reg, *idlest_reg;
-       u8 other_bit, idlest_bit, idlest_val;
+       u8 other_bit, idlest_bit, idlest_val, idlest_reg_id;
+       s16 prcm_mod;
+       int r;
 
        /* Not all modules have multiple clocks that their IDLEST depends on */
        if (clk->ops->find_companion) {
@@ -77,8 +125,14 @@ static void _omap2_module_wait_ready(struct clk *clk)
 
        clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val);
 
-       omap2_cm_wait_idlest(idlest_reg, (1 << idlest_bit), idlest_val,
-                            __clk_get_name(clk));
+       r = cm_split_idlest_reg(idlest_reg, &prcm_mod, &idlest_reg_id);
+       if (r) {
+               /* IDLEST register not in the CM module */
+               _wait_idlest_generic(idlest_reg, (1 << idlest_bit), idlest_val,
+                                    clk->name);
+       } else {
+               cm_wait_module_ready(prcm_mod, idlest_reg_id, idlest_bit);
+       };
 }
 
 /* Public functions */
@@ -512,12 +566,510 @@ void __init omap2_clk_print_new_rates(const char *hfclkin_ck_name,
 
 /* Common data */
 
-struct clk_functions omap2_clk_functions = {
-       .clk_enable             = omap2_clk_enable,
-       .clk_disable            = omap2_clk_disable,
-       .clk_round_rate         = omap2_clk_round_rate,
-       .clk_set_rate           = omap2_clk_set_rate,
-       .clk_set_parent         = omap2_clk_set_parent,
-       .clk_disable_unused     = omap2_clk_disable_unused,
+int clk_enable(struct clk *clk)
+{
+       unsigned long flags;
+       int ret;
+
+       if (clk == NULL || IS_ERR(clk))
+               return -EINVAL;
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+       ret = omap2_clk_enable(clk);
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+
+       return ret;
+}
+EXPORT_SYMBOL(clk_enable);
+
+void clk_disable(struct clk *clk)
+{
+       unsigned long flags;
+
+       if (clk == NULL || IS_ERR(clk))
+               return;
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+       if (clk->usecount == 0) {
+               pr_err("Trying disable clock %s with 0 usecount\n",
+                      clk->name);
+               WARN_ON(1);
+               goto out;
+       }
+
+       omap2_clk_disable(clk);
+
+out:
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+}
+EXPORT_SYMBOL(clk_disable);
+
+unsigned long clk_get_rate(struct clk *clk)
+{
+       unsigned long flags;
+       unsigned long ret;
+
+       if (clk == NULL || IS_ERR(clk))
+               return 0;
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+       ret = clk->rate;
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+
+       return ret;
+}
+EXPORT_SYMBOL(clk_get_rate);
+
+/*
+ * Optional clock functions defined in include/linux/clk.h
+ */
+
+long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+       unsigned long flags;
+       long ret;
+
+       if (clk == NULL || IS_ERR(clk))
+               return 0;
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+       ret = omap2_clk_round_rate(clk, rate);
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+
+       return ret;
+}
+EXPORT_SYMBOL(clk_round_rate);
+
+int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+       unsigned long flags;
+       int ret = -EINVAL;
+
+       if (clk == NULL || IS_ERR(clk))
+               return ret;
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+       ret = omap2_clk_set_rate(clk, rate);
+       if (ret == 0)
+               propagate_rate(clk);
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+
+       return ret;
+}
+EXPORT_SYMBOL(clk_set_rate);
+
+int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+       unsigned long flags;
+       int ret = -EINVAL;
+
+       if (clk == NULL || IS_ERR(clk) || parent == NULL || IS_ERR(parent))
+               return ret;
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+       if (clk->usecount == 0) {
+               ret = omap2_clk_set_parent(clk, parent);
+               if (ret == 0)
+                       propagate_rate(clk);
+       } else {
+               ret = -EBUSY;
+       }
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+
+       return ret;
+}
+EXPORT_SYMBOL(clk_set_parent);
+
+struct clk *clk_get_parent(struct clk *clk)
+{
+       return clk->parent;
+}
+EXPORT_SYMBOL(clk_get_parent);
+
+/*
+ * OMAP specific clock functions shared between omap1 and omap2
+ */
+
+int __initdata mpurate;
+
+/*
+ * By default we use the rate set by the bootloader.
+ * You can override this with mpurate= cmdline option.
+ */
+static int __init omap_clk_setup(char *str)
+{
+       get_option(&str, &mpurate);
+
+       if (!mpurate)
+               return 1;
+
+       if (mpurate < 1000)
+               mpurate *= 1000000;
+
+       return 1;
+}
+__setup("mpurate=", omap_clk_setup);
+
+/* Used for clocks that always have same value as the parent clock */
+unsigned long followparent_recalc(struct clk *clk)
+{
+       return clk->parent->rate;
+}
+
+/*
+ * Used for clocks that have the same value as the parent clock,
+ * divided by some factor
+ */
+unsigned long omap_fixed_divisor_recalc(struct clk *clk)
+{
+       WARN_ON(!clk->fixed_div);
+
+       return clk->parent->rate / clk->fixed_div;
+}
+
+void clk_reparent(struct clk *child, struct clk *parent)
+{
+       list_del_init(&child->sibling);
+       if (parent)
+               list_add(&child->sibling, &parent->children);
+       child->parent = parent;
+
+       /* now do the debugfs renaming to reattach the child
+          to the proper parent */
+}
+
+/* Propagate rate to children */
+void propagate_rate(struct clk *tclk)
+{
+       struct clk *clkp;
+
+       list_for_each_entry(clkp, &tclk->children, sibling) {
+               if (clkp->recalc)
+                       clkp->rate = clkp->recalc(clkp);
+               propagate_rate(clkp);
+       }
+}
+
+static LIST_HEAD(root_clks);
+
+/**
+ * recalculate_root_clocks - recalculate and propagate all root clocks
+ *
+ * Recalculates all root clocks (clocks with no parent), which if the
+ * clock's .recalc is set correctly, should also propagate their rates.
+ * Called at init.
+ */
+void recalculate_root_clocks(void)
+{
+       struct clk *clkp;
+
+       list_for_each_entry(clkp, &root_clks, sibling) {
+               if (clkp->recalc)
+                       clkp->rate = clkp->recalc(clkp);
+               propagate_rate(clkp);
+       }
+}
+
+/**
+ * clk_preinit - initialize any fields in the struct clk before clk init
+ * @clk: struct clk * to initialize
+ *
+ * Initialize any struct clk fields needed before normal clk initialization
+ * can run.  No return value.
+ */
+void clk_preinit(struct clk *clk)
+{
+       INIT_LIST_HEAD(&clk->children);
+}
+
+int clk_register(struct clk *clk)
+{
+       if (clk == NULL || IS_ERR(clk))
+               return -EINVAL;
+
+       /*
+        * trap out already registered clocks
+        */
+       if (clk->node.next || clk->node.prev)
+               return 0;
+
+       mutex_lock(&clocks_mutex);
+       if (clk->parent)
+               list_add(&clk->sibling, &clk->parent->children);
+       else
+               list_add(&clk->sibling, &root_clks);
+
+       list_add(&clk->node, &clocks);
+       if (clk->init)
+               clk->init(clk);
+       mutex_unlock(&clocks_mutex);
+
+       return 0;
+}
+EXPORT_SYMBOL(clk_register);
+
+void clk_unregister(struct clk *clk)
+{
+       if (clk == NULL || IS_ERR(clk))
+               return;
+
+       mutex_lock(&clocks_mutex);
+       list_del(&clk->sibling);
+       list_del(&clk->node);
+       mutex_unlock(&clocks_mutex);
+}
+EXPORT_SYMBOL(clk_unregister);
+
+void clk_enable_init_clocks(void)
+{
+       struct clk *clkp;
+
+       list_for_each_entry(clkp, &clocks, node)
+               if (clkp->flags & ENABLE_ON_INIT)
+                       clk_enable(clkp);
+}
+
+/**
+ * omap_clk_get_by_name - locate OMAP struct clk by its name
+ * @name: name of the struct clk to locate
+ *
+ * Locate an OMAP struct clk by its name.  Assumes that struct clk
+ * names are unique.  Returns NULL if not found or a pointer to the
+ * struct clk if found.
+ */
+struct clk *omap_clk_get_by_name(const char *name)
+{
+       struct clk *c;
+       struct clk *ret = NULL;
+
+       mutex_lock(&clocks_mutex);
+
+       list_for_each_entry(c, &clocks, node) {
+               if (!strcmp(c->name, name)) {
+                       ret = c;
+                       break;
+               }
+       }
+
+       mutex_unlock(&clocks_mutex);
+
+       return ret;
+}
+
+int omap_clk_enable_autoidle_all(void)
+{
+       struct clk *c;
+       unsigned long flags;
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+
+       list_for_each_entry(c, &clocks, node)
+               if (c->ops->allow_idle)
+                       c->ops->allow_idle(c);
+
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+
+       return 0;
+}
+
+int omap_clk_disable_autoidle_all(void)
+{
+       struct clk *c;
+       unsigned long flags;
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+
+       list_for_each_entry(c, &clocks, node)
+               if (c->ops->deny_idle)
+                       c->ops->deny_idle(c);
+
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+
+       return 0;
+}
+
+/*
+ * Low level helpers
+ */
+static int clkll_enable_null(struct clk *clk)
+{
+       return 0;
+}
+
+static void clkll_disable_null(struct clk *clk)
+{
+}
+
+const struct clkops clkops_null = {
+       .enable         = clkll_enable_null,
+       .disable        = clkll_disable_null,
+};
+
+/*
+ * Dummy clock
+ *
+ * Used for clock aliases that are needed on some OMAPs, but not others
+ */
+struct clk dummy_ck = {
+       .name   = "dummy",
+       .ops    = &clkops_null,
+};
+
+/*
+ *
+ */
+
+#ifdef CONFIG_OMAP_RESET_CLOCKS
+/*
+ * Disable any unused clocks left on by the bootloader
+ */
+static int __init clk_disable_unused(void)
+{
+       struct clk *ck;
+       unsigned long flags;
+
+       pr_info("clock: disabling unused clocks to save power\n");
+
+       spin_lock_irqsave(&clockfw_lock, flags);
+       list_for_each_entry(ck, &clocks, node) {
+               if (ck->ops == &clkops_null)
+                       continue;
+
+               if (ck->usecount > 0 || !ck->enable_reg)
+                       continue;
+
+               omap2_clk_disable_unused(ck);
+       }
+       spin_unlock_irqrestore(&clockfw_lock, flags);
+
+       return 0;
+}
+late_initcall(clk_disable_unused);
+late_initcall(omap_clk_enable_autoidle_all);
+#endif
+
+#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
+/*
+ *     debugfs support to trace clock tree hierarchy and attributes
+ */
+
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
+
+static struct dentry *clk_debugfs_root;
+
+static int clk_dbg_show_summary(struct seq_file *s, void *unused)
+{
+       struct clk *c;
+       struct clk *pa;
+
+       mutex_lock(&clocks_mutex);
+       seq_printf(s, "%-30s %-30s %-10s %s\n",
+                  "clock-name", "parent-name", "rate", "use-count");
+
+       list_for_each_entry(c, &clocks, node) {
+               pa = c->parent;
+               seq_printf(s, "%-30s %-30s %-10lu %d\n",
+                          c->name, pa ? pa->name : "none", c->rate,
+                          c->usecount);
+       }
+       mutex_unlock(&clocks_mutex);
+
+       return 0;
+}
+
+static int clk_dbg_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, clk_dbg_show_summary, inode->i_private);
+}
+
+static const struct file_operations debug_clock_fops = {
+       .open           = clk_dbg_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = single_release,
 };
 
+static int clk_debugfs_register_one(struct clk *c)
+{
+       int err;
+       struct dentry *d;
+       struct clk *pa = c->parent;
+
+       d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root);
+       if (!d)
+               return -ENOMEM;
+       c->dent = d;
+
+       d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usecount);
+       if (!d) {
+               err = -ENOMEM;
+               goto err_out;
+       }
+       d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
+       if (!d) {
+               err = -ENOMEM;
+               goto err_out;
+       }
+       d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
+       if (!d) {
+               err = -ENOMEM;
+               goto err_out;
+       }
+       return 0;
+
+err_out:
+       debugfs_remove_recursive(c->dent);
+       return err;
+}
+
+static int clk_debugfs_register(struct clk *c)
+{
+       int err;
+       struct clk *pa = c->parent;
+
+       if (pa && !pa->dent) {
+               err = clk_debugfs_register(pa);
+               if (err)
+                       return err;
+       }
+
+       if (!c->dent) {
+               err = clk_debugfs_register_one(c);
+               if (err)
+                       return err;
+       }
+       return 0;
+}
+
+static int __init clk_debugfs_init(void)
+{
+       struct clk *c;
+       struct dentry *d;
+       int err;
+
+       d = debugfs_create_dir("clock", NULL);
+       if (!d)
+               return -ENOMEM;
+       clk_debugfs_root = d;
+
+       list_for_each_entry(c, &clocks, node) {
+               err = clk_debugfs_register(c);
+               if (err)
+                       goto err_out;
+       }
+
+       d = debugfs_create_file("summary", S_IRUGO,
+               d, NULL, &debug_clock_fops);
+       if (!d)
+               return -ENOMEM;
+
+       return 0;
+err_out:
+       debugfs_remove_recursive(clk_debugfs_root);
+       return err;
+}
+late_initcall(clk_debugfs_init);
+
+#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
+
index 35ec5f3d9a7361ee0b60647002a2a5251880580f..ff9789bc0fd1a1697fb2bac2d0b7574f75ae5a26 100644 (file)
 #define __ARCH_ARM_MACH_OMAP2_CLOCK_H
 
 #include <linux/kernel.h>
+#include <linux/list.h>
+
+#include <linux/clkdev.h>
+
+struct omap_clk {
+       u16                             cpu;
+       struct clk_lookup               lk;
+};
+
+#define CLK(dev, con, ck, cp)          \
+       {                               \
+                .cpu = cp,             \
+               .lk = {                 \
+                       .dev_id = dev,  \
+                       .con_id = con,  \
+                       .clk = ck,      \
+               },                      \
+       }
+
+/* Platform flags for the clkdev-OMAP integration code */
+#define CK_242X                (1 << 0)
+#define CK_243X                (1 << 1)        /* 243x, 253x */
+#define CK_3430ES1     (1 << 2)        /* 34xxES1 only */
+#define CK_3430ES2PLUS (1 << 3)        /* 34xxES2, ES3, non-Sitara 35xx only */
+#define CK_AM35XX      (1 << 4)        /* Sitara AM35xx */
+#define CK_36XX                (1 << 5)        /* 36xx/37xx-specific clocks */
+#define CK_443X                (1 << 6)
+#define CK_TI816X      (1 << 7)
+#define CK_446X                (1 << 8)
+#define CK_AM33XX      (1 << 9)        /* AM33xx specific clocks */
+
+
+#define CK_34XX                (CK_3430ES1 | CK_3430ES2PLUS)
+#define CK_3XXX                (CK_34XX | CK_AM35XX | CK_36XX)
+
+struct module;
+struct clk;
+struct clockdomain;
+
+/* Temporary, needed during the common clock framework conversion */
+#define __clk_get_name(clk)    (clk->name)
+#define __clk_get_parent(clk)  (clk->parent)
+#define __clk_get_rate(clk)    (clk->rate)
+
+/**
+ * struct clkops - some clock function pointers
+ * @enable: fn ptr that enables the current clock in hardware
+ * @disable: fn ptr that enables the current clock in hardware
+ * @find_idlest: function returning the IDLEST register for the clock's IP blk
+ * @find_companion: function returning the "companion" clk reg for the clock
+ * @allow_idle: fn ptr that enables autoidle for the current clock in hardware
+ * @deny_idle: fn ptr that disables autoidle for the current clock in hardware
+ *
+ * A "companion" clk is an accompanying clock to the one being queried
+ * that must be enabled for the IP module connected to the clock to
+ * become accessible by the hardware.  Neither @find_idlest nor
+ * @find_companion should be needed; that information is IP
+ * block-specific; the hwmod code has been created to handle this, but
+ * until hwmod data is ready and drivers have been converted to use PM
+ * runtime calls in place of clk_enable()/clk_disable(), @find_idlest and
+ * @find_companion must, unfortunately, remain.
+ */
+struct clkops {
+       int                     (*enable)(struct clk *);
+       void                    (*disable)(struct clk *);
+       void                    (*find_idlest)(struct clk *, void __iomem **,
+                                              u8 *, u8 *);
+       void                    (*find_companion)(struct clk *, void __iomem **,
+                                                 u8 *);
+       void                    (*allow_idle)(struct clk *);
+       void                    (*deny_idle)(struct clk *);
+};
+
+/* struct clksel_rate.flags possibilities */
+#define RATE_IN_242X           (1 << 0)
+#define RATE_IN_243X           (1 << 1)
+#define RATE_IN_3430ES1                (1 << 2)        /* 3430ES1 rates only */
+#define RATE_IN_3430ES2PLUS    (1 << 3)        /* 3430 ES >= 2 rates only */
+#define RATE_IN_36XX           (1 << 4)
+#define RATE_IN_4430           (1 << 5)
+#define RATE_IN_TI816X         (1 << 6)
+#define RATE_IN_4460           (1 << 7)
+#define RATE_IN_AM33XX         (1 << 8)
+#define RATE_IN_TI814X         (1 << 9)
+
+#define RATE_IN_24XX           (RATE_IN_242X | RATE_IN_243X)
+#define RATE_IN_34XX           (RATE_IN_3430ES1 | RATE_IN_3430ES2PLUS)
+#define RATE_IN_3XXX           (RATE_IN_34XX | RATE_IN_36XX)
+#define RATE_IN_44XX           (RATE_IN_4430 | RATE_IN_4460)
+
+/* RATE_IN_3430ES2PLUS_36XX includes 34xx/35xx with ES >=2, and all 36xx/37xx */
+#define RATE_IN_3430ES2PLUS_36XX       (RATE_IN_3430ES2PLUS | RATE_IN_36XX)
+
+
+/**
+ * struct clksel_rate - register bitfield values corresponding to clk divisors
+ * @val: register bitfield value (shifted to bit 0)
+ * @div: clock divisor corresponding to @val
+ * @flags: (see "struct clksel_rate.flags possibilities" above)
+ *
+ * @val should match the value of a read from struct clk.clksel_reg
+ * AND'ed with struct clk.clksel_mask, shifted right to bit 0.
+ *
+ * @div is the divisor that should be applied to the parent clock's rate
+ * to produce the current clock's rate.
+ */
+struct clksel_rate {
+       u32                     val;
+       u8                      div;
+       u16                     flags;
+};
+
+/**
+ * struct clksel - available parent clocks, and a pointer to their divisors
+ * @parent: struct clk * to a possible parent clock
+ * @rates: available divisors for this parent clock
+ *
+ * A struct clksel is always associated with one or more struct clks
+ * and one or more struct clksel_rates.
+ */
+struct clksel {
+       struct clk               *parent;
+       const struct clksel_rate *rates;
+};
+
+/**
+ * struct dpll_data - DPLL registers and integration data
+ * @mult_div1_reg: register containing the DPLL M and N bitfields
+ * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg
+ * @div1_mask: mask of the DPLL N bitfield in @mult_div1_reg
+ * @clk_bypass: struct clk pointer to the clock's bypass clock input
+ * @clk_ref: struct clk pointer to the clock's reference clock input
+ * @control_reg: register containing the DPLL mode bitfield
+ * @enable_mask: mask of the DPLL mode bitfield in @control_reg
+ * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate()
+ * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate()
+ * @max_multiplier: maximum valid non-bypass multiplier value (actual)
+ * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate()
+ * @min_divider: minimum valid non-bypass divider value (actual)
+ * @max_divider: maximum valid non-bypass divider value (actual)
+ * @modes: possible values of @enable_mask
+ * @autoidle_reg: register containing the DPLL autoidle mode bitfield
+ * @idlest_reg: register containing the DPLL idle status bitfield
+ * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg
+ * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg
+ * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg
+ * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg
+ * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs
+ * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs
+ * @flags: DPLL type/features (see below)
+ *
+ * Possible values for @flags:
+ * DPLL_J_TYPE: "J-type DPLL" (only some 36xx, 4xxx DPLLs)
+ *
+ * @freqsel_mask is only used on the OMAP34xx family and AM35xx.
+ *
+ * XXX Some DPLLs have multiple bypass inputs, so it's not technically
+ * correct to only have one @clk_bypass pointer.
+ *
+ * XXX The runtime-variable fields (@last_rounded_rate, @last_rounded_m,
+ * @last_rounded_n) should be separated from the runtime-fixed fields
+ * and placed into a different structure, so that the runtime-fixed data
+ * can be placed into read-only space.
+ */
+struct dpll_data {
+       void __iomem            *mult_div1_reg;
+       u32                     mult_mask;
+       u32                     div1_mask;
+       struct clk              *clk_bypass;
+       struct clk              *clk_ref;
+       void __iomem            *control_reg;
+       u32                     enable_mask;
+       unsigned long           last_rounded_rate;
+       u16                     last_rounded_m;
+       u16                     max_multiplier;
+       u8                      last_rounded_n;
+       u8                      min_divider;
+       u16                     max_divider;
+       u8                      modes;
+       void __iomem            *autoidle_reg;
+       void __iomem            *idlest_reg;
+       u32                     autoidle_mask;
+       u32                     freqsel_mask;
+       u32                     idlest_mask;
+       u32                     dco_mask;
+       u32                     sddiv_mask;
+       u8                      auto_recal_bit;
+       u8                      recal_en_bit;
+       u8                      recal_st_bit;
+       u8                      flags;
+};
+
+/*
+ * struct clk.flags possibilities
+ *
+ * XXX document the rest of the clock flags here
+ *
+ * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL
+ *     bits share the same register.  This flag allows the
+ *     omap4_dpllmx*() code to determine which GATE_CTRL bit field
+ *     should be used.  This is a temporary solution - a better approach
+ *     would be to associate clock type-specific data with the clock,
+ *     similar to the struct dpll_data approach.
+ */
+#define ENABLE_REG_32BIT       (1 << 0)        /* Use 32-bit access */
+#define CLOCK_IDLE_CONTROL     (1 << 1)
+#define CLOCK_NO_IDLE_PARENT   (1 << 2)
+#define ENABLE_ON_INIT         (1 << 3)        /* Enable upon framework init */
+#define INVERT_ENABLE          (1 << 4)        /* 0 enables, 1 disables */
+#define CLOCK_CLKOUTX2         (1 << 5)
+
+/**
+ * struct clk - OMAP struct clk
+ * @node: list_head connecting this clock into the full clock list
+ * @ops: struct clkops * for this clock
+ * @name: the name of the clock in the hardware (used in hwmod data and debug)
+ * @parent: pointer to this clock's parent struct clk
+ * @children: list_head connecting to the child clks' @sibling list_heads
+ * @sibling: list_head connecting this clk to its parent clk's @children
+ * @rate: current clock rate
+ * @enable_reg: register to write to enable the clock (see @enable_bit)
+ * @recalc: fn ptr that returns the clock's current rate
+ * @set_rate: fn ptr that can change the clock's current rate
+ * @round_rate: fn ptr that can round the clock's current rate
+ * @init: fn ptr to do clock-specific initialization
+ * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
+ * @usecount: number of users that have requested this clock to be enabled
+ * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div
+ * @flags: see "struct clk.flags possibilities" above
+ * @clksel_reg: for clksel clks, register va containing src/divisor select
+ * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector
+ * @clksel: for clksel clks, pointer to struct clksel for this clock
+ * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock
+ * @clkdm_name: clockdomain name that this clock is contained in
+ * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime
+ * @rate_offset: bitshift for rate selection bitfield (OMAP1 only)
+ * @src_offset: bitshift for source selection bitfield (OMAP1 only)
+ *
+ * XXX @rate_offset, @src_offset should probably be removed and OMAP1
+ * clock code converted to use clksel.
+ *
+ * XXX @usecount is poorly named.  It should be "enable_count" or
+ * something similar.  "users" in the description refers to kernel
+ * code (core code or drivers) that have called clk_enable() and not
+ * yet called clk_disable(); the usecount of parent clocks is also
+ * incremented by the clock code when clk_enable() is called on child
+ * clocks and decremented by the clock code when clk_disable() is
+ * called on child clocks.
+ *
+ * XXX @clkdm, @usecount, @children, @sibling should be marked for
+ * internal use only.
+ *
+ * @children and @sibling are used to optimize parent-to-child clock
+ * tree traversals.  (child-to-parent traversals use @parent.)
+ *
+ * XXX The notion of the clock's current rate probably needs to be
+ * separated from the clock's target rate.
+ */
+struct clk {
+       struct list_head        node;
+       const struct clkops     *ops;
+       const char              *name;
+       struct clk              *parent;
+       struct list_head        children;
+       struct list_head        sibling;        /* node for children */
+       unsigned long           rate;
+       void __iomem            *enable_reg;
+       unsigned long           (*recalc)(struct clk *);
+       int                     (*set_rate)(struct clk *, unsigned long);
+       long                    (*round_rate)(struct clk *, unsigned long);
+       void                    (*init)(struct clk *);
+       u8                      enable_bit;
+       s8                      usecount;
+       u8                      fixed_div;
+       u8                      flags;
+       void __iomem            *clksel_reg;
+       u32                     clksel_mask;
+       const struct clksel     *clksel;
+       struct dpll_data        *dpll_data;
+       const char              *clkdm_name;
+       struct clockdomain      *clkdm;
+#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
+       struct dentry           *dent;  /* For visible tree hierarchy */
+#endif
+};
+
+struct clk_functions {
+       int             (*clk_enable)(struct clk *clk);
+       void            (*clk_disable)(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);
+       void            (*clk_allow_idle)(struct clk *clk);
+       void            (*clk_deny_idle)(struct clk *clk);
+       void            (*clk_disable_unused)(struct clk *clk);
+};
+
+extern int mpurate;
+
+extern int clk_init(struct clk_functions *custom_clocks);
+extern void clk_preinit(struct clk *clk);
+extern int clk_register(struct clk *clk);
+extern void clk_reparent(struct clk *child, struct clk *parent);
+extern void clk_unregister(struct clk *clk);
+extern void propagate_rate(struct clk *clk);
+extern void recalculate_root_clocks(void);
+extern unsigned long followparent_recalc(struct clk *clk);
+extern void clk_enable_init_clocks(void);
+unsigned long omap_fixed_divisor_recalc(struct clk *clk);
+extern struct clk *omap_clk_get_by_name(const char *name);
+extern int omap_clk_enable_autoidle_all(void);
+extern int omap_clk_disable_autoidle_all(void);
+
+extern const struct clkops clkops_null;
+
+extern struct clk dummy_ck;
 
-#include <plat/clock.h>
 
 /* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */
 #define CORE_CLK_SRC_32K               0x0
@@ -94,33 +409,6 @@ extern void omap2_clkt_iclk_deny_idle(struct clk *clk);
 u32 omap2_get_dpll_rate(struct clk *clk);
 void omap2_init_dpll_parent(struct clk *clk);
 
-int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name);
-
-
-#ifdef CONFIG_ARCH_OMAP2
-void omap2xxx_clk_prepare_for_reboot(void);
-#else
-static inline void omap2xxx_clk_prepare_for_reboot(void)
-{
-}
-#endif
-
-#ifdef CONFIG_ARCH_OMAP3
-void omap3_clk_prepare_for_reboot(void);
-#else
-static inline void omap3_clk_prepare_for_reboot(void)
-{
-}
-#endif
-
-#ifdef CONFIG_ARCH_OMAP4
-void omap4_clk_prepare_for_reboot(void);
-#else
-static inline void omap4_clk_prepare_for_reboot(void)
-{
-}
-#endif
-
 int omap2_dflt_clk_enable(struct clk *clk);
 void omap2_dflt_clk_disable(struct clk *clk);
 void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,
@@ -139,7 +427,6 @@ extern const struct clkops clkops_dummy;
 extern const struct clkops clkops_omap2_dflt;
 
 extern struct clk_functions omap2_clk_functions;
-extern struct clk *vclk, *sclk;
 
 extern const struct clksel_rate gpt_32k_rates[];
 extern const struct clksel_rate gpt_sys_rates[];
index c3cde1a2b6de6d71956043cbd72054b6f3052438..608874b651e828540fd6f3c3016ff169ad0c07b5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP2420 clock data
  *
- * Copyright (C) 2005-2009 Texas Instruments, Inc.
+ * Copyright (C) 2005-2009, 2012 Texas Instruments, Inc.
  * Copyright (C) 2004-2011 Nokia Corporation
  *
  * Contacts:
 #include <linux/clk.h>
 #include <linux/list.h>
 
-#include <plat/clkdev_omap.h>
-
 #include "soc.h"
 #include "iomap.h"
 #include "clock.h"
 #include "clock2xxx.h"
 #include "opp2xxx.h"
-#include "cm2xxx_3xxx.h"
+#include "cm2xxx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm-regbits-24xx.h"
 #include "cm-regbits-24xx.h"
@@ -126,6 +124,7 @@ static struct clk dpll_ck = {
        .name           = "dpll_ck",
        .ops            = &clkops_omap2xxx_dpll_ops,
        .parent         = &sys_ck,              /* Can be func_32k also */
+       .init           = &omap2xxx_clkt_dpllcore_init,
        .dpll_data      = &dpll_dd,
        .clkdm_name     = "wkup_clkdm",
        .recalc         = &omap2_dpllcore_recalc,
@@ -1926,17 +1925,12 @@ static struct omap_clk omap2420_clks[] = {
 
 int __init omap2420_clk_init(void)
 {
-       const struct prcm_config *prcm;
        struct omap_clk *c;
-       u32 clkrate;
 
        prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL;
-       cm_idlest_pll = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST);
        cpu_mask = RATE_IN_242X;
        rate_table = omap2420_rate_table;
 
-       clk_init(&omap2_clk_functions);
-
        for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
             c++)
                clk_preinit(c->lk.clk);
@@ -1953,20 +1947,13 @@ int __init omap2420_clk_init(void)
                omap2_init_clk_clkdm(c->lk.clk);
        }
 
+       omap2xxx_clkt_vps_late_init();
+
        /* Disable autoidle on all clocks; let the PM code enable it later */
        omap_clk_disable_autoidle_all();
 
-       /* Check the MPU rate set by bootloader */
-       clkrate = omap2xxx_clk_get_core_rate(&dpll_ck);
-       for (prcm = rate_table; prcm->mpu_speed; prcm++) {
-               if (!(prcm->flags & cpu_mask))
-                       continue;
-               if (prcm->xtal_speed != sys_ck.rate)
-                       continue;
-               if (prcm->dpll_speed <= clkrate)
-                       break;
-       }
-       curr_prcm_set = prcm;
+       /* XXX Can this be done from the virt_prcm_set clk init function? */
+       omap2xxx_clkt_vps_check_bootloader_rates();
 
        recalculate_root_clocks();
 
@@ -1980,11 +1967,6 @@ int __init omap2420_clk_init(void)
         */
        clk_enable_init_clocks();
 
-       /* Avoid sleeping sleeping during omap2_clk_prepare_for_reboot() */
-       vclk = clk_get(NULL, "virt_prcm_set");
-       sclk = clk_get(NULL, "sys_ck");
-       dclk = clk_get(NULL, "dpll_ck");
-
        return 0;
 }
 
index a8e326177466dbf9bb7a23a44c2082ad4c37c081..e37df538bcd3235e5737b3e93e74c98bdeacfb71 100644 (file)
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/clock.h>
-
 #include "soc.h"
 #include "iomap.h"
 #include "clock.h"
 #include "clock2xxx.h"
-#include "cm2xxx_3xxx.h"
+#include "cm2xxx.h"
 #include "cm-regbits-24xx.h"
 
 /**
index 22404fe435e75369e288937b4b4e5d2e1969fd45..b179b6ef432984750e29279c440633535d43f5c0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP2430 clock data
  *
- * Copyright (C) 2005-2009 Texas Instruments, Inc.
+ * Copyright (C) 2005-2009, 2012 Texas Instruments, Inc.
  * Copyright (C) 2004-2011 Nokia Corporation
  *
  * Contacts:
 #include <linux/clk.h>
 #include <linux/list.h>
 
-#include <plat/clkdev_omap.h>
-
 #include "soc.h"
 #include "iomap.h"
 #include "clock.h"
 #include "clock2xxx.h"
 #include "opp2xxx.h"
-#include "cm2xxx_3xxx.h"
+#include "cm2xxx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm-regbits-24xx.h"
 #include "cm-regbits-24xx.h"
@@ -125,6 +123,7 @@ static struct clk dpll_ck = {
        .name           = "dpll_ck",
        .ops            = &clkops_omap2xxx_dpll_ops,
        .parent         = &sys_ck,              /* Can be func_32k also */
+       .init           = &omap2xxx_clkt_dpllcore_init,
        .dpll_data      = &dpll_dd,
        .clkdm_name     = "wkup_clkdm",
        .recalc         = &omap2_dpllcore_recalc,
@@ -2025,17 +2024,12 @@ static struct omap_clk omap2430_clks[] = {
 
 int __init omap2430_clk_init(void)
 {
-       const struct prcm_config *prcm;
        struct omap_clk *c;
-       u32 clkrate;
 
        prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL;
-       cm_idlest_pll = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST);
        cpu_mask = RATE_IN_243X;
        rate_table = omap2430_rate_table;
 
-       clk_init(&omap2_clk_functions);
-
        for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
             c++)
                clk_preinit(c->lk.clk);
@@ -2052,20 +2046,13 @@ int __init omap2430_clk_init(void)
                omap2_init_clk_clkdm(c->lk.clk);
        }
 
+       omap2xxx_clkt_vps_late_init();
+
        /* Disable autoidle on all clocks; let the PM code enable it later */
        omap_clk_disable_autoidle_all();
 
-       /* Check the MPU rate set by bootloader */
-       clkrate = omap2xxx_clk_get_core_rate(&dpll_ck);
-       for (prcm = rate_table; prcm->mpu_speed; prcm++) {
-               if (!(prcm->flags & cpu_mask))
-                       continue;
-               if (prcm->xtal_speed != sys_ck.rate)
-                       continue;
-               if (prcm->dpll_speed <= clkrate)
-                       break;
-       }
-       curr_prcm_set = prcm;
+       /* XXX Can this be done from the virt_prcm_set clk init function? */
+       omap2xxx_clkt_vps_check_bootloader_rates();
 
        recalculate_root_clocks();
 
@@ -2079,11 +2066,6 @@ int __init omap2430_clk_init(void)
         */
        clk_enable_init_clocks();
 
-       /* Avoid sleeping sleeping during omap2_clk_prepare_for_reboot() */
-       vclk = clk_get(NULL, "virt_prcm_set");
-       sclk = clk_get(NULL, "sys_ck");
-       dclk = clk_get(NULL, "dpll_ck");
-
        return 0;
 }
 
index e92be1fc1a00f7ccfeb2c7d11f83f22085de2b24..5f7faeb4c19b4ce995c595085f3d5d81ac1ccc02 100644 (file)
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/clock.h>
-
 #include "soc.h"
 #include "clock.h"
 #include "clock2xxx.h"
 #include "cm.h"
 #include "cm-regbits-24xx.h"
 
-struct clk *vclk, *sclk, *dclk;
-
 /*
  * Omap24xx specific clock functions
  */
 
-/*
- * Set clocks for bypass mode for reboot to work.
- */
-void omap2xxx_clk_prepare_for_reboot(void)
-{
-       u32 rate;
-
-       if (vclk == NULL || sclk == NULL)
-               return;
-
-       rate = clk_get_rate(sclk);
-       clk_set_rate(vclk, rate);
-}
-
 /*
  * Switch the MPU rate if specified on cmdline.  We cannot do this
  * early until cmdline is parsed.  XXX This should be removed from the
index cb6df8ca9e4a472443199d9f51b8ebd53fea5b98..ce809c913b6f29f7cc65741af5e0508f1f40a49d 100644 (file)
@@ -15,10 +15,13 @@ unsigned long omap2xxx_sys_clk_recalc(struct clk *clk);
 unsigned long omap2_osc_clk_recalc(struct clk *clk);
 unsigned long omap2_dpllcore_recalc(struct clk *clk);
 int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate);
-unsigned long omap2xxx_clk_get_core_rate(struct clk *clk);
+unsigned long omap2xxx_clk_get_core_rate(void);
 u32 omap2xxx_get_apll_clkin(void);
 u32 omap2xxx_get_sysclkdiv(void);
 void omap2xxx_clk_prepare_for_reboot(void);
+void omap2xxx_clkt_dpllcore_init(struct clk *clk);
+void omap2xxx_clkt_vps_check_bootloader_rates(void);
+void omap2xxx_clkt_vps_late_init(void);
 
 #ifdef CONFIG_SOC_OMAP2420
 int omap2420_clk_init(void);
@@ -32,9 +35,7 @@ int omap2430_clk_init(void);
 #define omap2430_clk_init()    do { } while(0)
 #endif
 
-extern void __iomem *prcm_clksrc_ctrl, *cm_idlest_pll;
-
-extern struct clk *dclk;
+extern void __iomem *prcm_clksrc_ctrl;
 
 extern const struct clkops clkops_omap2430_i2chs_wait;
 extern const struct clkops clkops_oscck;
index 1a45d6bd253921a9b8e8f646f568c868a0b4df85..17e3de51bcba24244ee3093295705d864b214ce3 100644 (file)
@@ -17,9 +17,8 @@
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/clk.h>
-#include <plat/clkdev_omap.h>
 
-#include "am33xx.h"
+#include "soc.h"
 #include "iomap.h"
 #include "control.h"
 #include "clock.h"
@@ -1087,8 +1086,6 @@ int __init am33xx_clk_init(void)
                cpu_clkflg = CK_AM33XX;
        }
 
-       clk_init(&omap2_clk_functions);
-
        for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++)
                clk_preinit(c->lk.clk);
 
index 1fc96b9ee330062171ae9e3ef81e32838ef99bae..e41819ba748239d593ab5305e13334130532aa1a 100644 (file)
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/clock.h>
-
 #include "clock.h"
 #include "clock34xx.h"
-#include "cm2xxx_3xxx.h"
+#include "cm3xxx.h"
 #include "cm-regbits-34xx.h"
 
 /**
index 2e97d08f0e567a1af1a3b7ee2cd1db1cdcb9098c..622ea05026107dd4332341791c9f8c3a4ede5ee7 100644 (file)
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/clock.h>
-
 #include "clock.h"
 #include "clock3517.h"
-#include "cm2xxx_3xxx.h"
+#include "cm3xxx.h"
 #include "cm-regbits-34xx.h"
 
 /*
index 0c5e25ed8879cb1e311905269a5486a35b0b2a70..0e1e9e4e2fa43e7b51fb921f6d5f222999f75f36 100644 (file)
@@ -22,8 +22,6 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/clock.h>
-
 #include "clock.h"
 #include "clock36xx.h"
 
index 83bb01427d405b4aa506c84882a4c522e8d58a7e..3e8aca2b1b61d71ec0da6382960088867ce5e0e9 100644 (file)
@@ -21,8 +21,6 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/clock.h>
-
 #include "soc.h"
 #include "clock.h"
 #include "clock3xxx.h"
index 1f42c9d5ecf3131b5f55fd6d2152912d44b2d9ff..6cca1995395020eab701b0bb6a27935bde2d6814 100644 (file)
@@ -21,8 +21,6 @@
 #include <linux/list.h>
 #include <linux/io.h>
 
-#include <plat/clkdev_omap.h>
-
 #include "soc.h"
 #include "iomap.h"
 #include "clock.h"
@@ -30,7 +28,7 @@
 #include "clock34xx.h"
 #include "clock36xx.h"
 #include "clock3517.h"
-#include "cm2xxx_3xxx.h"
+#include "cm3xxx.h"
 #include "cm-regbits-34xx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm-regbits-34xx.h"
@@ -3573,8 +3571,6 @@ int __init omap3xxx_clk_init(void)
        else
                dpll4_dd = dpll4_dd_34xx;
 
-       clk_init(&omap2_clk_functions);
-
        for (c = omap3xxx_clks; c < omap3xxx_clks + ARRAY_SIZE(omap3xxx_clks);
             c++)
                clk_preinit(c->lk.clk);
index 6efc30c961a5806dbecff3fb595bab1abfbc9082..2a450c9b9a7bd24bade47b3b1bcf0e544e084f0c 100644 (file)
@@ -28,8 +28,6 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/clkdev_omap.h>
-
 #include "soc.h"
 #include "iomap.h"
 #include "clock.h"
@@ -3366,8 +3364,6 @@ int __init omap4xxx_clk_init(void)
                return 0;
        }
 
-       clk_init(&omap2_clk_functions);
-
        /*
         * Must stay commented until all OMAP SoC drivers are
         * converted to runtime PM, or drivers may start crashing
index 512e79a842cb94760eddcf6223363511f08bac8c..64e50465a4b58dddbaa36af027ac775de211c978 100644 (file)
@@ -27,7 +27,8 @@
 
 #include <linux/bitops.h>
 
-#include <plat/clock.h>
+#include "soc.h"
+#include "clock.h"
 #include "clockdomain.h"
 
 /* clkdm_list contains all registered struct clockdomains */
index 629576be74445419fbc815fdfd8861cd2190943a..bc42446e23ab852fec7f5c268299b37160031351 100644 (file)
@@ -18,9 +18,8 @@
 #include <linux/spinlock.h>
 
 #include "powerdomain.h"
-#include <plat/clock.h>
-#include <plat/omap_hwmod.h>
-#include <plat/cpu.h>
+#include "clock.h"
+#include "omap_hwmod.h"
 
 /*
  * Clockdomain flags
diff --git a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
deleted file mode 100644 (file)
index 70294f5..0000000
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * OMAP2 and OMAP3 clockdomain control
- *
- * Copyright (C) 2008-2010 Texas Instruments, Inc.
- * Copyright (C) 2008-2010 Nokia Corporation
- *
- * Derived from mach-omap2/clockdomain.c written by Paul Walmsley
- * Rajendra Nayak <rnayak@ti.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/types.h>
-#include <plat/prcm.h>
-#include "prm.h"
-#include "prm2xxx_3xxx.h"
-#include "cm.h"
-#include "cm2xxx_3xxx.h"
-#include "cm-regbits-24xx.h"
-#include "cm-regbits-34xx.h"
-#include "prm-regbits-24xx.h"
-#include "clockdomain.h"
-
-static int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
-                                               struct clockdomain *clkdm2)
-{
-       omap2_prm_set_mod_reg_bits((1 << clkdm2->dep_bit),
-                               clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
-       return 0;
-}
-
-static int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1,
-                                                struct clockdomain *clkdm2)
-{
-       omap2_prm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
-                               clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
-       return 0;
-}
-
-static int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1,
-                                                struct clockdomain *clkdm2)
-{
-       return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
-                               PM_WKDEP, (1 << clkdm2->dep_bit));
-}
-
-static int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm)
-{
-       struct clkdm_dep *cd;
-       u32 mask = 0;
-
-       for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
-               if (!cd->clkdm)
-                       continue; /* only happens if data is erroneous */
-
-               /* PRM accesses are slow, so minimize them */
-               mask |= 1 << cd->clkdm->dep_bit;
-               atomic_set(&cd->wkdep_usecount, 0);
-       }
-
-       omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
-                                PM_WKDEP);
-       return 0;
-}
-
-static int omap3_clkdm_add_sleepdep(struct clockdomain *clkdm1,
-                                                struct clockdomain *clkdm2)
-{
-       omap2_cm_set_mod_reg_bits((1 << clkdm2->dep_bit),
-                               clkdm1->pwrdm.ptr->prcm_offs,
-                               OMAP3430_CM_SLEEPDEP);
-       return 0;
-}
-
-static int omap3_clkdm_del_sleepdep(struct clockdomain *clkdm1,
-                                                struct clockdomain *clkdm2)
-{
-       omap2_cm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
-                               clkdm1->pwrdm.ptr->prcm_offs,
-                               OMAP3430_CM_SLEEPDEP);
-       return 0;
-}
-
-static int omap3_clkdm_read_sleepdep(struct clockdomain *clkdm1,
-                                                struct clockdomain *clkdm2)
-{
-       return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
-                               OMAP3430_CM_SLEEPDEP, (1 << clkdm2->dep_bit));
-}
-
-static int omap3_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
-{
-       struct clkdm_dep *cd;
-       u32 mask = 0;
-
-       for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) {
-               if (!cd->clkdm)
-                       continue; /* only happens if data is erroneous */
-
-               /* PRM accesses are slow, so minimize them */
-               mask |= 1 << cd->clkdm->dep_bit;
-               atomic_set(&cd->sleepdep_usecount, 0);
-       }
-       omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
-                               OMAP3430_CM_SLEEPDEP);
-       return 0;
-}
-
-static int omap2_clkdm_sleep(struct clockdomain *clkdm)
-{
-       omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
-                               clkdm->pwrdm.ptr->prcm_offs,
-                               OMAP2_PM_PWSTCTRL);
-       return 0;
-}
-
-static int omap2_clkdm_wakeup(struct clockdomain *clkdm)
-{
-       omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
-                               clkdm->pwrdm.ptr->prcm_offs,
-                               OMAP2_PM_PWSTCTRL);
-       return 0;
-}
-
-static void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
-{
-       if (atomic_read(&clkdm->usecount) > 0)
-               _clkdm_add_autodeps(clkdm);
-
-       omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
-                               clkdm->clktrctrl_mask);
-}
-
-static void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
-{
-       omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
-                               clkdm->clktrctrl_mask);
-
-       if (atomic_read(&clkdm->usecount) > 0)
-               _clkdm_del_autodeps(clkdm);
-}
-
-static void _enable_hwsup(struct clockdomain *clkdm)
-{
-       if (cpu_is_omap24xx())
-               omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
-                                              clkdm->clktrctrl_mask);
-       else if (cpu_is_omap34xx())
-               omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
-                                              clkdm->clktrctrl_mask);
-}
-
-static void _disable_hwsup(struct clockdomain *clkdm)
-{
-       if (cpu_is_omap24xx())
-               omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
-                                               clkdm->clktrctrl_mask);
-       else if (cpu_is_omap34xx())
-               omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
-                                               clkdm->clktrctrl_mask);
-}
-
-static int omap3_clkdm_sleep(struct clockdomain *clkdm)
-{
-       omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
-                               clkdm->clktrctrl_mask);
-       return 0;
-}
-
-static int omap3_clkdm_wakeup(struct clockdomain *clkdm)
-{
-       omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
-                               clkdm->clktrctrl_mask);
-       return 0;
-}
-
-static int omap2_clkdm_clk_enable(struct clockdomain *clkdm)
-{
-       bool hwsup = false;
-
-       if (!clkdm->clktrctrl_mask)
-               return 0;
-
-       hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
-                               clkdm->clktrctrl_mask);
-
-       if (hwsup) {
-               /* Disable HW transitions when we are changing deps */
-               _disable_hwsup(clkdm);
-               _clkdm_add_autodeps(clkdm);
-               _enable_hwsup(clkdm);
-       } else {
-               if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
-                       omap2_clkdm_wakeup(clkdm);
-       }
-
-       return 0;
-}
-
-static int omap2_clkdm_clk_disable(struct clockdomain *clkdm)
-{
-       bool hwsup = false;
-
-       if (!clkdm->clktrctrl_mask)
-               return 0;
-
-       hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
-                               clkdm->clktrctrl_mask);
-
-       if (hwsup) {
-               /* Disable HW transitions when we are changing deps */
-               _disable_hwsup(clkdm);
-               _clkdm_del_autodeps(clkdm);
-               _enable_hwsup(clkdm);
-       } else {
-               if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
-                       omap2_clkdm_sleep(clkdm);
-       }
-
-       return 0;
-}
-
-static void omap3_clkdm_allow_idle(struct clockdomain *clkdm)
-{
-       if (atomic_read(&clkdm->usecount) > 0)
-               _clkdm_add_autodeps(clkdm);
-
-       omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
-                               clkdm->clktrctrl_mask);
-}
-
-static void omap3_clkdm_deny_idle(struct clockdomain *clkdm)
-{
-       omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
-                               clkdm->clktrctrl_mask);
-
-       if (atomic_read(&clkdm->usecount) > 0)
-               _clkdm_del_autodeps(clkdm);
-}
-
-static int omap3xxx_clkdm_clk_enable(struct clockdomain *clkdm)
-{
-       bool hwsup = false;
-
-       if (!clkdm->clktrctrl_mask)
-               return 0;
-
-       /*
-        * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
-        * more details on the unpleasant problem this is working
-        * around
-        */
-       if ((clkdm->flags & CLKDM_MISSING_IDLE_REPORTING) &&
-           (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)) {
-               omap3_clkdm_wakeup(clkdm);
-               return 0;
-       }
-
-       hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
-                               clkdm->clktrctrl_mask);
-
-       if (hwsup) {
-               /* Disable HW transitions when we are changing deps */
-               _disable_hwsup(clkdm);
-               _clkdm_add_autodeps(clkdm);
-               _enable_hwsup(clkdm);
-       } else {
-               if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
-                       omap3_clkdm_wakeup(clkdm);
-       }
-
-       return 0;
-}
-
-static int omap3xxx_clkdm_clk_disable(struct clockdomain *clkdm)
-{
-       bool hwsup = false;
-
-       if (!clkdm->clktrctrl_mask)
-               return 0;
-
-       /*
-        * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
-        * more details on the unpleasant problem this is working
-        * around
-        */
-       if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
-           !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
-               _enable_hwsup(clkdm);
-               return 0;
-       }
-
-       hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
-                               clkdm->clktrctrl_mask);
-
-       if (hwsup) {
-               /* Disable HW transitions when we are changing deps */
-               _disable_hwsup(clkdm);
-               _clkdm_del_autodeps(clkdm);
-               _enable_hwsup(clkdm);
-       } else {
-               if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
-                       omap3_clkdm_sleep(clkdm);
-       }
-
-       return 0;
-}
-
-struct clkdm_ops omap2_clkdm_operations = {
-       .clkdm_add_wkdep        = omap2_clkdm_add_wkdep,
-       .clkdm_del_wkdep        = omap2_clkdm_del_wkdep,
-       .clkdm_read_wkdep       = omap2_clkdm_read_wkdep,
-       .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
-       .clkdm_sleep            = omap2_clkdm_sleep,
-       .clkdm_wakeup           = omap2_clkdm_wakeup,
-       .clkdm_allow_idle       = omap2_clkdm_allow_idle,
-       .clkdm_deny_idle        = omap2_clkdm_deny_idle,
-       .clkdm_clk_enable       = omap2_clkdm_clk_enable,
-       .clkdm_clk_disable      = omap2_clkdm_clk_disable,
-};
-
-struct clkdm_ops omap3_clkdm_operations = {
-       .clkdm_add_wkdep        = omap2_clkdm_add_wkdep,
-       .clkdm_del_wkdep        = omap2_clkdm_del_wkdep,
-       .clkdm_read_wkdep       = omap2_clkdm_read_wkdep,
-       .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
-       .clkdm_add_sleepdep     = omap3_clkdm_add_sleepdep,
-       .clkdm_del_sleepdep     = omap3_clkdm_del_sleepdep,
-       .clkdm_read_sleepdep    = omap3_clkdm_read_sleepdep,
-       .clkdm_clear_all_sleepdeps      = omap3_clkdm_clear_all_sleepdeps,
-       .clkdm_sleep            = omap3_clkdm_sleep,
-       .clkdm_wakeup           = omap3_clkdm_wakeup,
-       .clkdm_allow_idle       = omap3_clkdm_allow_idle,
-       .clkdm_deny_idle        = omap3_clkdm_deny_idle,
-       .clkdm_clk_enable       = omap3xxx_clkdm_clk_enable,
-       .clkdm_clk_disable      = omap3xxx_clkdm_clk_disable,
-};
diff --git a/arch/arm/mach-omap2/clockdomain33xx.c b/arch/arm/mach-omap2/clockdomain33xx.c
deleted file mode 100644 (file)
index aca6388..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * AM33XX clockdomain control
- *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
- * Vaibhav Hiremath <hvaibhav@ti.com>
- *
- * Derived from mach-omap2/clockdomain44xx.c written by Rajendra Nayak
- *
- * 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.
- *
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- * kind, whether express or implied; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/kernel.h>
-
-#include "clockdomain.h"
-#include "cm33xx.h"
-
-
-static int am33xx_clkdm_sleep(struct clockdomain *clkdm)
-{
-       am33xx_cm_clkdm_force_sleep(clkdm->cm_inst, clkdm->clkdm_offs);
-       return 0;
-}
-
-static int am33xx_clkdm_wakeup(struct clockdomain *clkdm)
-{
-       am33xx_cm_clkdm_force_wakeup(clkdm->cm_inst, clkdm->clkdm_offs);
-       return 0;
-}
-
-static void am33xx_clkdm_allow_idle(struct clockdomain *clkdm)
-{
-       am33xx_cm_clkdm_enable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
-}
-
-static void am33xx_clkdm_deny_idle(struct clockdomain *clkdm)
-{
-       am33xx_cm_clkdm_disable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
-}
-
-static int am33xx_clkdm_clk_enable(struct clockdomain *clkdm)
-{
-       if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
-               return am33xx_clkdm_wakeup(clkdm);
-
-       return 0;
-}
-
-static int am33xx_clkdm_clk_disable(struct clockdomain *clkdm)
-{
-       bool hwsup = false;
-
-       hwsup = am33xx_cm_is_clkdm_in_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
-
-       if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
-               am33xx_clkdm_sleep(clkdm);
-
-       return 0;
-}
-
-struct clkdm_ops am33xx_clkdm_operations = {
-       .clkdm_sleep            = am33xx_clkdm_sleep,
-       .clkdm_wakeup           = am33xx_clkdm_wakeup,
-       .clkdm_allow_idle       = am33xx_clkdm_allow_idle,
-       .clkdm_deny_idle        = am33xx_clkdm_deny_idle,
-       .clkdm_clk_enable       = am33xx_clkdm_clk_enable,
-       .clkdm_clk_disable      = am33xx_clkdm_clk_disable,
-};
diff --git a/arch/arm/mach-omap2/clockdomain44xx.c b/arch/arm/mach-omap2/clockdomain44xx.c
deleted file mode 100644 (file)
index 6fc6155..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * OMAP4 clockdomain control
- *
- * Copyright (C) 2008-2010 Texas Instruments, Inc.
- * Copyright (C) 2008-2010 Nokia Corporation
- *
- * Derived from mach-omap2/clockdomain.c written by Paul Walmsley
- * Rajendra Nayak <rnayak@ti.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/kernel.h>
-#include "clockdomain.h"
-#include "cminst44xx.h"
-#include "cm44xx.h"
-
-static int omap4_clkdm_add_wkup_sleep_dep(struct clockdomain *clkdm1,
-                                       struct clockdomain *clkdm2)
-{
-       omap4_cminst_set_inst_reg_bits((1 << clkdm2->dep_bit),
-                                       clkdm1->prcm_partition,
-                                       clkdm1->cm_inst, clkdm1->clkdm_offs +
-                                       OMAP4_CM_STATICDEP);
-       return 0;
-}
-
-static int omap4_clkdm_del_wkup_sleep_dep(struct clockdomain *clkdm1,
-                                       struct clockdomain *clkdm2)
-{
-       omap4_cminst_clear_inst_reg_bits((1 << clkdm2->dep_bit),
-                                       clkdm1->prcm_partition,
-                                       clkdm1->cm_inst, clkdm1->clkdm_offs +
-                                       OMAP4_CM_STATICDEP);
-       return 0;
-}
-
-static int omap4_clkdm_read_wkup_sleep_dep(struct clockdomain *clkdm1,
-                                       struct clockdomain *clkdm2)
-{
-       return omap4_cminst_read_inst_reg_bits(clkdm1->prcm_partition,
-                                       clkdm1->cm_inst, clkdm1->clkdm_offs +
-                                       OMAP4_CM_STATICDEP,
-                                       (1 << clkdm2->dep_bit));
-}
-
-static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
-{
-       struct clkdm_dep *cd;
-       u32 mask = 0;
-
-       if (!clkdm->prcm_partition)
-               return 0;
-
-       for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
-               if (!cd->clkdm)
-                       continue; /* only happens if data is erroneous */
-
-               mask |= 1 << cd->clkdm->dep_bit;
-               atomic_set(&cd->wkdep_usecount, 0);
-       }
-
-       omap4_cminst_clear_inst_reg_bits(mask, clkdm->prcm_partition,
-                                       clkdm->cm_inst, clkdm->clkdm_offs +
-                                       OMAP4_CM_STATICDEP);
-       return 0;
-}
-
-static int omap4_clkdm_sleep(struct clockdomain *clkdm)
-{
-       omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
-                                       clkdm->cm_inst, clkdm->clkdm_offs);
-       return 0;
-}
-
-static int omap4_clkdm_wakeup(struct clockdomain *clkdm)
-{
-       omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
-                                       clkdm->cm_inst, clkdm->clkdm_offs);
-       return 0;
-}
-
-static void omap4_clkdm_allow_idle(struct clockdomain *clkdm)
-{
-       omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
-                                       clkdm->cm_inst, clkdm->clkdm_offs);
-}
-
-static void omap4_clkdm_deny_idle(struct clockdomain *clkdm)
-{
-       if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
-               omap4_clkdm_wakeup(clkdm);
-       else
-               omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
-                                                clkdm->cm_inst,
-                                                clkdm->clkdm_offs);
-}
-
-static int omap4_clkdm_clk_enable(struct clockdomain *clkdm)
-{
-       if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
-               return omap4_clkdm_wakeup(clkdm);
-
-       return 0;
-}
-
-static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
-{
-       bool hwsup = false;
-
-       if (!clkdm->prcm_partition)
-               return 0;
-
-       /*
-        * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
-        * more details on the unpleasant problem this is working
-        * around
-        */
-       if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
-           !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
-               omap4_clkdm_allow_idle(clkdm);
-               return 0;
-       }
-
-       hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
-                                       clkdm->cm_inst, clkdm->clkdm_offs);
-
-       if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
-               omap4_clkdm_sleep(clkdm);
-
-       return 0;
-}
-
-struct clkdm_ops omap4_clkdm_operations = {
-       .clkdm_add_wkdep        = omap4_clkdm_add_wkup_sleep_dep,
-       .clkdm_del_wkdep        = omap4_clkdm_del_wkup_sleep_dep,
-       .clkdm_read_wkdep       = omap4_clkdm_read_wkup_sleep_dep,
-       .clkdm_clear_all_wkdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
-       .clkdm_add_sleepdep     = omap4_clkdm_add_wkup_sleep_dep,
-       .clkdm_del_sleepdep     = omap4_clkdm_del_wkup_sleep_dep,
-       .clkdm_read_sleepdep    = omap4_clkdm_read_wkup_sleep_dep,
-       .clkdm_clear_all_sleepdeps      = omap4_clkdm_clear_all_wkup_sleep_deps,
-       .clkdm_sleep            = omap4_clkdm_sleep,
-       .clkdm_wakeup           = omap4_clkdm_wakeup,
-       .clkdm_allow_idle       = omap4_clkdm_allow_idle,
-       .clkdm_deny_idle        = omap4_clkdm_deny_idle,
-       .clkdm_clk_enable       = omap4_clkdm_clk_enable,
-       .clkdm_clk_disable      = omap4_clkdm_clk_disable,
-};
index 5c741852fac0294748d9f417ce9b73494eb25f32..7e76becf3a4ae7dae8119d68f8be46f8fdc2229b 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 
+#include "soc.h"
 #include "clockdomain.h"
 #include "prm2xxx_3xxx.h"
 #include "cm2xxx_3xxx.h"
index f09617555e15d7da642621a1f076e2cdf8690bc5..b923007e45d005c5657e667fa2d4b6e959195ed6 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 
+#include "soc.h"
 #include "clockdomain.h"
 #include "prm2xxx_3xxx.h"
 #include "cm2xxx_3xxx.h"
index 933a35cd124a33a1184639054afba1d582623fc0..e6b91e552d3d9427bbfd5287e6762bbff5aaae54 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 
+#include "soc.h"
 #include "clockdomain.h"
 #include "prm2xxx_3xxx.h"
 #include "cm2xxx_3xxx.h"
index 6862904375680b7276f6cf32b1db89967e63b350..11eaf16880c4386dc1a9faf52e99c26984f8d97e 100644 (file)
 #define OMAP24XX_EN_DPLL_MASK                          (0x3 << 0)
 
 /* CM_IDLEST_CKGEN */
+#define OMAP24XX_ST_54M_APLL_SHIFT                     9
 #define OMAP24XX_ST_54M_APLL_MASK                      (1 << 9)
+#define OMAP24XX_ST_96M_APLL_SHIFT                     8
 #define OMAP24XX_ST_96M_APLL_MASK                      (1 << 8)
 #define OMAP24XX_ST_54M_CLK_MASK                       (1 << 6)
 #define OMAP24XX_ST_12M_CLK_MASK                       (1 << 5)
index f24e3f7a2bbc248389ac234c4b80e9f2ef4d5e03..93473f9a551cba1675aa4bd1306ca329ae70f732 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP2+ Clock Management prototypes
  *
- * Copyright (C) 2007-2009 Texas Instruments, Inc.
+ * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
  * Copyright (C) 2007-2009 Nokia Corporation
  *
  * Written by Paul Walmsley
  */
 #define MAX_MODULE_READY_TIME          2000
 
+# ifndef __ASSEMBLER__
+extern void __iomem *cm_base;
+extern void __iomem *cm2_base;
+extern void omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2);
+# endif
+
 /*
  * MAX_MODULE_DISABLE_TIME: max duration in microseconds to wait for
  * the PRCM to request that a module enter the inactive state in the
  */
 #define MAX_MODULE_DISABLE_TIME                5000
 
+# ifndef __ASSEMBLER__
+
+/**
+ * struct cm_ll_data - fn ptrs to per-SoC CM function implementations
+ * @split_idlest_reg: ptr to the SoC CM-specific split_idlest_reg impl
+ * @wait_module_ready: ptr to the SoC CM-specific wait_module_ready impl
+ */
+struct cm_ll_data {
+       int (*split_idlest_reg)(void __iomem *idlest_reg, s16 *prcm_inst,
+                               u8 *idlest_reg_id);
+       int (*wait_module_ready)(s16 prcm_mod, u8 idlest_id, u8 idlest_shift);
+};
+
+extern int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
+                              u8 *idlest_reg_id);
+extern int cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift);
+
+extern int cm_register(struct cm_ll_data *cld);
+extern int cm_unregister(struct cm_ll_data *cld);
+
+# endif
+
 #endif
diff --git a/arch/arm/mach-omap2/cm2xxx.c b/arch/arm/mach-omap2/cm2xxx.c
new file mode 100644 (file)
index 0000000..db65069
--- /dev/null
@@ -0,0 +1,381 @@
+/*
+ * OMAP2xxx CM module functions
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ * Copyright (C) 2008-2010, 2012 Texas Instruments, Inc.
+ * Paul Walmsley
+ * Rajendra Nayak <rnayak@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/delay.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include "soc.h"
+#include "iomap.h"
+#include "common.h"
+#include "prm2xxx.h"
+#include "cm.h"
+#include "cm2xxx.h"
+#include "cm-regbits-24xx.h"
+#include "clockdomain.h"
+
+/* CM_AUTOIDLE_PLL.AUTO_* bit values for DPLLs */
+#define DPLL_AUTOIDLE_DISABLE                          0x0
+#define OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP          0x3
+
+/* CM_AUTOIDLE_PLL.AUTO_* bit values for APLLs (OMAP2xxx only) */
+#define OMAP2XXX_APLL_AUTOIDLE_DISABLE                 0x0
+#define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP          0x3
+
+/* CM_IDLEST_PLL bit value offset for APLLs (OMAP2xxx only) */
+#define EN_APLL_LOCKED                                 3
+
+static const u8 omap2xxx_cm_idlest_offs[] = {
+       CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3, OMAP24XX_CM_IDLEST4
+};
+
+/*
+ *
+ */
+
+static void _write_clktrctrl(u8 c, s16 module, u32 mask)
+{
+       u32 v;
+
+       v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL);
+       v &= ~mask;
+       v |= c << __ffs(mask);
+       omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL);
+}
+
+bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask)
+{
+       u32 v;
+
+       v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL);
+       v &= mask;
+       v >>= __ffs(mask);
+
+       return (v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
+}
+
+void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
+{
+       _write_clktrctrl(OMAP24XX_CLKSTCTRL_ENABLE_AUTO, module, mask);
+}
+
+void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask)
+{
+       _write_clktrctrl(OMAP24XX_CLKSTCTRL_DISABLE_AUTO, module, mask);
+}
+
+/*
+ * DPLL autoidle control
+ */
+
+static void _omap2xxx_set_dpll_autoidle(u8 m)
+{
+       u32 v;
+
+       v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
+       v &= ~OMAP24XX_AUTO_DPLL_MASK;
+       v |= m << OMAP24XX_AUTO_DPLL_SHIFT;
+       omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
+}
+
+void omap2xxx_cm_set_dpll_disable_autoidle(void)
+{
+       _omap2xxx_set_dpll_autoidle(OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP);
+}
+
+void omap2xxx_cm_set_dpll_auto_low_power_stop(void)
+{
+       _omap2xxx_set_dpll_autoidle(DPLL_AUTOIDLE_DISABLE);
+}
+
+/*
+ * APLL control
+ */
+
+static void _omap2xxx_set_apll_autoidle(u8 m, u32 mask)
+{
+       u32 v;
+
+       v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
+       v &= ~mask;
+       v |= m << __ffs(mask);
+       omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
+}
+
+void omap2xxx_cm_set_apll54_disable_autoidle(void)
+{
+       _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP,
+                                   OMAP24XX_AUTO_54M_MASK);
+}
+
+void omap2xxx_cm_set_apll54_auto_low_power_stop(void)
+{
+       _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE,
+                                   OMAP24XX_AUTO_54M_MASK);
+}
+
+void omap2xxx_cm_set_apll96_disable_autoidle(void)
+{
+       _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP,
+                                   OMAP24XX_AUTO_96M_MASK);
+}
+
+void omap2xxx_cm_set_apll96_auto_low_power_stop(void)
+{
+       _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE,
+                                   OMAP24XX_AUTO_96M_MASK);
+}
+
+/* Enable an APLL if off */
+static int _omap2xxx_apll_enable(u8 enable_bit, u8 status_bit)
+{
+       u32 v, m;
+
+       m = EN_APLL_LOCKED << enable_bit;
+
+       v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
+       if (v & m)
+               return 0;   /* apll already enabled */
+
+       v |= m;
+       omap2_cm_write_mod_reg(v, PLL_MOD, CM_CLKEN);
+
+       omap2xxx_cm_wait_module_ready(PLL_MOD, 1, status_bit);
+
+       /*
+        * REVISIT: Should we return an error code if
+        * omap2xxx_cm_wait_module_ready() fails?
+        */
+       return 0;
+}
+
+/* Stop APLL */
+static void _omap2xxx_apll_disable(u8 enable_bit)
+{
+       u32 v;
+
+       v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
+       v &= ~(EN_APLL_LOCKED << enable_bit);
+       omap2_cm_write_mod_reg(v, PLL_MOD, CM_CLKEN);
+}
+
+/* Enable an APLL if off */
+int omap2xxx_cm_apll54_enable(void)
+{
+       return _omap2xxx_apll_enable(OMAP24XX_EN_54M_PLL_SHIFT,
+                                    OMAP24XX_ST_54M_APLL_SHIFT);
+}
+
+/* Enable an APLL if off */
+int omap2xxx_cm_apll96_enable(void)
+{
+       return _omap2xxx_apll_enable(OMAP24XX_EN_96M_PLL_SHIFT,
+                                    OMAP24XX_ST_96M_APLL_SHIFT);
+}
+
+/* Stop APLL */
+void omap2xxx_cm_apll54_disable(void)
+{
+       _omap2xxx_apll_disable(OMAP24XX_EN_54M_PLL_SHIFT);
+}
+
+/* Stop APLL */
+void omap2xxx_cm_apll96_disable(void)
+{
+       _omap2xxx_apll_disable(OMAP24XX_EN_96M_PLL_SHIFT);
+}
+
+/**
+ * omap2xxx_cm_split_idlest_reg - split CM_IDLEST reg addr into its components
+ * @idlest_reg: CM_IDLEST* virtual address
+ * @prcm_inst: pointer to an s16 to return the PRCM instance offset
+ * @idlest_reg_id: pointer to a u8 to return the CM_IDLESTx register ID
+ *
+ * XXX This function is only needed until absolute register addresses are
+ * removed from the OMAP struct clk records.
+ */
+int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
+                                u8 *idlest_reg_id)
+{
+       unsigned long offs;
+       u8 idlest_offs;
+       int i;
+
+       if (idlest_reg < cm_base || idlest_reg > (cm_base + 0x0fff))
+               return -EINVAL;
+
+       idlest_offs = (unsigned long)idlest_reg & 0xff;
+       for (i = 0; i < ARRAY_SIZE(omap2xxx_cm_idlest_offs); i++) {
+               if (idlest_offs == omap2xxx_cm_idlest_offs[i]) {
+                       *idlest_reg_id = i + 1;
+                       break;
+               }
+       }
+
+       if (i == ARRAY_SIZE(omap2xxx_cm_idlest_offs))
+               return -EINVAL;
+
+       offs = idlest_reg - cm_base;
+       offs &= 0xff00;
+       *prcm_inst = offs;
+
+       return 0;
+}
+
+/*
+ *
+ */
+
+/**
+ * omap2xxx_cm_wait_module_ready - wait for a module to leave idle or standby
+ * @prcm_mod: PRCM module offset
+ * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
+ * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
+ *
+ * Wait for the PRCM to indicate that the module identified by
+ * (@prcm_mod, @idlest_id, @idlest_shift) is clocked.  Return 0 upon
+ * success or -EBUSY if the module doesn't enable in time.
+ */
+int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
+{
+       int ena = 0, i = 0;
+       u8 cm_idlest_reg;
+       u32 mask;
+
+       if (!idlest_id || (idlest_id > ARRAY_SIZE(omap2xxx_cm_idlest_offs)))
+               return -EINVAL;
+
+       cm_idlest_reg = omap2xxx_cm_idlest_offs[idlest_id - 1];
+
+       mask = 1 << idlest_shift;
+       ena = mask;
+
+       omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) &
+                           mask) == ena), MAX_MODULE_READY_TIME, i);
+
+       return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
+}
+
+/* Clockdomain low-level functions */
+
+static void omap2xxx_clkdm_allow_idle(struct clockdomain *clkdm)
+{
+       if (atomic_read(&clkdm->usecount) > 0)
+               _clkdm_add_autodeps(clkdm);
+
+       omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                      clkdm->clktrctrl_mask);
+}
+
+static void omap2xxx_clkdm_deny_idle(struct clockdomain *clkdm)
+{
+       omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                       clkdm->clktrctrl_mask);
+
+       if (atomic_read(&clkdm->usecount) > 0)
+               _clkdm_del_autodeps(clkdm);
+}
+
+static int omap2xxx_clkdm_clk_enable(struct clockdomain *clkdm)
+{
+       bool hwsup = false;
+
+       if (!clkdm->clktrctrl_mask)
+               return 0;
+
+       hwsup = omap2xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                             clkdm->clktrctrl_mask);
+
+       if (hwsup) {
+               /* Disable HW transitions when we are changing deps */
+               omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                               clkdm->clktrctrl_mask);
+               _clkdm_add_autodeps(clkdm);
+               omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                              clkdm->clktrctrl_mask);
+       } else {
+               if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
+                       omap2xxx_clkdm_wakeup(clkdm);
+       }
+
+       return 0;
+}
+
+static int omap2xxx_clkdm_clk_disable(struct clockdomain *clkdm)
+{
+       bool hwsup = false;
+
+       if (!clkdm->clktrctrl_mask)
+               return 0;
+
+       hwsup = omap2xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                             clkdm->clktrctrl_mask);
+
+       if (hwsup) {
+               /* Disable HW transitions when we are changing deps */
+               omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                               clkdm->clktrctrl_mask);
+               _clkdm_del_autodeps(clkdm);
+               omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                              clkdm->clktrctrl_mask);
+       } else {
+               if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
+                       omap2xxx_clkdm_sleep(clkdm);
+       }
+
+       return 0;
+}
+
+struct clkdm_ops omap2_clkdm_operations = {
+       .clkdm_add_wkdep        = omap2_clkdm_add_wkdep,
+       .clkdm_del_wkdep        = omap2_clkdm_del_wkdep,
+       .clkdm_read_wkdep       = omap2_clkdm_read_wkdep,
+       .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
+       .clkdm_sleep            = omap2xxx_clkdm_sleep,
+       .clkdm_wakeup           = omap2xxx_clkdm_wakeup,
+       .clkdm_allow_idle       = omap2xxx_clkdm_allow_idle,
+       .clkdm_deny_idle        = omap2xxx_clkdm_deny_idle,
+       .clkdm_clk_enable       = omap2xxx_clkdm_clk_enable,
+       .clkdm_clk_disable      = omap2xxx_clkdm_clk_disable,
+};
+
+/*
+ *
+ */
+
+static struct cm_ll_data omap2xxx_cm_ll_data = {
+       .split_idlest_reg       = &omap2xxx_cm_split_idlest_reg,
+       .wait_module_ready      = &omap2xxx_cm_wait_module_ready,
+};
+
+int __init omap2xxx_cm_init(void)
+{
+       if (!cpu_is_omap24xx())
+               return 0;
+
+       return cm_register(&omap2xxx_cm_ll_data);
+}
+
+static void __exit omap2xxx_cm_exit(void)
+{
+       if (!cpu_is_omap24xx())
+               return;
+
+       /* Should never happen */
+       WARN(cm_unregister(&omap2xxx_cm_ll_data),
+            "%s: cm_ll_data function pointer mismatch\n", __func__);
+}
+__exitcall(omap2xxx_cm_exit);
diff --git a/arch/arm/mach-omap2/cm2xxx.h b/arch/arm/mach-omap2/cm2xxx.h
new file mode 100644 (file)
index 0000000..4cbb39b
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * OMAP2xxx Clock Management (CM) register definitions
+ *
+ * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
+ * Copyright (C) 2007-2010 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ *
+ * The CM hardware modules on the OMAP2/3 are quite similar to each
+ * other.  The CM modules/instances on OMAP4 are quite different, so
+ * they are handled in a separate file.
+ */
+#ifndef __ARCH_ASM_MACH_OMAP2_CM2XXX_H
+#define __ARCH_ASM_MACH_OMAP2_CM2XXX_H
+
+#include "prcm-common.h"
+#include "cm2xxx_3xxx.h"
+
+#define OMAP2420_CM_REGADDR(module, reg)                               \
+                       OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
+#define OMAP2430_CM_REGADDR(module, reg)                               \
+                       OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
+
+/*
+ * Module specific CM register offsets from CM_BASE + domain offset
+ * Use cm_{read,write}_mod_reg() with these registers.
+ * These register offsets generally appear in more than one PRCM submodule.
+ */
+
+/* OMAP2-specific register offsets */
+
+#define OMAP24XX_CM_FCLKEN2                            0x0004
+#define OMAP24XX_CM_ICLKEN4                            0x001c
+#define OMAP24XX_CM_AUTOIDLE4                          0x003c
+#define OMAP24XX_CM_IDLEST4                            0x002c
+
+/* CM_IDLEST bit field values to indicate deasserted IdleReq */
+
+#define OMAP24XX_CM_IDLEST_VAL                         0
+
+
+/* Clock management domain register get/set */
+
+#ifndef __ASSEMBLER__
+
+extern void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
+extern void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
+
+extern void omap2xxx_cm_set_dpll_disable_autoidle(void);
+extern void omap2xxx_cm_set_dpll_auto_low_power_stop(void);
+
+extern void omap2xxx_cm_set_apll54_disable_autoidle(void);
+extern void omap2xxx_cm_set_apll54_auto_low_power_stop(void);
+extern void omap2xxx_cm_set_apll96_disable_autoidle(void);
+extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
+
+extern bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask);
+extern int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
+                                        u8 idlest_shift);
+extern int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
+                                       s16 *prcm_inst, u8 *idlest_reg_id);
+
+extern int __init omap2xxx_cm_init(void);
+
+#endif
+
+#endif
index 57b2f3c2fbf3469c6c99d9b72658c43d0207e819..98e6b3c9cd9b8610fcf85656b5ea4ac46f64493f 100644 (file)
 #ifndef __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H
 #define __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H
 
-#include "prcm-common.h"
-
-#define OMAP2420_CM_REGADDR(module, reg)                               \
-                       OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
-#define OMAP2430_CM_REGADDR(module, reg)                               \
-                       OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
-#define OMAP34XX_CM_REGADDR(module, reg)                               \
-                       OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
-
-
-/*
- * OMAP3-specific global CM registers
- * Use cm_{read,write}_reg() with these registers.
- * These registers appear once per CM module.
- */
-
-#define OMAP3430_CM_REVISION           OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000)
-#define OMAP3430_CM_SYSCONFIG          OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010)
-#define OMAP3430_CM_POLCTRL            OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
-
-#define OMAP3_CM_CLKOUT_CTRL_OFFSET    0x0070
-#define OMAP3430_CM_CLKOUT_CTRL                OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
+#include "cm.h"
 
 /*
  * Module specific CM register offsets from CM_BASE + domain offset
@@ -57,6 +36,7 @@
 #define CM_IDLEST                                      0x0020
 #define CM_IDLEST1                                     CM_IDLEST
 #define CM_IDLEST2                                     0x0024
+#define OMAP2430_CM_IDLEST3                            0x0028
 #define CM_AUTOIDLE                                    0x0030
 #define CM_AUTOIDLE1                                   CM_AUTOIDLE
 #define CM_AUTOIDLE2                                   0x0034
 #define CM_CLKSEL2                                     0x0044
 #define OMAP2_CM_CLKSTCTRL                             0x0048
 
-/* OMAP2-specific register offsets */
-
-#define OMAP24XX_CM_FCLKEN2                            0x0004
-#define OMAP24XX_CM_ICLKEN4                            0x001c
-#define OMAP24XX_CM_AUTOIDLE4                          0x003c
-#define OMAP24XX_CM_IDLEST4                            0x002c
-
-#define OMAP2430_CM_IDLEST3                            0x0028
-
-/* OMAP3-specific register offsets */
-
-#define OMAP3430_CM_CLKEN_PLL                          0x0004
-#define OMAP3430ES2_CM_CLKEN2                          0x0004
-#define OMAP3430ES2_CM_FCLKEN3                         0x0008
-#define OMAP3430_CM_IDLEST_PLL                         CM_IDLEST2
-#define OMAP3430_CM_AUTOIDLE_PLL                       CM_AUTOIDLE2
-#define OMAP3430ES2_CM_AUTOIDLE2_PLL                   CM_AUTOIDLE2
-#define OMAP3430_CM_CLKSEL1                            CM_CLKSEL
-#define OMAP3430_CM_CLKSEL1_PLL                                CM_CLKSEL
-#define OMAP3430_CM_CLKSEL2_PLL                                CM_CLKSEL2
-#define OMAP3430_CM_SLEEPDEP                           CM_CLKSEL2
-#define OMAP3430_CM_CLKSEL3                            OMAP2_CM_CLKSTCTRL
-#define OMAP3430_CM_CLKSTST                            0x004c
-#define OMAP3430ES2_CM_CLKSEL4                         0x004c
-#define OMAP3430ES2_CM_CLKSEL5                         0x0050
-#define OMAP3430_CM_CLKSEL2_EMU                                0x0050
-#define OMAP3430_CM_CLKSEL3_EMU                                0x0054
+#ifndef __ASSEMBLER__
 
+#include <linux/io.h>
 
-/* CM_IDLEST bit field values to indicate deasserted IdleReq */
+static inline u32 omap2_cm_read_mod_reg(s16 module, u16 idx)
+{
+       return __raw_readl(cm_base + module + idx);
+}
 
-#define OMAP24XX_CM_IDLEST_VAL                         0
-#define OMAP34XX_CM_IDLEST_VAL                         1
+static inline void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx)
+{
+       __raw_writel(val, cm_base + module + idx);
+}
 
+/* Read-modify-write a register in a CM module. Caller must lock */
+static inline u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module,
+                                           s16 idx)
+{
+       u32 v;
 
-/* Clock management domain register get/set */
+       v = omap2_cm_read_mod_reg(module, idx);
+       v &= ~mask;
+       v |= bits;
+       omap2_cm_write_mod_reg(v, module, idx);
 
-#ifndef __ASSEMBLER__
+       return v;
+}
 
-extern u32 omap2_cm_read_mod_reg(s16 module, u16 idx);
-extern void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx);
-extern u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
+/* Read a CM register, AND it, and shift the result down to bit 0 */
+static inline u32 omap2_cm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
+{
+       u32 v;
 
-extern int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
-                                     u8 idlest_shift);
-extern u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx);
-extern u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx);
+       v = omap2_cm_read_mod_reg(domain, idx);
+       v &= mask;
+       v >>= __ffs(mask);
 
-extern bool omap2_cm_is_clkdm_in_hwsup(s16 module, u32 mask);
-extern void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
-extern void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
+       return v;
+}
 
-extern void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
-extern void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
-extern void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask);
-extern void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask);
+static inline u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
+{
+       return omap2_cm_rmw_mod_reg_bits(bits, bits, module, idx);
+}
 
-extern void omap2xxx_cm_set_dpll_disable_autoidle(void);
-extern void omap2xxx_cm_set_dpll_auto_low_power_stop(void);
+static inline u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
+{
+       return omap2_cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
+}
 
-extern void omap2xxx_cm_set_apll54_disable_autoidle(void);
-extern void omap2xxx_cm_set_apll54_auto_low_power_stop(void);
-extern void omap2xxx_cm_set_apll96_disable_autoidle(void);
-extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
+extern int omap2xxx_cm_apll54_enable(void);
+extern void omap2xxx_cm_apll54_disable(void);
+extern int omap2xxx_cm_apll96_enable(void);
+extern void omap2xxx_cm_apll96_disable(void);
 
 #endif
 
@@ -146,11 +116,4 @@ extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
 /* CM_IDLEST_GFX */
 #define OMAP_ST_GFX_MASK                               (1 << 0)
 
-
-/* Function prototypes */
-# ifndef __ASSEMBLER__
-extern void omap3_cm_save_context(void);
-extern void omap3_cm_restore_context(void);
-# endif
-
 #endif
index 13f56eafef03fb70071071884713d7f335e9228d..058ce3c0873ecb7aa0f4356d4d596c152aea5f03 100644 (file)
@@ -22,8 +22,7 @@
 #include <linux/err.h>
 #include <linux/io.h>
 
-#include <plat/common.h>
-
+#include "clockdomain.h"
 #include "cm.h"
 #include "cm33xx.h"
 #include "cm-regbits-34xx.h"
@@ -311,3 +310,58 @@ void am33xx_cm_module_disable(u16 inst, s16 cdoffs, u16 clkctrl_offs)
        v &= ~AM33XX_MODULEMODE_MASK;
        am33xx_cm_write_reg(v, inst, clkctrl_offs);
 }
+
+/*
+ * Clockdomain low-level functions
+ */
+
+static int am33xx_clkdm_sleep(struct clockdomain *clkdm)
+{
+       am33xx_cm_clkdm_force_sleep(clkdm->cm_inst, clkdm->clkdm_offs);
+       return 0;
+}
+
+static int am33xx_clkdm_wakeup(struct clockdomain *clkdm)
+{
+       am33xx_cm_clkdm_force_wakeup(clkdm->cm_inst, clkdm->clkdm_offs);
+       return 0;
+}
+
+static void am33xx_clkdm_allow_idle(struct clockdomain *clkdm)
+{
+       am33xx_cm_clkdm_enable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
+}
+
+static void am33xx_clkdm_deny_idle(struct clockdomain *clkdm)
+{
+       am33xx_cm_clkdm_disable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
+}
+
+static int am33xx_clkdm_clk_enable(struct clockdomain *clkdm)
+{
+       if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
+               return am33xx_clkdm_wakeup(clkdm);
+
+       return 0;
+}
+
+static int am33xx_clkdm_clk_disable(struct clockdomain *clkdm)
+{
+       bool hwsup = false;
+
+       hwsup = am33xx_cm_is_clkdm_in_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
+
+       if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
+               am33xx_clkdm_sleep(clkdm);
+
+       return 0;
+}
+
+struct clkdm_ops am33xx_clkdm_operations = {
+       .clkdm_sleep            = am33xx_clkdm_sleep,
+       .clkdm_wakeup           = am33xx_clkdm_wakeup,
+       .clkdm_allow_idle       = am33xx_clkdm_allow_idle,
+       .clkdm_deny_idle        = am33xx_clkdm_deny_idle,
+       .clkdm_clk_enable       = am33xx_clkdm_clk_enable,
+       .clkdm_clk_disable      = am33xx_clkdm_clk_disable,
+};
similarity index 67%
rename from arch/arm/mach-omap2/cm2xxx_3xxx.c
rename to arch/arm/mach-omap2/cm3xxx.c
index 7f07ab02a5b3f8d706daff3ff4f34e27fc7fb0ae..c2086f2e86b6f310fa579e5759851fae8bb73cd6 100644 (file)
@@ -1,8 +1,10 @@
 /*
- * OMAP2/3 CM module functions
+ * OMAP3xxx CM module functions
  *
  * Copyright (C) 2009 Nokia Corporation
+ * Copyright (C) 2008-2010, 2012 Texas Instruments, Inc.
  * Paul Walmsley
+ * Rajendra Nayak <rnayak@ti.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -12,8 +14,6 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/delay.h>
-#include <linux/spinlock.h>
-#include <linux/list.h>
 #include <linux/errno.h>
 #include <linux/err.h>
 #include <linux/io.h>
 #include "soc.h"
 #include "iomap.h"
 #include "common.h"
+#include "prm2xxx_3xxx.h"
 #include "cm.h"
-#include "cm2xxx_3xxx.h"
-#include "cm-regbits-24xx.h"
+#include "cm3xxx.h"
 #include "cm-regbits-34xx.h"
+#include "clockdomain.h"
 
-/* CM_AUTOIDLE_PLL.AUTO_* bit values for DPLLs */
-#define DPLL_AUTOIDLE_DISABLE                          0x0
-#define OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP          0x3
-
-/* CM_AUTOIDLE_PLL.AUTO_* bit values for APLLs (OMAP2xxx only) */
-#define OMAP2XXX_APLL_AUTOIDLE_DISABLE                 0x0
-#define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP          0x3
-
-static const u8 cm_idlest_offs[] = {
-       CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3, OMAP24XX_CM_IDLEST4
+static const u8 omap3xxx_cm_idlest_offs[] = {
+       CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3
 };
 
-u32 omap2_cm_read_mod_reg(s16 module, u16 idx)
-{
-       return __raw_readl(cm_base + module + idx);
-}
-
-void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx)
-{
-       __raw_writel(val, cm_base + module + idx);
-}
-
-/* Read-modify-write a register in a CM module. Caller must lock */
-u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
-{
-       u32 v;
-
-       v = omap2_cm_read_mod_reg(module, idx);
-       v &= ~mask;
-       v |= bits;
-       omap2_cm_write_mod_reg(v, module, idx);
-
-       return v;
-}
-
-u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
-{
-       return omap2_cm_rmw_mod_reg_bits(bits, bits, module, idx);
-}
-
-u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
-{
-       return omap2_cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
-}
-
 /*
  *
  */
@@ -85,33 +45,15 @@ static void _write_clktrctrl(u8 c, s16 module, u32 mask)
        omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL);
 }
 
-bool omap2_cm_is_clkdm_in_hwsup(s16 module, u32 mask)
+bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask)
 {
        u32 v;
-       bool ret = 0;
-
-       BUG_ON(!cpu_is_omap24xx() && !cpu_is_omap34xx());
 
        v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL);
        v &= mask;
        v >>= __ffs(mask);
 
-       if (cpu_is_omap24xx())
-               ret = (v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
-       else
-               ret = (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
-
-       return ret;
-}
-
-void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
-{
-       _write_clktrctrl(OMAP24XX_CLKSTCTRL_ENABLE_AUTO, module, mask);
-}
-
-void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask)
-{
-       _write_clktrctrl(OMAP24XX_CLKSTCTRL_DISABLE_AUTO, module, mask);
+       return (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
 }
 
 void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
@@ -135,109 +77,247 @@ void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask)
 }
 
 /*
- * DPLL autoidle control
+ *
  */
 
-static void _omap2xxx_set_dpll_autoidle(u8 m)
+/**
+ * omap3xxx_cm_wait_module_ready - wait for a module to leave idle or standby
+ * @prcm_mod: PRCM module offset
+ * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
+ * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
+ *
+ * Wait for the PRCM to indicate that the module identified by
+ * (@prcm_mod, @idlest_id, @idlest_shift) is clocked.  Return 0 upon
+ * success or -EBUSY if the module doesn't enable in time.
+ */
+int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
 {
-       u32 v;
+       int ena = 0, i = 0;
+       u8 cm_idlest_reg;
+       u32 mask;
 
-       v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
-       v &= ~OMAP24XX_AUTO_DPLL_MASK;
-       v |= m << OMAP24XX_AUTO_DPLL_SHIFT;
-       omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
-}
+       if (!idlest_id || (idlest_id > ARRAY_SIZE(omap3xxx_cm_idlest_offs)))
+               return -EINVAL;
 
-void omap2xxx_cm_set_dpll_disable_autoidle(void)
-{
-       _omap2xxx_set_dpll_autoidle(OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP);
+       cm_idlest_reg = omap3xxx_cm_idlest_offs[idlest_id - 1];
+
+       mask = 1 << idlest_shift;
+       ena = 0;
+
+       omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) &
+                           mask) == ena), MAX_MODULE_READY_TIME, i);
+
+       return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
 }
 
-void omap2xxx_cm_set_dpll_auto_low_power_stop(void)
+/**
+ * omap3xxx_cm_split_idlest_reg - split CM_IDLEST reg addr into its components
+ * @idlest_reg: CM_IDLEST* virtual address
+ * @prcm_inst: pointer to an s16 to return the PRCM instance offset
+ * @idlest_reg_id: pointer to a u8 to return the CM_IDLESTx register ID
+ *
+ * XXX This function is only needed until absolute register addresses are
+ * removed from the OMAP struct clk records.
+ */
+int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
+                                u8 *idlest_reg_id)
 {
-       _omap2xxx_set_dpll_autoidle(DPLL_AUTOIDLE_DISABLE);
+       unsigned long offs;
+       u8 idlest_offs;
+       int i;
+
+       if (idlest_reg < (cm_base + OMAP3430_IVA2_MOD) ||
+           idlest_reg > (cm_base + 0x1ffff))
+               return -EINVAL;
+
+       idlest_offs = (unsigned long)idlest_reg & 0xff;
+       for (i = 0; i < ARRAY_SIZE(omap3xxx_cm_idlest_offs); i++) {
+               if (idlest_offs == omap3xxx_cm_idlest_offs[i]) {
+                       *idlest_reg_id = i + 1;
+                       break;
+               }
+       }
+
+       if (i == ARRAY_SIZE(omap3xxx_cm_idlest_offs))
+               return -EINVAL;
+
+       offs = idlest_reg - cm_base;
+       offs &= 0xff00;
+       *prcm_inst = offs;
+
+       return 0;
 }
 
-/*
- * APLL autoidle control
- */
+/* Clockdomain low-level operations */
 
-static void _omap2xxx_set_apll_autoidle(u8 m, u32 mask)
+static int omap3xxx_clkdm_add_sleepdep(struct clockdomain *clkdm1,
+                                      struct clockdomain *clkdm2)
 {
-       u32 v;
+       omap2_cm_set_mod_reg_bits((1 << clkdm2->dep_bit),
+                                 clkdm1->pwrdm.ptr->prcm_offs,
+                                 OMAP3430_CM_SLEEPDEP);
+       return 0;
+}
 
-       v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
-       v &= ~mask;
-       v |= m << __ffs(mask);
-       omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
+static int omap3xxx_clkdm_del_sleepdep(struct clockdomain *clkdm1,
+                                      struct clockdomain *clkdm2)
+{
+       omap2_cm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
+                                   clkdm1->pwrdm.ptr->prcm_offs,
+                                   OMAP3430_CM_SLEEPDEP);
+       return 0;
 }
 
-void omap2xxx_cm_set_apll54_disable_autoidle(void)
+static int omap3xxx_clkdm_read_sleepdep(struct clockdomain *clkdm1,
+                                       struct clockdomain *clkdm2)
 {
-       _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP,
-                                   OMAP24XX_AUTO_54M_MASK);
+       return omap2_cm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
+                                           OMAP3430_CM_SLEEPDEP,
+                                           (1 << clkdm2->dep_bit));
 }
 
-void omap2xxx_cm_set_apll54_auto_low_power_stop(void)
+static int omap3xxx_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
 {
-       _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE,
-                                   OMAP24XX_AUTO_54M_MASK);
+       struct clkdm_dep *cd;
+       u32 mask = 0;
+
+       for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) {
+               if (!cd->clkdm)
+                       continue; /* only happens if data is erroneous */
+
+               mask |= 1 << cd->clkdm->dep_bit;
+               atomic_set(&cd->sleepdep_usecount, 0);
+       }
+       omap2_cm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
+                                   OMAP3430_CM_SLEEPDEP);
+       return 0;
 }
 
-void omap2xxx_cm_set_apll96_disable_autoidle(void)
+static int omap3xxx_clkdm_sleep(struct clockdomain *clkdm)
 {
-       _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP,
-                                   OMAP24XX_AUTO_96M_MASK);
+       omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
+                                     clkdm->clktrctrl_mask);
+       return 0;
 }
 
-void omap2xxx_cm_set_apll96_auto_low_power_stop(void)
+static int omap3xxx_clkdm_wakeup(struct clockdomain *clkdm)
 {
-       _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE,
-                                   OMAP24XX_AUTO_96M_MASK);
+       omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
+                                      clkdm->clktrctrl_mask);
+       return 0;
 }
 
-/*
- *
- */
+static void omap3xxx_clkdm_allow_idle(struct clockdomain *clkdm)
+{
+       if (atomic_read(&clkdm->usecount) > 0)
+               _clkdm_add_autodeps(clkdm);
 
-/**
- * omap2_cm_wait_idlest_ready - wait for a module to leave idle or standby
- * @prcm_mod: PRCM module offset
- * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
- * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
- *
- * XXX document
- */
-int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
+       omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                      clkdm->clktrctrl_mask);
+}
+
+static void omap3xxx_clkdm_deny_idle(struct clockdomain *clkdm)
 {
-       int ena = 0, i = 0;
-       u8 cm_idlest_reg;
-       u32 mask;
+       omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                       clkdm->clktrctrl_mask);
 
-       if (!idlest_id || (idlest_id > ARRAY_SIZE(cm_idlest_offs)))
-               return -EINVAL;
+       if (atomic_read(&clkdm->usecount) > 0)
+               _clkdm_del_autodeps(clkdm);
+}
 
-       cm_idlest_reg = cm_idlest_offs[idlest_id - 1];
+static int omap3xxx_clkdm_clk_enable(struct clockdomain *clkdm)
+{
+       bool hwsup = false;
 
-       mask = 1 << idlest_shift;
+       if (!clkdm->clktrctrl_mask)
+               return 0;
 
-       if (cpu_is_omap24xx())
-               ena = mask;
-       else if (cpu_is_omap34xx())
-               ena = 0;
-       else
-               BUG();
+       /*
+        * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
+        * more details on the unpleasant problem this is working
+        * around
+        */
+       if ((clkdm->flags & CLKDM_MISSING_IDLE_REPORTING) &&
+           (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)) {
+               omap3xxx_clkdm_wakeup(clkdm);
+               return 0;
+       }
+
+       hwsup = omap3xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                             clkdm->clktrctrl_mask);
+
+       if (hwsup) {
+               /* Disable HW transitions when we are changing deps */
+               omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                               clkdm->clktrctrl_mask);
+               _clkdm_add_autodeps(clkdm);
+               omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                              clkdm->clktrctrl_mask);
+       } else {
+               if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
+                       omap3xxx_clkdm_wakeup(clkdm);
+       }
+
+       return 0;
+}
 
-       omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) & mask) == ena),
-                         MAX_MODULE_READY_TIME, i);
+static int omap3xxx_clkdm_clk_disable(struct clockdomain *clkdm)
+{
+       bool hwsup = false;
 
-       return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
+       if (!clkdm->clktrctrl_mask)
+               return 0;
+
+       /*
+        * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
+        * more details on the unpleasant problem this is working
+        * around
+        */
+       if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
+           !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
+               omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                              clkdm->clktrctrl_mask);
+               return 0;
+       }
+
+       hwsup = omap3xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                             clkdm->clktrctrl_mask);
+
+       if (hwsup) {
+               /* Disable HW transitions when we are changing deps */
+               omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                               clkdm->clktrctrl_mask);
+               _clkdm_del_autodeps(clkdm);
+               omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                                              clkdm->clktrctrl_mask);
+       } else {
+               if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
+                       omap3xxx_clkdm_sleep(clkdm);
+       }
+
+       return 0;
 }
 
+struct clkdm_ops omap3_clkdm_operations = {
+       .clkdm_add_wkdep        = omap2_clkdm_add_wkdep,
+       .clkdm_del_wkdep        = omap2_clkdm_del_wkdep,
+       .clkdm_read_wkdep       = omap2_clkdm_read_wkdep,
+       .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
+       .clkdm_add_sleepdep     = omap3xxx_clkdm_add_sleepdep,
+       .clkdm_del_sleepdep     = omap3xxx_clkdm_del_sleepdep,
+       .clkdm_read_sleepdep    = omap3xxx_clkdm_read_sleepdep,
+       .clkdm_clear_all_sleepdeps      = omap3xxx_clkdm_clear_all_sleepdeps,
+       .clkdm_sleep            = omap3xxx_clkdm_sleep,
+       .clkdm_wakeup           = omap3xxx_clkdm_wakeup,
+       .clkdm_allow_idle       = omap3xxx_clkdm_allow_idle,
+       .clkdm_deny_idle        = omap3xxx_clkdm_deny_idle,
+       .clkdm_clk_enable       = omap3xxx_clkdm_clk_enable,
+       .clkdm_clk_disable      = omap3xxx_clkdm_clk_disable,
+};
+
 /*
  * Context save/restore code - OMAP3 only
  */
-#ifdef CONFIG_ARCH_OMAP3
 struct omap3_cm_regs {
        u32 iva2_cm_clksel1;
        u32 iva2_cm_clksel2;
@@ -555,4 +635,31 @@ void omap3_cm_restore_context(void)
        omap2_cm_write_mod_reg(cm_context.cm_clkout_ctrl, OMAP3430_CCR_MOD,
                               OMAP3_CM_CLKOUT_CTRL_OFFSET);
 }
-#endif
+
+/*
+ *
+ */
+
+static struct cm_ll_data omap3xxx_cm_ll_data = {
+       .split_idlest_reg       = &omap3xxx_cm_split_idlest_reg,
+       .wait_module_ready      = &omap3xxx_cm_wait_module_ready,
+};
+
+int __init omap3xxx_cm_init(void)
+{
+       if (!cpu_is_omap34xx())
+               return 0;
+
+       return cm_register(&omap3xxx_cm_ll_data);
+}
+
+static void __exit omap3xxx_cm_exit(void)
+{
+       if (!cpu_is_omap34xx())
+               return;
+
+       /* Should never happen */
+       WARN(cm_unregister(&omap3xxx_cm_ll_data),
+            "%s: cm_ll_data function pointer mismatch\n", __func__);
+}
+__exitcall(omap3xxx_cm_exit);
diff --git a/arch/arm/mach-omap2/cm3xxx.h b/arch/arm/mach-omap2/cm3xxx.h
new file mode 100644 (file)
index 0000000..e8e146f
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * OMAP2/3 Clock Management (CM) register definitions
+ *
+ * Copyright (C) 2007-2009 Texas Instruments, Inc.
+ * Copyright (C) 2007-2010 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ *
+ * The CM hardware modules on the OMAP2/3 are quite similar to each
+ * other.  The CM modules/instances on OMAP4 are quite different, so
+ * they are handled in a separate file.
+ */
+#ifndef __ARCH_ASM_MACH_OMAP2_CM3XXX_H
+#define __ARCH_ASM_MACH_OMAP2_CM3XXX_H
+
+#include "prcm-common.h"
+#include "cm2xxx_3xxx.h"
+
+#define OMAP34XX_CM_REGADDR(module, reg)                               \
+                       OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
+
+
+/*
+ * OMAP3-specific global CM registers
+ * Use cm_{read,write}_reg() with these registers.
+ * These registers appear once per CM module.
+ */
+
+#define OMAP3430_CM_REVISION           OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000)
+#define OMAP3430_CM_SYSCONFIG          OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010)
+#define OMAP3430_CM_POLCTRL            OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
+
+#define OMAP3_CM_CLKOUT_CTRL_OFFSET    0x0070
+#define OMAP3430_CM_CLKOUT_CTRL                OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
+
+/*
+ * Module specific CM register offsets from CM_BASE + domain offset
+ * Use cm_{read,write}_mod_reg() with these registers.
+ * These register offsets generally appear in more than one PRCM submodule.
+ */
+
+/* OMAP3-specific register offsets */
+
+#define OMAP3430_CM_CLKEN_PLL                          0x0004
+#define OMAP3430ES2_CM_CLKEN2                          0x0004
+#define OMAP3430ES2_CM_FCLKEN3                         0x0008
+#define OMAP3430_CM_IDLEST_PLL                         CM_IDLEST2
+#define OMAP3430_CM_AUTOIDLE_PLL                       CM_AUTOIDLE2
+#define OMAP3430ES2_CM_AUTOIDLE2_PLL                   CM_AUTOIDLE2
+#define OMAP3430_CM_CLKSEL1                            CM_CLKSEL
+#define OMAP3430_CM_CLKSEL1_PLL                                CM_CLKSEL
+#define OMAP3430_CM_CLKSEL2_PLL                                CM_CLKSEL2
+#define OMAP3430_CM_SLEEPDEP                           CM_CLKSEL2
+#define OMAP3430_CM_CLKSEL3                            OMAP2_CM_CLKSTCTRL
+#define OMAP3430_CM_CLKSTST                            0x004c
+#define OMAP3430ES2_CM_CLKSEL4                         0x004c
+#define OMAP3430ES2_CM_CLKSEL5                         0x0050
+#define OMAP3430_CM_CLKSEL2_EMU                                0x0050
+#define OMAP3430_CM_CLKSEL3_EMU                                0x0054
+
+
+/* CM_IDLEST bit field values to indicate deasserted IdleReq */
+
+#define OMAP34XX_CM_IDLEST_VAL                         1
+
+
+#ifndef __ASSEMBLER__
+
+extern void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
+extern void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
+extern void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask);
+extern void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask);
+
+extern bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask);
+extern int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
+                                        u8 idlest_shift);
+
+extern int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
+                                       s16 *prcm_inst, u8 *idlest_reg_id);
+
+extern void omap3_cm_save_context(void);
+extern void omap3_cm_restore_context(void);
+
+extern int __init omap3xxx_cm_init(void);
+
+#endif
+
+#endif
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c
new file mode 100644 (file)
index 0000000..40b3b5a
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+ * OMAP2+ common Clock Management (CM) IP block functions
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ * Paul Walmsley
+ *
+ * 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.
+ *
+ * XXX This code should eventually be moved to a CM driver.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+
+#include "cm2xxx.h"
+#include "cm3xxx.h"
+#include "cm44xx.h"
+#include "common.h"
+
+/*
+ * cm_ll_data: function pointers to SoC-specific implementations of
+ * common CM functions
+ */
+static struct cm_ll_data null_cm_ll_data;
+static struct cm_ll_data *cm_ll_data = &null_cm_ll_data;
+
+/* cm_base: base virtual address of the CM IP block */
+void __iomem *cm_base;
+
+/* cm2_base: base virtual address of the CM2 IP block (OMAP44xx only) */
+void __iomem *cm2_base;
+
+/**
+ * omap2_set_globals_cm - set the CM/CM2 base addresses (for early use)
+ * @cm: CM base virtual address
+ * @cm2: CM2 base virtual address (if present on the booted SoC)
+ *
+ * XXX Will be replaced when the PRM/CM drivers are completed.
+ */
+void __init omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2)
+{
+       cm_base = cm;
+       cm2_base = cm2;
+}
+
+/**
+ * cm_split_idlest_reg - split CM_IDLEST reg addr into its components
+ * @idlest_reg: CM_IDLEST* virtual address
+ * @prcm_inst: pointer to an s16 to return the PRCM instance offset
+ * @idlest_reg_id: pointer to a u8 to return the CM_IDLESTx register ID
+ *
+ * Given an absolute CM_IDLEST register address @idlest_reg, passes
+ * the PRCM instance offset and IDLEST register ID back to the caller
+ * via the @prcm_inst and @idlest_reg_id.  Returns -EINVAL upon error,
+ * or 0 upon success.  XXX This function is only needed until absolute
+ * register addresses are removed from the OMAP struct clk records.
+ */
+int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
+                       u8 *idlest_reg_id)
+{
+       if (!cm_ll_data->split_idlest_reg) {
+               WARN_ONCE(1, "cm: %s: no low-level function defined\n",
+                         __func__);
+               return -EINVAL;
+       }
+
+       return cm_ll_data->split_idlest_reg(idlest_reg, prcm_inst,
+                                          idlest_reg_id);
+}
+
+/**
+ * cm_wait_module_ready - wait for a module to leave idle or standby
+ * @prcm_mod: PRCM module offset
+ * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
+ * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
+ *
+ * Wait for the PRCM to indicate that the module identified by
+ * (@prcm_mod, @idlest_id, @idlest_shift) is clocked.  Return 0 upon
+ * success, -EBUSY if the module doesn't enable in time, or -EINVAL if
+ * no per-SoC wait_module_ready() function pointer has been registered
+ * or if the idlest register is unknown on the SoC.
+ */
+int cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
+{
+       if (!cm_ll_data->wait_module_ready) {
+               WARN_ONCE(1, "cm: %s: no low-level function defined\n",
+                         __func__);
+               return -EINVAL;
+       }
+
+       return cm_ll_data->wait_module_ready(prcm_mod, idlest_id, idlest_shift);
+}
+
+/**
+ * cm_register - register per-SoC low-level data with the CM
+ * @cld: low-level per-SoC OMAP CM data & function pointers to register
+ *
+ * Register per-SoC low-level OMAP CM data and function pointers with
+ * the OMAP CM common interface.  The caller must keep the data
+ * pointed to by @cld valid until it calls cm_unregister() and
+ * it returns successfully.  Returns 0 upon success, -EINVAL if @cld
+ * is NULL, or -EEXIST if cm_register() has already been called
+ * without an intervening cm_unregister().
+ */
+int cm_register(struct cm_ll_data *cld)
+{
+       if (!cld)
+               return -EINVAL;
+
+       if (cm_ll_data != &null_cm_ll_data)
+               return -EEXIST;
+
+       cm_ll_data = cld;
+
+       return 0;
+}
+
+/**
+ * cm_unregister - unregister per-SoC low-level data & function pointers
+ * @cld: low-level per-SoC OMAP CM data & function pointers to unregister
+ *
+ * Unregister per-SoC low-level OMAP CM data and function pointers
+ * that were previously registered with cm_register().  The
+ * caller may not destroy any of the data pointed to by @cld until
+ * this function returns successfully.  Returns 0 upon success, or
+ * -EINVAL if @cld is NULL or if @cld does not match the struct
+ * cm_ll_data * previously registered by cm_register().
+ */
+int cm_unregister(struct cm_ll_data *cld)
+{
+       if (!cld || cm_ll_data != cld)
+               return -EINVAL;
+
+       cm_ll_data = &null_cm_ll_data;
+
+       return 0;
+}
index 1894015ff04b3faf33312058e34dbca92f756b5d..7f9a464f01e987f62f7d98239357402687ad0486 100644 (file)
@@ -2,8 +2,9 @@
  * OMAP4 CM instance functions
  *
  * Copyright (C) 2009 Nokia Corporation
- * Copyright (C) 2011 Texas Instruments, Inc.
+ * Copyright (C) 2008-2011 Texas Instruments, Inc.
  * Paul Walmsley
+ * Rajendra Nayak <rnayak@ti.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -22,6 +23,7 @@
 
 #include "iomap.h"
 #include "common.h"
+#include "clockdomain.h"
 #include "cm.h"
 #include "cm1_44xx.h"
 #include "cm2_44xx.h"
@@ -343,3 +345,141 @@ void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
        v &= ~OMAP4430_MODULEMODE_MASK;
        omap4_cminst_write_inst_reg(v, part, inst, clkctrl_offs);
 }
+
+/*
+ * Clockdomain low-level functions
+ */
+
+static int omap4_clkdm_add_wkup_sleep_dep(struct clockdomain *clkdm1,
+                                       struct clockdomain *clkdm2)
+{
+       omap4_cminst_set_inst_reg_bits((1 << clkdm2->dep_bit),
+                                      clkdm1->prcm_partition,
+                                      clkdm1->cm_inst, clkdm1->clkdm_offs +
+                                      OMAP4_CM_STATICDEP);
+       return 0;
+}
+
+static int omap4_clkdm_del_wkup_sleep_dep(struct clockdomain *clkdm1,
+                                       struct clockdomain *clkdm2)
+{
+       omap4_cminst_clear_inst_reg_bits((1 << clkdm2->dep_bit),
+                                        clkdm1->prcm_partition,
+                                        clkdm1->cm_inst, clkdm1->clkdm_offs +
+                                        OMAP4_CM_STATICDEP);
+       return 0;
+}
+
+static int omap4_clkdm_read_wkup_sleep_dep(struct clockdomain *clkdm1,
+                                       struct clockdomain *clkdm2)
+{
+       return omap4_cminst_read_inst_reg_bits(clkdm1->prcm_partition,
+                                              clkdm1->cm_inst,
+                                              clkdm1->clkdm_offs +
+                                              OMAP4_CM_STATICDEP,
+                                              (1 << clkdm2->dep_bit));
+}
+
+static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
+{
+       struct clkdm_dep *cd;
+       u32 mask = 0;
+
+       if (!clkdm->prcm_partition)
+               return 0;
+
+       for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
+               if (!cd->clkdm)
+                       continue; /* only happens if data is erroneous */
+
+               mask |= 1 << cd->clkdm->dep_bit;
+               atomic_set(&cd->wkdep_usecount, 0);
+       }
+
+       omap4_cminst_clear_inst_reg_bits(mask, clkdm->prcm_partition,
+                                        clkdm->cm_inst, clkdm->clkdm_offs +
+                                        OMAP4_CM_STATICDEP);
+       return 0;
+}
+
+static int omap4_clkdm_sleep(struct clockdomain *clkdm)
+{
+       omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
+                                       clkdm->cm_inst, clkdm->clkdm_offs);
+       return 0;
+}
+
+static int omap4_clkdm_wakeup(struct clockdomain *clkdm)
+{
+       omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
+                                       clkdm->cm_inst, clkdm->clkdm_offs);
+       return 0;
+}
+
+static void omap4_clkdm_allow_idle(struct clockdomain *clkdm)
+{
+       omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
+                                       clkdm->cm_inst, clkdm->clkdm_offs);
+}
+
+static void omap4_clkdm_deny_idle(struct clockdomain *clkdm)
+{
+       if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
+               omap4_clkdm_wakeup(clkdm);
+       else
+               omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
+                                                clkdm->cm_inst,
+                                                clkdm->clkdm_offs);
+}
+
+static int omap4_clkdm_clk_enable(struct clockdomain *clkdm)
+{
+       if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
+               return omap4_clkdm_wakeup(clkdm);
+
+       return 0;
+}
+
+static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
+{
+       bool hwsup = false;
+
+       if (!clkdm->prcm_partition)
+               return 0;
+
+       /*
+        * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
+        * more details on the unpleasant problem this is working
+        * around
+        */
+       if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
+           !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
+               omap4_clkdm_allow_idle(clkdm);
+               return 0;
+       }
+
+       hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
+                                       clkdm->cm_inst, clkdm->clkdm_offs);
+
+       if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
+               omap4_clkdm_sleep(clkdm);
+
+       return 0;
+}
+
+struct clkdm_ops omap4_clkdm_operations = {
+       .clkdm_add_wkdep        = omap4_clkdm_add_wkup_sleep_dep,
+       .clkdm_del_wkdep        = omap4_clkdm_del_wkup_sleep_dep,
+       .clkdm_read_wkdep       = omap4_clkdm_read_wkup_sleep_dep,
+       .clkdm_clear_all_wkdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
+       .clkdm_add_sleepdep     = omap4_clkdm_add_wkup_sleep_dep,
+       .clkdm_del_sleepdep     = omap4_clkdm_del_wkup_sleep_dep,
+       .clkdm_read_sleepdep    = omap4_clkdm_read_wkup_sleep_dep,
+       .clkdm_clear_all_sleepdeps      = omap4_clkdm_clear_all_wkup_sleep_deps,
+       .clkdm_sleep            = omap4_clkdm_sleep,
+       .clkdm_wakeup           = omap4_clkdm_wakeup,
+       .clkdm_allow_idle       = omap4_clkdm_allow_idle,
+       .clkdm_deny_idle        = omap4_clkdm_deny_idle,
+       .clkdm_clk_enable       = omap4_clkdm_clk_enable,
+       .clkdm_clk_disable      = omap4_clkdm_clk_disable,
+};
index d69fdefef9858addee526adee078a94816216af9..bd7bab889745f82ded937256ec6aff76ee7e9e26 100644 (file)
@@ -38,4 +38,6 @@ extern u32 omap4_cminst_clear_inst_reg_bits(u32 bits, u8 part, s16 inst,
 extern u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx,
                                           u32 mask);
 
+extern void omap_cm_base_init(void);
+
 #endif
index 48daac2581b4a154a768923681ac108c084a5c98..ad856092c06aa889c149a70142f0397573b26a8a 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/spi/ads7846.h>
 
 #include <linux/platform_data/spi-omap2-mcspi.h>
-#include <linux/platform_data/mtd-nand-omap2.h>
 
 #include "common.h"
 #include "common-board-devices.h"
@@ -96,48 +95,3 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
 {
 }
 #endif
-
-#if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
-static struct omap_nand_platform_data nand_data;
-
-void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
-                                int nr_parts)
-{
-       u8 cs = 0;
-       u8 nandcs = GPMC_CS_NUM + 1;
-
-       /* find out the chip-select on which NAND exists */
-       while (cs < GPMC_CS_NUM) {
-               u32 ret = 0;
-               ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
-
-               if ((ret & 0xC00) == 0x800) {
-                       printk(KERN_INFO "Found NAND on CS%d\n", cs);
-                       if (nandcs > GPMC_CS_NUM)
-                               nandcs = cs;
-               }
-               cs++;
-       }
-
-       if (nandcs > GPMC_CS_NUM) {
-               pr_info("NAND: Unable to find configuration in GPMC\n");
-               return;
-       }
-
-       if (nandcs < GPMC_CS_NUM) {
-               nand_data.cs = nandcs;
-               nand_data.parts = parts;
-               nand_data.nr_parts = nr_parts;
-               nand_data.devsize = options;
-
-               printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
-               if (gpmc_nand_init(&nand_data) < 0)
-                       printk(KERN_ERR "Unable to register NAND device\n");
-       }
-}
-#else
-void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
-                                int nr_parts)
-{
-}
-#endif
index a0b4a42836ab9f7a29f1757ee410e37a237af00c..72bb41b3fd254382ce23a5759ba607a7f7777f1f 100644 (file)
@@ -10,6 +10,5 @@ struct ads7846_platform_data;
 
 void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
                       struct ads7846_platform_data *board_pdata);
-void omap_nand_flash_init(int opts, struct mtd_partition *parts, int n_parts);
 
 #endif /* __OMAP_COMMON_BOARD_DEVICES__ */
index 17950c6e130b12250fa0eb60aac4ae14686e5c85..5c2fd4863b2bc7f32b4289cc1fb0059d5fec82e2 100644 (file)
  */
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/clk.h>
-#include <linux/io.h>
+#include <linux/platform_data/dsp-omap.h>
 
-#include <plat/clock.h>
+#include <plat/vram.h>
 
-#include "soc.h"
-#include "iomap.h"
 #include "common.h"
-#include "sdrc.h"
-#include "control.h"
-
-/* Global address base setup code */
-
-static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
-{
-       omap2_set_globals_tap(omap2_globals);
-       omap2_set_globals_sdrc(omap2_globals);
-       omap2_set_globals_control(omap2_globals);
-       omap2_set_globals_prcm(omap2_globals);
-}
-
-#if defined(CONFIG_SOC_OMAP2420)
-
-static struct omap_globals omap242x_globals = {
-       .class  = OMAP242X_CLASS,
-       .tap    = OMAP2_L4_IO_ADDRESS(0x48014000),
-       .sdrc   = OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
-       .sms    = OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE),
-       .ctrl   = OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
-       .prm    = OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
-       .cm     = OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
-};
-
-void __init omap2_set_globals_242x(void)
-{
-       __omap2_set_globals(&omap242x_globals);
-}
-
-void __init omap242x_map_io(void)
-{
-       omap242x_map_common_io();
-}
-#endif
-
-#if defined(CONFIG_SOC_OMAP2430)
-
-static struct omap_globals omap243x_globals = {
-       .class  = OMAP243X_CLASS,
-       .tap    = OMAP2_L4_IO_ADDRESS(0x4900a000),
-       .sdrc   = OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
-       .sms    = OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE),
-       .ctrl   = OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
-       .prm    = OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
-       .cm     = OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
-};
-
-void __init omap2_set_globals_243x(void)
-{
-       __omap2_set_globals(&omap243x_globals);
-}
-
-void __init omap243x_map_io(void)
-{
-       omap243x_map_common_io();
-}
-#endif
-
-#if defined(CONFIG_ARCH_OMAP3)
-
-static struct omap_globals omap3_globals = {
-       .class  = OMAP343X_CLASS,
-       .tap    = OMAP2_L4_IO_ADDRESS(0x4830A000),
-       .sdrc   = OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
-       .sms    = OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
-       .ctrl   = OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
-       .prm    = OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
-       .cm     = OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
-};
-
-void __init omap2_set_globals_3xxx(void)
-{
-       __omap2_set_globals(&omap3_globals);
-}
-
-void __init omap3_map_io(void)
-{
-       omap34xx_map_common_io();
-}
+#include "omap-secure.h"
 
 /*
- * Adjust TAP register base such that omap3_check_revision accesses the correct
- * TI81XX register for checking device ID (it adds 0x204 to tap base while
- * TI81XX DEVICE ID register is at offset 0x600 from control base).
+ * Stub function for OMAP2 so that common files
+ * continue to build when custom builds are used
  */
-#define TI81XX_TAP_BASE                (TI81XX_CTRL_BASE + \
-                               TI81XX_CONTROL_DEVICE_ID - 0x204)
-
-static struct omap_globals ti81xx_globals = {
-       .class  = OMAP343X_CLASS,
-       .tap    = OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE),
-       .ctrl   = OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
-       .prm    = OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
-       .cm     = OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
-};
-
-void __init omap2_set_globals_ti81xx(void)
-{
-       __omap2_set_globals(&ti81xx_globals);
-}
-
-void __init ti81xx_map_io(void)
-{
-       omapti81xx_map_common_io();
-}
-#endif
-
-#if defined(CONFIG_SOC_AM33XX)
-#define AM33XX_TAP_BASE                (AM33XX_CTRL_BASE + \
-                               TI81XX_CONTROL_DEVICE_ID - 0x204)
-
-static struct omap_globals am33xx_globals = {
-       .class  = AM335X_CLASS,
-       .tap    = AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE),
-       .ctrl   = AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
-       .prm    = AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE),
-       .cm     = AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE),
-};
-
-void __init omap2_set_globals_am33xx(void)
-{
-       __omap2_set_globals(&am33xx_globals);
-}
-
-void __init am33xx_map_io(void)
-{
-       omapam33xx_map_common_io();
-}
-#endif
-
-#if defined(CONFIG_ARCH_OMAP4)
-static struct omap_globals omap4_globals = {
-       .class  = OMAP443X_CLASS,
-       .tap    = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
-       .ctrl   = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
-       .ctrl_pad       = OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
-       .prm    = OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
-       .cm     = OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
-       .cm2    = OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
-       .prcm_mpu       = OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE),
-};
-
-void __init omap2_set_globals_443x(void)
-{
-       __omap2_set_globals(&omap4_globals);
-}
-
-void __init omap4_map_io(void)
-{
-       omap44xx_map_common_io();
-}
-#endif
-
-#if defined(CONFIG_SOC_OMAP5)
-static struct omap_globals omap5_globals = {
-       .class  = OMAP54XX_CLASS,
-       .tap    = OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
-       .ctrl   = OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
-       .ctrl_pad       = OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE),
-       .prm    = OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE),
-       .cm     = OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
-       .cm2    = OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE),
-       .prcm_mpu = OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE),
-};
-
-void __init omap2_set_globals_5xxx(void)
+int __weak omap_secure_ram_reserve_memblock(void)
 {
-       omap2_set_globals_tap(&omap5_globals);
-       omap2_set_globals_control(&omap5_globals);
-       omap2_set_globals_prcm(&omap5_globals);
+       return 0;
 }
 
-void __init omap5_map_io(void)
+void __init omap_reserve(void)
 {
-       omap5_map_common_io();
+       omap_vram_reserve_sdram_memblock();
+       omap_dsp_reserve_sdram_memblock();
+       omap_secure_ram_reserve_memblock();
+       omap_barrier_reserve_memblock();
 }
-#endif
index 7045e4d61ac39608acb1a46ea60c5c020e067726..08c586451f930002a9e68f8a258b64cda264af5e 100644 (file)
 
 #include <linux/irq.h>
 #include <linux/delay.h>
+#include <linux/i2c.h>
 #include <linux/i2c/twl.h>
+#include <linux/i2c-omap.h>
 
 #include <asm/proc-fns.h>
 
-#include <plat/cpu.h>
-#include <plat/serial.h>
-#include <plat/common.h>
+#include "i2c.h"
+#include "serial.h"
 
-#define OMAP_INTC_START                NR_IRQS
-
-#ifdef CONFIG_SOC_OMAP2420
-extern void omap242x_map_common_io(void);
-#else
-static inline void omap242x_map_common_io(void)
-{
-}
-#endif
-
-#ifdef CONFIG_SOC_OMAP2430
-extern void omap243x_map_common_io(void);
-#else
-static inline void omap243x_map_common_io(void)
-{
-}
-#endif
-
-#ifdef CONFIG_ARCH_OMAP3
-extern void omap34xx_map_common_io(void);
-#else
-static inline void omap34xx_map_common_io(void)
-{
-}
-#endif
-
-#ifdef CONFIG_SOC_TI81XX
-extern void omapti81xx_map_common_io(void);
-#else
-static inline void omapti81xx_map_common_io(void)
-{
-}
-#endif
+#include "usb.h"
 
-#ifdef CONFIG_SOC_AM33XX
-extern void omapam33xx_map_common_io(void);
-#else
-static inline void omapam33xx_map_common_io(void)
-{
-}
-#endif
-
-#ifdef CONFIG_ARCH_OMAP4
-extern void omap44xx_map_common_io(void);
-#else
-static inline void omap44xx_map_common_io(void)
-{
-}
-#endif
+#define OMAP_INTC_START                NR_IRQS
 
 #if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2)
 int omap2_pm_init(void);
@@ -122,14 +77,6 @@ static inline int omap_mux_late_init(void)
 }
 #endif
 
-#ifdef CONFIG_SOC_OMAP5
-extern void omap5_map_common_io(void);
-#else
-static inline void omap5_map_common_io(void)
-{
-}
-#endif
-
 extern void omap2_init_common_infrastructure(void);
 
 extern struct sys_timer omap2_timer;
@@ -162,52 +109,43 @@ void am35xx_init_late(void);
 void ti81xx_init_late(void);
 void omap4430_init_late(void);
 int omap2_common_pm_late_init(void);
-void omap_prcm_restart(char, const char *);
 
-/*
- * IO bases for various OMAP processors
- * Except the tap base, rest all the io bases
- * listed are physical addresses.
- */
-struct omap_globals {
-       u32             class;          /* OMAP class to detect */
-       void __iomem    *tap;           /* Control module ID code */
-       void __iomem    *sdrc;           /* SDRAM Controller */
-       void __iomem    *sms;            /* SDRAM Memory Scheduler */
-       void __iomem    *ctrl;           /* System Control Module */
-       void __iomem    *ctrl_pad;      /* PAD Control Module */
-       void __iomem    *prm;            /* Power and Reset Management */
-       void __iomem    *cm;             /* Clock Management */
-       void __iomem    *cm2;
-       void __iomem    *prcm_mpu;
-};
-
-void omap2_set_globals_242x(void);
-void omap2_set_globals_243x(void);
-void omap2_set_globals_3xxx(void);
-void omap2_set_globals_443x(void);
-void omap2_set_globals_5xxx(void);
-void omap2_set_globals_ti81xx(void);
-void omap2_set_globals_am33xx(void);
-
-/* These get called from omap2_set_globals_xxxx(), do not call these */
-void omap2_set_globals_tap(struct omap_globals *);
-#if defined(CONFIG_SOC_HAS_OMAP2_SDRC)
-void omap2_set_globals_sdrc(struct omap_globals *);
+#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
+void omap2xxx_restart(char mode, const char *cmd);
+#else
+static inline void omap2xxx_restart(char mode, const char *cmd)
+{
+}
+#endif
+
+#ifdef CONFIG_ARCH_OMAP3
+void omap3xxx_restart(char mode, const char *cmd);
+#else
+static inline void omap3xxx_restart(char mode, const char *cmd)
+{
+}
+#endif
+
+#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
+void omap44xx_restart(char mode, const char *cmd);
 #else
-static inline void omap2_set_globals_sdrc(struct omap_globals *omap2_globals)
-{ }
+static inline void omap44xx_restart(char mode, const char *cmd)
+{
+}
 #endif
-void omap2_set_globals_control(struct omap_globals *);
-void omap2_set_globals_prcm(struct omap_globals *);
-
-void omap242x_map_io(void);
-void omap243x_map_io(void);
-void omap3_map_io(void);
-void am33xx_map_io(void);
-void omap4_map_io(void);
-void omap5_map_io(void);
-void ti81xx_map_io(void);
+
+/* This gets called from mach-omap2/io.c, do not call this */
+void __init omap2_set_globals_tap(u32 class, void __iomem *tap);
+
+void __init omap242x_map_io(void);
+void __init omap243x_map_io(void);
+void __init omap3_map_io(void);
+void __init am33xx_map_io(void);
+void __init omap4_map_io(void);
+void __init omap5_map_io(void);
+void __init ti81xx_map_io(void);
+
+/* omap_barriers_init() is OMAP4 only */
 void omap_barriers_init(void);
 
 /**
@@ -338,6 +276,10 @@ extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
                                      struct omap_sdrc_params *sdrc_cs1);
 struct omap2_hsmmc_info;
 extern int omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers);
+extern void omap_reserve(void);
+
+struct omap_hwmod;
+extern int omap_dss_reset(struct omap_hwmod *);
 
 #endif /* __ASSEMBLER__ */
 #endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */
index d1ff8399a2223103a67d6ad2ff46210200c9097c..2adb2683f074de2e5846d06a0b370b8ff2b99a38 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP2/3 System Control Module register access
  *
- * Copyright (C) 2007 Texas Instruments, Inc.
+ * Copyright (C) 2007, 2012 Texas Instruments, Inc.
  * Copyright (C) 2007 Nokia Corporation
  *
  * Written by Paul Walmsley
 #include <linux/kernel.h>
 #include <linux/io.h>
 
-#include <plat/sdrc.h>
-
 #include "soc.h"
 #include "iomap.h"
 #include "common.h"
 #include "cm-regbits-34xx.h"
 #include "prm-regbits-34xx.h"
-#include "prm2xxx_3xxx.h"
-#include "cm2xxx_3xxx.h"
+#include "prm3xxx.h"
+#include "cm3xxx.h"
 #include "sdrc.h"
 #include "pm.h"
 #include "control.h"
@@ -149,13 +147,11 @@ static struct omap3_control_regs control_context;
 #define OMAP_CTRL_REGADDR(reg)         (omap2_ctrl_base + (reg))
 #define OMAP4_CTRL_PAD_REGADDR(reg)    (omap4_ctrl_pad_base + (reg))
 
-void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
+void __init omap2_set_globals_control(void __iomem *ctrl,
+                                     void __iomem *ctrl_pad)
 {
-       if (omap2_globals->ctrl)
-               omap2_ctrl_base = omap2_globals->ctrl;
-
-       if (omap2_globals->ctrl_pad)
-               omap4_ctrl_pad_base = omap2_globals->ctrl_pad;
+       omap2_ctrl_base = ctrl;
+       omap4_ctrl_pad_base = ctrl_pad;
 }
 
 void __iomem *omap_ctrl_base_get(void)
index a89e8256fd0e2d022c62054edf2a00d8187c7157..4ca8747b3cc92b101a433199bf123e227a976bad 100644 (file)
@@ -414,6 +414,8 @@ extern void omap_ctrl_write_dsp_boot_addr(u32 bootaddr);
 extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode);
 extern void omap3630_ctrl_disable_rta(void);
 extern int omap3_ctrl_save_padconf(void);
+extern void omap2_set_globals_control(void __iomem *ctrl,
+                                     void __iomem *ctrl_pad);
 #else
 #define omap_ctrl_base_get()           0
 #define omap_ctrl_readb(x)             0
index bc2756959be5dc5815bcfd462cbd95586caa035c..bca7a88857038f2193a64435587a584887ac0a29 100644 (file)
@@ -27,7 +27,6 @@
 #include <linux/export.h>
 #include <linux/cpu_pm.h>
 
-#include <plat/prcm.h>
 #include "powerdomain.h"
 #include "clockdomain.h"
 
index cba60e05e32ecef6a6c97cbf6679b99f474d4a5a..cf365c387c06e70677e54e30cbcb2425d451330f 100644 (file)
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
 
+#include <plat-omap/dma-omap.h>
+
 #include "iomap.h"
-#include <plat/dma.h>
-#include <plat/omap_hwmod.h>
-#include <plat/omap_device.h>
+#include "omap_hwmod.h"
+#include "omap_device.h"
 #include "omap4-keypad.h"
 
 #include "soc.h"
@@ -34,6 +35,7 @@
 #include "mux.h"
 #include "control.h"
 #include "devices.h"
+#include "dma.h"
 
 #define L3_MODULES_MAX_LEN 12
 #define L3_MODULES 3
@@ -644,29 +646,3 @@ static int __init omap2_init_devices(void)
        return 0;
 }
 arch_initcall(omap2_init_devices);
-
-#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
-static int __init omap_init_wdt(void)
-{
-       int id = -1;
-       struct platform_device *pdev;
-       struct omap_hwmod *oh;
-       char *oh_name = "wd_timer2";
-       char *dev_name = "omap_wdt";
-
-       if (!cpu_class_is_omap2() || of_have_populated_dt())
-               return 0;
-
-       oh = omap_hwmod_lookup(oh_name);
-       if (!oh) {
-               pr_err("Could not look up wd_timer%d hwmod\n", id);
-               return -EINVAL;
-       }
-
-       pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0);
-       WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
-                               dev_name, oh->name);
-       return 0;
-}
-subsys_initcall(omap_init_wdt);
-#endif
index 1011995f150a60c8f4453832835f4b974dbdd000..38ba58c97628efd6a99d61377eeff545d09e9cc4 100644 (file)
 #include <linux/delay.h>
 
 #include <video/omapdss.h>
-#include <plat/omap_hwmod.h>
-#include <plat/omap_device.h>
-#include <plat/omap-pm.h>
+#include "omap_hwmod.h"
+#include "omap_device.h"
+#include "omap-pm.h"
 #include "common.h"
 
+#include "soc.h"
 #include "iomap.h"
 #include "mux.h"
 #include "control.h"
 #include "display.h"
+#include "prm.h"
 
 #define DISPC_CONTROL          0x0040
 #define DISPC_CONTROL2         0x0238
@@ -284,6 +286,35 @@ err:
        return ERR_PTR(r);
 }
 
+static enum omapdss_version __init omap_display_get_version(void)
+{
+       if (cpu_is_omap24xx())
+               return OMAPDSS_VER_OMAP24xx;
+       else if (cpu_is_omap3630())
+               return OMAPDSS_VER_OMAP3630;
+       else if (cpu_is_omap34xx()) {
+               if (soc_is_am35xx()) {
+                       return OMAPDSS_VER_AM35xx;
+               } else {
+                       if (omap_rev() < OMAP3430_REV_ES3_0)
+                               return OMAPDSS_VER_OMAP34xx_ES1;
+                       else
+                               return OMAPDSS_VER_OMAP34xx_ES3;
+               }
+       } else if (omap_rev() == OMAP4430_REV_ES1_0)
+               return OMAPDSS_VER_OMAP4430_ES1;
+       else if (omap_rev() == OMAP4430_REV_ES2_0 ||
+                       omap_rev() == OMAP4430_REV_ES2_1 ||
+                       omap_rev() == OMAP4430_REV_ES2_2)
+               return OMAPDSS_VER_OMAP4430_ES2;
+       else if (cpu_is_omap44xx())
+               return OMAPDSS_VER_OMAP4;
+       else if (soc_is_omap54xx())
+               return OMAPDSS_VER_OMAP5;
+       else
+               return OMAPDSS_VER_UNKNOWN;
+}
+
 int __init omap_display_init(struct omap_dss_board_info *board_data)
 {
        int r = 0;
@@ -291,9 +322,18 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
        int i, oh_count;
        const struct omap_dss_hwmod_data *curr_dss_hwmod;
        struct platform_device *dss_pdev;
+       enum omapdss_version ver;
 
        /* create omapdss device */
 
+       ver = omap_display_get_version();
+
+       if (ver == OMAPDSS_VER_UNKNOWN) {
+               pr_err("DSS not supported on this SoC\n");
+               return -ENODEV;
+       }
+
+       board_data->version = ver;
        board_data->dsi_enable_pads = omap_dsi_enable_pads;
        board_data->dsi_disable_pads = omap_dsi_disable_pads;
        board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;
@@ -473,7 +513,6 @@ static void dispc_disable_outputs(void)
        }
 }
 
-#define MAX_MODULE_SOFTRESET_WAIT      10000
 int omap_dss_reset(struct omap_hwmod *oh)
 {
        struct omap_hwmod_opt_clk *oc;
index ff75abe60af2c25eac226987d022584219cfa9fb..e5aba58da5d2f70343296cdedd7bb34e8099118b 100644 (file)
 #include <linux/init.h>
 #include <linux/device.h>
 
-#include <plat/omap_hwmod.h>
-#include <plat/omap_device.h>
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
+
+#include "soc.h"
+#include "omap_hwmod.h"
+#include "omap_device.h"
 
 #define OMAP2_DMA_STRIDE       0x60
 
@@ -274,6 +276,9 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
                return -ENOMEM;
        }
 
+       if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP))
+               d->dev_caps |= HS_CHANNELS_RESERVED;
+
        /* Check the capabilities register for descriptor loading feature */
        if (dma_read(CAPS_0, 0) & DMA_HAS_DESCRIPTOR_CAPS)
                dma_common_ch_end = CCDN;
diff --git a/arch/arm/mach-omap2/dma.h b/arch/arm/mach-omap2/dma.h
new file mode 100644 (file)
index 0000000..eba80db
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ *  OMAP2PLUS DMA channel definitions
+ *
+ * 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
+ */
+
+#ifndef __OMAP2PLUS_DMA_CHANNEL_H
+#define __OMAP2PLUS_DMA_CHANNEL_H
+
+
+/* DMA channels for 24xx */
+#define OMAP24XX_DMA_NO_DEVICE         0
+#define OMAP24XX_DMA_XTI_DMA           1       /* S_DMA_0 */
+#define OMAP24XX_DMA_EXT_DMAREQ0       2       /* S_DMA_1 */
+#define OMAP24XX_DMA_EXT_DMAREQ1       3       /* S_DMA_2 */
+#define OMAP24XX_DMA_GPMC              4       /* S_DMA_3 */
+#define OMAP24XX_DMA_GFX               5       /* S_DMA_4 */
+#define OMAP24XX_DMA_DSS               6       /* S_DMA_5 */
+#define OMAP242X_DMA_VLYNQ_TX          7       /* S_DMA_6 */
+#define OMAP24XX_DMA_EXT_DMAREQ2       7       /* S_DMA_6 */
+#define OMAP24XX_DMA_CWT               8       /* S_DMA_7 */
+#define OMAP24XX_DMA_AES_TX            9       /* S_DMA_8 */
+#define OMAP24XX_DMA_AES_RX            10      /* S_DMA_9 */
+#define OMAP24XX_DMA_DES_TX            11      /* S_DMA_10 */
+#define OMAP24XX_DMA_DES_RX            12      /* S_DMA_11 */
+#define OMAP24XX_DMA_SHA1MD5_RX                13      /* S_DMA_12 */
+#define OMAP34XX_DMA_SHA2MD5_RX                13      /* S_DMA_12 */
+#define OMAP242X_DMA_EXT_DMAREQ2       14      /* S_DMA_13 */
+#define OMAP242X_DMA_EXT_DMAREQ3       15      /* S_DMA_14 */
+#define OMAP242X_DMA_EXT_DMAREQ4       16      /* S_DMA_15 */
+#define OMAP242X_DMA_EAC_AC_RD         17      /* S_DMA_16 */
+#define OMAP242X_DMA_EAC_AC_WR         18      /* S_DMA_17 */
+#define OMAP242X_DMA_EAC_MD_UL_RD      19      /* S_DMA_18 */
+#define OMAP242X_DMA_EAC_MD_UL_WR      20      /* S_DMA_19 */
+#define OMAP242X_DMA_EAC_MD_DL_RD      21      /* S_DMA_20 */
+#define OMAP242X_DMA_EAC_MD_DL_WR      22      /* S_DMA_21 */
+#define OMAP242X_DMA_EAC_BT_UL_RD      23      /* S_DMA_22 */
+#define OMAP242X_DMA_EAC_BT_UL_WR      24      /* S_DMA_23 */
+#define OMAP242X_DMA_EAC_BT_DL_RD      25      /* S_DMA_24 */
+#define OMAP242X_DMA_EAC_BT_DL_WR      26      /* S_DMA_25 */
+#define OMAP243X_DMA_EXT_DMAREQ3       14      /* S_DMA_13 */
+#define OMAP24XX_DMA_SPI3_TX0          15      /* S_DMA_14 */
+#define OMAP24XX_DMA_SPI3_RX0          16      /* S_DMA_15 */
+#define OMAP24XX_DMA_MCBSP3_TX         17      /* S_DMA_16 */
+#define OMAP24XX_DMA_MCBSP3_RX         18      /* S_DMA_17 */
+#define OMAP24XX_DMA_MCBSP4_TX         19      /* S_DMA_18 */
+#define OMAP24XX_DMA_MCBSP4_RX         20      /* S_DMA_19 */
+#define OMAP24XX_DMA_MCBSP5_TX         21      /* S_DMA_20 */
+#define OMAP24XX_DMA_MCBSP5_RX         22      /* S_DMA_21 */
+#define OMAP24XX_DMA_SPI3_TX1          23      /* S_DMA_22 */
+#define OMAP24XX_DMA_SPI3_RX1          24      /* S_DMA_23 */
+#define OMAP243X_DMA_EXT_DMAREQ4       25      /* S_DMA_24 */
+#define OMAP243X_DMA_EXT_DMAREQ5       26      /* S_DMA_25 */
+#define OMAP34XX_DMA_I2C3_TX           25      /* S_DMA_24 */
+#define OMAP34XX_DMA_I2C3_RX           26      /* S_DMA_25 */
+#define OMAP24XX_DMA_I2C1_TX           27      /* S_DMA_26 */
+#define OMAP24XX_DMA_I2C1_RX           28      /* S_DMA_27 */
+#define OMAP24XX_DMA_I2C2_TX           29      /* S_DMA_28 */
+#define OMAP24XX_DMA_I2C2_RX           30      /* S_DMA_29 */
+#define OMAP24XX_DMA_MCBSP1_TX         31      /* S_DMA_30 */
+#define OMAP24XX_DMA_MCBSP1_RX         32      /* S_DMA_31 */
+#define OMAP24XX_DMA_MCBSP2_TX         33      /* S_DMA_32 */
+#define OMAP24XX_DMA_MCBSP2_RX         34      /* S_DMA_33 */
+#define OMAP24XX_DMA_SPI1_TX0          35      /* S_DMA_34 */
+#define OMAP24XX_DMA_SPI1_RX0          36      /* S_DMA_35 */
+#define OMAP24XX_DMA_SPI1_TX1          37      /* S_DMA_36 */
+#define OMAP24XX_DMA_SPI1_RX1          38      /* S_DMA_37 */
+#define OMAP24XX_DMA_SPI1_TX2          39      /* S_DMA_38 */
+#define OMAP24XX_DMA_SPI1_RX2          40      /* S_DMA_39 */
+#define OMAP24XX_DMA_SPI1_TX3          41      /* S_DMA_40 */
+#define OMAP24XX_DMA_SPI1_RX3          42      /* S_DMA_41 */
+#define OMAP24XX_DMA_SPI2_TX0          43      /* S_DMA_42 */
+#define OMAP24XX_DMA_SPI2_RX0          44      /* S_DMA_43 */
+#define OMAP24XX_DMA_SPI2_TX1          45      /* S_DMA_44 */
+#define OMAP24XX_DMA_SPI2_RX1          46      /* S_DMA_45 */
+#define OMAP24XX_DMA_MMC2_TX           47      /* S_DMA_46 */
+#define OMAP24XX_DMA_MMC2_RX           48      /* S_DMA_47 */
+#define OMAP24XX_DMA_UART1_TX          49      /* S_DMA_48 */
+#define OMAP24XX_DMA_UART1_RX          50      /* S_DMA_49 */
+#define OMAP24XX_DMA_UART2_TX          51      /* S_DMA_50 */
+#define OMAP24XX_DMA_UART2_RX          52      /* S_DMA_51 */
+#define OMAP24XX_DMA_UART3_TX          53      /* S_DMA_52 */
+#define OMAP24XX_DMA_UART3_RX          54      /* S_DMA_53 */
+#define OMAP24XX_DMA_USB_W2FC_TX0      55      /* S_DMA_54 */
+#define OMAP24XX_DMA_USB_W2FC_RX0      56      /* S_DMA_55 */
+#define OMAP24XX_DMA_USB_W2FC_TX1      57      /* S_DMA_56 */
+#define OMAP24XX_DMA_USB_W2FC_RX1      58      /* S_DMA_57 */
+#define OMAP24XX_DMA_USB_W2FC_TX2      59      /* S_DMA_58 */
+#define OMAP24XX_DMA_USB_W2FC_RX2      60      /* S_DMA_59 */
+#define OMAP24XX_DMA_MMC1_TX           61      /* S_DMA_60 */
+#define OMAP24XX_DMA_MMC1_RX           62      /* S_DMA_61 */
+#define OMAP24XX_DMA_MS                        63      /* S_DMA_62 */
+#define OMAP242X_DMA_EXT_DMAREQ5       64      /* S_DMA_63 */
+#define OMAP243X_DMA_EXT_DMAREQ6       64      /* S_DMA_63 */
+#define OMAP34XX_DMA_EXT_DMAREQ3       64      /* S_DMA_63 */
+#define OMAP34XX_DMA_AES2_TX           65      /* S_DMA_64 */
+#define OMAP34XX_DMA_AES2_RX           66      /* S_DMA_65 */
+#define OMAP34XX_DMA_DES2_TX           67      /* S_DMA_66 */
+#define OMAP34XX_DMA_DES2_RX           68      /* S_DMA_67 */
+#define OMAP34XX_DMA_SHA1MD5_RX                69      /* S_DMA_68 */
+#define OMAP34XX_DMA_SPI4_TX0          70      /* S_DMA_69 */
+#define OMAP34XX_DMA_SPI4_RX0          71      /* S_DMA_70 */
+#define OMAP34XX_DSS_DMA0              72      /* S_DMA_71 */
+#define OMAP34XX_DSS_DMA1              73      /* S_DMA_72 */
+#define OMAP34XX_DSS_DMA2              74      /* S_DMA_73 */
+#define OMAP34XX_DSS_DMA3              75      /* S_DMA_74 */
+#define OMAP34XX_DMA_MMC3_TX           77      /* S_DMA_76 */
+#define OMAP34XX_DMA_MMC3_RX           78      /* S_DMA_77 */
+#define OMAP34XX_DMA_USIM_TX           79      /* S_DMA_78 */
+#define OMAP34XX_DMA_USIM_RX           80      /* S_DMA_79 */
+
+#define OMAP36XX_DMA_UART4_TX          81      /* S_DMA_80 */
+#define OMAP36XX_DMA_UART4_RX          82      /* S_DMA_81 */
+
+/* Only for AM35xx */
+#define AM35XX_DMA_UART4_TX            54
+#define AM35XX_DMA_UART4_RX            55
+
+#endif /* __OMAP2PLUS_DMA_CHANNEL_H */
index 814e1808e1586c64e51a8b5ec07be860c2043940..eacf51f2bc27ba766f05571e34ba14da2ce1fb75 100644 (file)
@@ -28,8 +28,6 @@
 #include <linux/bitops.h>
 #include <linux/clkdev.h>
 
-#include <plat/clock.h>
-
 #include "soc.h"
 #include "clock.h"
 #include "cm2xxx_3xxx.h"
index 09d0ccccb86196650f2ff220b1134320f7c3fb8a..5854da168a9c4e74602893077d68a29c36c56ab5 100644 (file)
@@ -15,8 +15,6 @@
 #include <linux/io.h>
 #include <linux/bitops.h>
 
-#include <plat/clock.h>
-
 #include "soc.h"
 #include "clock.h"
 #include "clock44xx.h"
index 72e0f01b715cb221fd18df7587fdd73ce0304551..6282cc82661355afe27abdeb114f92ba6895b747 100644 (file)
@@ -24,8 +24,8 @@
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
 
-#include <plat/omap_device.h>
-#include <plat/omap_hwmod.h>
+#include "omap_device.h"
+#include "omap_hwmod.h"
 
 #if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE)
 
index 98388109f22afd91363428c7410dfb5687c79dc5..b155500e84a8e12dc5eeb6b6d3844d7b2fe6b122 100644 (file)
@@ -27,7 +27,7 @@
 #include "cm2xxx_3xxx.h"
 #include "prm2xxx_3xxx.h"
 #ifdef CONFIG_BRIDGE_DVFS
-#include <plat/omap-pm.h>
+#include "omap-pm.h"
 #endif
 
 #include <linux/platform_data/dsp-omap.h>
index d1058f16fb40bbf85bbcdb17331a91523fadcf5b..399acabc3d0b96006641e30593fb4d586ad00737 100644 (file)
@@ -23,9 +23,9 @@
 #include <linux/of.h>
 #include <linux/platform_data/gpio-omap.h>
 
-#include <plat/omap_hwmod.h>
-#include <plat/omap_device.h>
-#include <plat/omap-pm.h>
+#include "omap_hwmod.h"
+#include "omap_device.h"
+#include "omap-pm.h"
 
 #include "powerdomain.h"
 
index 4acf497faeb3c14aeb2cdbb81f36f5e6cd45ac69..8607735b3ab3c96b8a6fecf25066843a47aaee57 100644 (file)
 
 #include <asm/mach/flash.h>
 
-#include <plat/gpmc.h>
-
+#include "gpmc.h"
 #include "soc.h"
+#include "gpmc-nand.h"
+
+/* minimum size for IO mapping */
+#define        NAND_IO_SIZE    4
 
 static struct resource gpmc_nand_resource[] = {
        {
@@ -40,41 +43,36 @@ static struct platform_device gpmc_nand_device = {
        .resource       = gpmc_nand_resource,
 };
 
-static int omap2_nand_gpmc_retime(struct omap_nand_platform_data *gpmc_nand_data)
+static int omap2_nand_gpmc_retime(
+                               struct omap_nand_platform_data *gpmc_nand_data,
+                               struct gpmc_timings *gpmc_t)
 {
        struct gpmc_timings t;
        int err;
 
-       if (!gpmc_nand_data->gpmc_t)
-               return 0;
-
        memset(&t, 0, sizeof(t));
-       t.sync_clk = gpmc_nand_data->gpmc_t->sync_clk;
-       t.cs_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_on);
-       t.adv_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->adv_on);
+       t.sync_clk = gpmc_t->sync_clk;
+       t.cs_on = gpmc_round_ns_to_ticks(gpmc_t->cs_on);
+       t.adv_on = gpmc_round_ns_to_ticks(gpmc_t->adv_on);
 
        /* Read */
-       t.adv_rd_off = gpmc_round_ns_to_ticks(
-                               gpmc_nand_data->gpmc_t->adv_rd_off);
+       t.adv_rd_off = gpmc_round_ns_to_ticks(gpmc_t->adv_rd_off);
        t.oe_on  = t.adv_on;
-       t.access = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->access);
-       t.oe_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->oe_off);
-       t.cs_rd_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_rd_off);
-       t.rd_cycle  = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->rd_cycle);
+       t.access = gpmc_round_ns_to_ticks(gpmc_t->access);
+       t.oe_off = gpmc_round_ns_to_ticks(gpmc_t->oe_off);
+       t.cs_rd_off = gpmc_round_ns_to_ticks(gpmc_t->cs_rd_off);
+       t.rd_cycle  = gpmc_round_ns_to_ticks(gpmc_t->rd_cycle);
 
        /* Write */
-       t.adv_wr_off = gpmc_round_ns_to_ticks(
-                               gpmc_nand_data->gpmc_t->adv_wr_off);
+       t.adv_wr_off = gpmc_round_ns_to_ticks(gpmc_t->adv_wr_off);
        t.we_on  = t.oe_on;
        if (cpu_is_omap34xx()) {
-           t.wr_data_mux_bus = gpmc_round_ns_to_ticks(
-                               gpmc_nand_data->gpmc_t->wr_data_mux_bus);
-           t.wr_access = gpmc_round_ns_to_ticks(
-                               gpmc_nand_data->gpmc_t->wr_access);
+           t.wr_data_mux_bus = gpmc_round_ns_to_ticks(gpmc_t->wr_data_mux_bus);
+           t.wr_access = gpmc_round_ns_to_ticks(gpmc_t->wr_access);
        }
-       t.we_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->we_off);
-       t.cs_wr_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_wr_off);
-       t.wr_cycle  = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->wr_cycle);
+       t.we_off = gpmc_round_ns_to_ticks(gpmc_t->we_off);
+       t.cs_wr_off = gpmc_round_ns_to_ticks(gpmc_t->cs_wr_off);
+       t.wr_cycle  = gpmc_round_ns_to_ticks(gpmc_t->wr_cycle);
 
        /* Configure GPMC */
        if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
@@ -91,7 +89,29 @@ static int omap2_nand_gpmc_retime(struct omap_nand_platform_data *gpmc_nand_data
        return 0;
 }
 
-int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
+static bool __init gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
+{
+       /* support only OMAP3 class */
+       if (!cpu_is_omap34xx()) {
+               pr_err("BCH ecc is not supported on this CPU\n");
+               return 0;
+       }
+
+       /*
+        * For now, assume 4-bit mode is only supported on OMAP3630 ES1.x, x>=1.
+        * Other chips may be added if confirmed to work.
+        */
+       if ((ecc_opt == OMAP_ECC_BCH4_CODE_HW) &&
+           (!cpu_is_omap3630() || (GET_OMAP_REVISION() == 0))) {
+               pr_err("BCH 4-bit mode is not supported on this CPU\n");
+               return 0;
+       }
+
+       return 1;
+}
+
+int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
+                         struct gpmc_timings *gpmc_t)
 {
        int err = 0;
        struct device *dev = &gpmc_nand_device.dev;
@@ -112,11 +132,13 @@ int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
                                gpmc_get_client_irq(GPMC_IRQ_FIFOEVENTENABLE);
        gpmc_nand_resource[2].start =
                                gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT);
-        /* Set timings in GPMC */
-       err = omap2_nand_gpmc_retime(gpmc_nand_data);
-       if (err < 0) {
-               dev_err(dev, "Unable to set gpmc timings: %d\n", err);
-               return err;
+
+       if (gpmc_t) {
+               err = omap2_nand_gpmc_retime(gpmc_nand_data, gpmc_t);
+               if (err < 0) {
+                       dev_err(dev, "Unable to set gpmc timings: %d\n", err);
+                       return err;
+               }
        }
 
        /* Enable RD PIN Monitoring Reg */
@@ -126,6 +148,9 @@ int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
 
        gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs);
 
+       if (!gpmc_hwecc_bch_capable(gpmc_nand_data->ecc_opt))
+               return -EINVAL;
+
        err = platform_device_register(&gpmc_nand_device);
        if (err < 0) {
                dev_err(dev, "Unable to register NAND device\n");
diff --git a/arch/arm/mach-omap2/gpmc-nand.h b/arch/arm/mach-omap2/gpmc-nand.h
new file mode 100644 (file)
index 0000000..d59e128
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ *  arch/arm/mach-omap2/gpmc-nand.h
+ *
+ *  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        __OMAP2_GPMC_NAND_H
+#define        __OMAP2_GPMC_NAND_H
+
+#include "gpmc.h"
+#include <linux/platform_data/mtd-nand-omap2.h>
+
+#if IS_ENABLED(CONFIG_MTD_NAND_OMAP2)
+extern int gpmc_nand_init(struct omap_nand_platform_data *d,
+                         struct gpmc_timings *gpmc_t);
+#else
+static inline int gpmc_nand_init(struct omap_nand_platform_data *d,
+                                struct gpmc_timings *gpmc_t)
+{
+       return 0;
+}
+#endif
+
+#endif
index 916716e1da3bf6644799d7969a3d9924b1ed94e9..d102183ed9a5b21289b61678b9f4b49746d68c31 100644 (file)
 #include <linux/mtd/onenand_regs.h>
 #include <linux/io.h>
 #include <linux/platform_data/mtd-onenand-omap2.h>
+#include <linux/err.h>
 
 #include <asm/mach/flash.h>
 
-#include <plat/gpmc.h>
-
+#include "gpmc.h"
 #include "soc.h"
+#include "gpmc-onenand.h"
 
 #define        ONENAND_IO_SIZE SZ_128K
 
+#define        ONENAND_FLAG_SYNCREAD   (1 << 0)
+#define        ONENAND_FLAG_SYNCWRITE  (1 << 1)
+#define        ONENAND_FLAG_HF         (1 << 2)
+#define        ONENAND_FLAG_VHF        (1 << 3)
+
+static unsigned onenand_flags;
+static unsigned latency;
+static int fclk_offset;
+
 static struct omap_onenand_platform_data *gpmc_onenand_data;
 
 static struct resource gpmc_onenand_resource = {
@@ -38,11 +48,9 @@ static struct platform_device gpmc_onenand_device = {
        .resource       = &gpmc_onenand_resource,
 };
 
-static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base)
+static struct gpmc_timings omap2_onenand_calc_async_timings(void)
 {
        struct gpmc_timings t;
-       u32 reg;
-       int err;
 
        const int t_cer = 15;
        const int t_avdp = 12;
@@ -55,11 +63,6 @@ static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base)
        const int t_wpl = 40;
        const int t_wph = 30;
 
-       /* Ensure sync read and sync write are disabled */
-       reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
-       reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE;
-       writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
-
        memset(&t, 0, sizeof(t));
        t.sync_clk = 0;
        t.cs_on = 0;
@@ -86,25 +89,30 @@ static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base)
        t.cs_wr_off = t.we_off + gpmc_round_ns_to_ticks(t_wph);
        t.wr_cycle  = t.cs_wr_off + gpmc_round_ns_to_ticks(t_cez);
 
+       return t;
+}
+
+static int gpmc_set_async_mode(int cs, struct gpmc_timings *t)
+{
        /* Configure GPMC for asynchronous read */
        gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1,
                          GPMC_CONFIG1_DEVICESIZE_16 |
                          GPMC_CONFIG1_MUXADDDATA);
 
-       err = gpmc_cs_set_timings(cs, &t);
-       if (err)
-               return err;
+       return gpmc_cs_set_timings(cs, t);
+}
+
+static void omap2_onenand_set_async_mode(void __iomem *onenand_base)
+{
+       u32 reg;
 
        /* Ensure sync read and sync write are disabled */
        reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
        reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE;
        writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
-
-       return 0;
 }
 
-static void set_onenand_cfg(void __iomem *onenand_base, int latency,
-                               int sync_read, int sync_write, int hf, int vhf)
+static void set_onenand_cfg(void __iomem *onenand_base)
 {
        u32 reg;
 
@@ -112,19 +120,19 @@ static void set_onenand_cfg(void __iomem *onenand_base, int latency,
        reg &= ~((0x7 << ONENAND_SYS_CFG1_BRL_SHIFT) | (0x7 << 9));
        reg |=  (latency << ONENAND_SYS_CFG1_BRL_SHIFT) |
                ONENAND_SYS_CFG1_BL_16;
-       if (sync_read)
+       if (onenand_flags & ONENAND_FLAG_SYNCREAD)
                reg |= ONENAND_SYS_CFG1_SYNC_READ;
        else
                reg &= ~ONENAND_SYS_CFG1_SYNC_READ;
-       if (sync_write)
+       if (onenand_flags & ONENAND_FLAG_SYNCWRITE)
                reg |= ONENAND_SYS_CFG1_SYNC_WRITE;
        else
                reg &= ~ONENAND_SYS_CFG1_SYNC_WRITE;
-       if (hf)
+       if (onenand_flags & ONENAND_FLAG_HF)
                reg |= ONENAND_SYS_CFG1_HF;
        else
                reg &= ~ONENAND_SYS_CFG1_HF;
-       if (vhf)
+       if (onenand_flags & ONENAND_FLAG_VHF)
                reg |= ONENAND_SYS_CFG1_VHF;
        else
                reg &= ~ONENAND_SYS_CFG1_VHF;
@@ -132,21 +140,10 @@ static void set_onenand_cfg(void __iomem *onenand_base, int latency,
 }
 
 static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
-                                 void __iomem *onenand_base, bool *clk_dep)
+                                 void __iomem *onenand_base)
 {
        u16 ver = readw(onenand_base + ONENAND_REG_VERSION_ID);
-       int freq = 0;
-
-       if (cfg->get_freq) {
-               struct onenand_freq_info fi;
-
-               fi.maf_id = readw(onenand_base + ONENAND_REG_MANUFACTURER_ID);
-               fi.dev_id = readw(onenand_base + ONENAND_REG_DEVICE_ID);
-               fi.ver_id = ver;
-               freq = cfg->get_freq(&fi, clk_dep);
-               if (freq)
-                       return freq;
-       }
+       int freq;
 
        switch ((ver >> 4) & 0xf) {
        case 0:
@@ -172,9 +169,9 @@ static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
        return freq;
 }
 
-static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
-                                       void __iomem *onenand_base,
-                                       int *freq_ptr)
+static struct gpmc_timings
+omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg,
+                               int freq)
 {
        struct gpmc_timings t;
        const int t_cer  = 15;
@@ -184,29 +181,15 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
        const int t_wpl  = 40;
        const int t_wph  = 30;
        int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo;
-       int div, fclk_offset_ns, fclk_offset, gpmc_clk_ns, latency;
-       int first_time = 0, hf = 0, vhf = 0, sync_read = 0, sync_write = 0;
-       int err, ticks_cez;
-       int cs = cfg->cs, freq = *freq_ptr;
        u32 reg;
-       bool clk_dep = false;
+       int div, fclk_offset_ns, gpmc_clk_ns;
+       int ticks_cez;
+       int cs = cfg->cs;
 
-       if (cfg->flags & ONENAND_SYNC_READ) {
-               sync_read = 1;
-       } else if (cfg->flags & ONENAND_SYNC_READWRITE) {
-               sync_read = 1;
-               sync_write = 1;
-       } else
-               return omap2_onenand_set_async_mode(cs, onenand_base);
-
-       if (!freq) {
-               /* Very first call freq is not known */
-               err = omap2_onenand_set_async_mode(cs, onenand_base);
-               if (err)
-                       return err;
-               freq = omap2_onenand_get_freq(cfg, onenand_base, &clk_dep);
-               first_time = 1;
-       }
+       if (cfg->flags & ONENAND_SYNC_READ)
+               onenand_flags = ONENAND_FLAG_SYNCREAD;
+       else if (cfg->flags & ONENAND_SYNC_READWRITE)
+               onenand_flags = ONENAND_FLAG_SYNCREAD | ONENAND_FLAG_SYNCWRITE;
 
        switch (freq) {
        case 104:
@@ -244,44 +227,31 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
                t_ach   = 9;
                t_aavdh = 7;
                t_rdyo  = 15;
-               sync_write = 0;
+               onenand_flags &= ~ONENAND_FLAG_SYNCWRITE;
                break;
        }
 
-       div = gpmc_cs_calc_divider(cs, min_gpmc_clk_period);
+       div = gpmc_calc_divider(min_gpmc_clk_period);
        gpmc_clk_ns = gpmc_ticks_to_ns(div);
        if (gpmc_clk_ns < 15) /* >66Mhz */
-               hf = 1;
+               onenand_flags |= ONENAND_FLAG_HF;
+       else
+               onenand_flags &= ~ONENAND_FLAG_HF;
        if (gpmc_clk_ns < 12) /* >83Mhz */
-               vhf = 1;
-       if (vhf)
+               onenand_flags |= ONENAND_FLAG_VHF;
+       else
+               onenand_flags &= ~ONENAND_FLAG_VHF;
+       if (onenand_flags & ONENAND_FLAG_VHF)
                latency = 8;
-       else if (hf)
+       else if (onenand_flags & ONENAND_FLAG_HF)
                latency = 6;
        else if (gpmc_clk_ns >= 25) /* 40 MHz*/
                latency = 3;
        else
                latency = 4;
 
-       if (clk_dep) {
-               if (gpmc_clk_ns < 12) { /* >83Mhz */
-                       t_ces   = 3;
-                       t_avds  = 4;
-               } else if (gpmc_clk_ns < 15) { /* >66Mhz */
-                       t_ces   = 5;
-                       t_avds  = 4;
-               } else if (gpmc_clk_ns < 25) { /* >40Mhz */
-                       t_ces   = 6;
-                       t_avds  = 5;
-               } else {
-                       t_ces   = 7;
-                       t_avds  = 7;
-               }
-       }
-
-       if (first_time)
-               set_onenand_cfg(onenand_base, latency,
-                                       sync_read, sync_write, hf, vhf);
+       /* Set synchronous read timings */
+       memset(&t, 0, sizeof(t));
 
        if (div == 1) {
                reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG2);
@@ -307,8 +277,6 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
                gpmc_cs_write_reg(cs, GPMC_CS_CONFIG4, reg);
        }
 
-       /* Set synchronous read timings */
-       memset(&t, 0, sizeof(t));
        t.sync_clk = min_gpmc_clk_period;
        t.cs_on = 0;
        t.adv_on = 0;
@@ -330,7 +298,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
                     ticks_cez);
 
        /* Write */
-       if (sync_write) {
+       if (onenand_flags & ONENAND_FLAG_SYNCWRITE) {
                t.adv_wr_off = t.adv_rd_off;
                t.we_on  = 0;
                t.we_off = t.cs_rd_off;
@@ -355,6 +323,14 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
                }
        }
 
+       return t;
+}
+
+static int gpmc_set_sync_mode(int cs, struct gpmc_timings *t)
+{
+       unsigned sync_read = onenand_flags & ONENAND_FLAG_SYNCREAD;
+       unsigned sync_write = onenand_flags & ONENAND_FLAG_SYNCWRITE;
+
        /* Configure GPMC for synchronous read */
        gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1,
                          GPMC_CONFIG1_WRAPBURST_SUPP |
@@ -371,11 +347,45 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
                          GPMC_CONFIG1_DEVICETYPE_NOR |
                          GPMC_CONFIG1_MUXADDDATA);
 
-       err = gpmc_cs_set_timings(cs, &t);
-       if (err)
-               return err;
+       return gpmc_cs_set_timings(cs, t);
+}
+
+static int omap2_onenand_setup_async(void __iomem *onenand_base)
+{
+       struct gpmc_timings t;
+       int ret;
+
+       omap2_onenand_set_async_mode(onenand_base);
 
-       set_onenand_cfg(onenand_base, latency, sync_read, sync_write, hf, vhf);
+       t = omap2_onenand_calc_async_timings();
+
+       ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t);
+       if (IS_ERR_VALUE(ret))
+               return ret;
+
+       omap2_onenand_set_async_mode(onenand_base);
+
+       return 0;
+}
+
+static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr)
+{
+       int ret, freq = *freq_ptr;
+       struct gpmc_timings t;
+
+       if (!freq) {
+               /* Very first call freq is not known */
+               freq = omap2_onenand_get_freq(gpmc_onenand_data, onenand_base);
+               set_onenand_cfg(onenand_base);
+       }
+
+       t = omap2_onenand_calc_sync_timings(gpmc_onenand_data, freq);
+
+       ret = gpmc_set_sync_mode(gpmc_onenand_data->cs, &t);
+       if (IS_ERR_VALUE(ret))
+               return ret;
+
+       set_onenand_cfg(onenand_base);
 
        *freq_ptr = freq;
 
@@ -385,15 +395,22 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
 static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr)
 {
        struct device *dev = &gpmc_onenand_device.dev;
+       unsigned l = ONENAND_SYNC_READ | ONENAND_SYNC_READWRITE;
+       int ret;
 
-       /* Set sync timings in GPMC */
-       if (omap2_onenand_set_sync_mode(gpmc_onenand_data, onenand_base,
-                       freq_ptr) < 0) {
-               dev_err(dev, "Unable to set synchronous mode\n");
-               return -EINVAL;
+       ret = omap2_onenand_setup_async(onenand_base);
+       if (ret) {
+               dev_err(dev, "unable to set to async mode\n");
+               return ret;
        }
 
-       return 0;
+       if (!(gpmc_onenand_data->flags & l))
+               return 0;
+
+       ret = omap2_onenand_setup_sync(onenand_base, freq_ptr);
+       if (ret)
+               dev_err(dev, "unable to set to sync mode\n");
+       return ret;
 }
 
 void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
@@ -411,6 +428,11 @@ void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
                gpmc_onenand_data->flags |= ONENAND_SYNC_READ;
        }
 
+       if (cpu_is_omap34xx())
+               gpmc_onenand_data->flags |= ONENAND_IN_OMAP34XX;
+       else
+               gpmc_onenand_data->flags &= ~ONENAND_IN_OMAP34XX;
+
        err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE,
                                (unsigned long *)&gpmc_onenand_resource.start);
        if (err < 0) {
diff --git a/arch/arm/mach-omap2/gpmc-onenand.h b/arch/arm/mach-omap2/gpmc-onenand.h
new file mode 100644 (file)
index 0000000..216f23a
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ *  arch/arm/mach-omap2/gpmc-onenand.h
+ *
+ *  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        __OMAP2_GPMC_ONENAND_H
+#define        __OMAP2_GPMC_ONENAND_H
+
+#include <linux/platform_data/mtd-onenand-omap2.h>
+
+#if IS_ENABLED(CONFIG_MTD_ONENAND_OMAP2)
+extern void gpmc_onenand_init(struct omap_onenand_platform_data *d);
+#else
+#define board_onenand_data     NULL
+static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d)
+{
+}
+#endif
+
+#endif
index 5654753103744dfa02f8fab8ddfd1ff037806c7a..6eed907d594cc700134ad0e7716df079d1b793c8 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/io.h>
 #include <linux/smc91x.h>
 
-#include <plat/gpmc.h>
+#include "gpmc.h"
 #include "gpmc-smc91x.h"
 
 #include "soc.h"
index 249a0b440cd6f5396a38bea78fbd9fdc28061c77..ef990118d32b2f4205c25c58aec555465096aa39 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/io.h>
 #include <linux/smsc911x.h>
 
-#include <plat/gpmc.h>
+#include "gpmc.h"
 #include "gpmc-smsc911x.h"
 
 static struct resource gpmc_smsc911x_resources[] = {
index 92b5718fa722ce129b240245fa5e60978bc77ffb..bf6117c32f4bc0302522d0ea6f54b83d7c171ea3 100644 (file)
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 
-#include <asm/mach-types.h>
-#include <plat/gpmc.h>
+#include <linux/platform_data/mtd-nand-omap2.h>
 
-#include <plat/cpu.h>
-#include <plat/gpmc.h>
-#include <plat/sdrc.h>
-#include <plat/omap_device.h>
+#include <asm/mach-types.h>
 
 #include "soc.h"
 #include "common.h"
+#include "omap_device.h"
+#include "gpmc.h"
 
 #define        DEVICE_NAME             "omap-gpmc"
 
@@ -59,6 +57,9 @@
 #define GPMC_ECC_SIZE_CONFIG   0x1fc
 #define GPMC_ECC1_RESULT        0x200
 #define GPMC_ECC_BCH_RESULT_0   0x240   /* not available on OMAP2 */
+#define        GPMC_ECC_BCH_RESULT_1   0x244   /* not available on OMAP2 */
+#define        GPMC_ECC_BCH_RESULT_2   0x248   /* not available on OMAP2 */
+#define        GPMC_ECC_BCH_RESULT_3   0x24c   /* not available on OMAP2 */
 
 /* GPMC ECC control settings */
 #define GPMC_ECC_CTRL_ECCCLEAR         0x100
@@ -75,6 +76,7 @@
 
 #define GPMC_CS0_OFFSET                0x60
 #define GPMC_CS_SIZE           0x30
+#define        GPMC_BCH_SIZE           0x10
 
 #define GPMC_MEM_START         0x00000000
 #define GPMC_MEM_END           0x3FFFFFFF
@@ -137,7 +139,6 @@ static struct resource      gpmc_mem_root;
 static struct resource gpmc_cs_mem[GPMC_CS_NUM];
 static DEFINE_SPINLOCK(gpmc_mem_lock);
 static unsigned int gpmc_cs_map;       /* flag for cs which are initialized */
-static int gpmc_ecc_used = -EINVAL;    /* cs using ecc engine */
 static struct device *gpmc_dev;
 static int gpmc_irq;
 static resource_size_t phys_base, mem_size;
@@ -158,22 +159,6 @@ static u32 gpmc_read_reg(int idx)
        return __raw_readl(gpmc_base + idx);
 }
 
-static void gpmc_cs_write_byte(int cs, int idx, u8 val)
-{
-       void __iomem *reg_addr;
-
-       reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
-       __raw_writeb(val, reg_addr);
-}
-
-static u8 gpmc_cs_read_byte(int cs, int idx)
-{
-       void __iomem *reg_addr;
-
-       reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
-       return __raw_readb(reg_addr);
-}
-
 void gpmc_cs_write_reg(int cs, int idx, u32 val)
 {
        void __iomem *reg_addr;
@@ -288,7 +273,7 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
                return -1
 #endif
 
-int gpmc_cs_calc_divider(int cs, unsigned int sync_clk)
+int gpmc_calc_divider(unsigned int sync_clk)
 {
        int div;
        u32 l;
@@ -308,7 +293,7 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
        int div;
        u32 l;
 
-       div = gpmc_cs_calc_divider(cs, t->sync_clk);
+       div = gpmc_calc_divider(t->sync_clk);
        if (div < 0)
                return div;
 
@@ -508,44 +493,6 @@ void gpmc_cs_free(int cs)
 }
 EXPORT_SYMBOL(gpmc_cs_free);
 
-/**
- * gpmc_read_status - read access request to get the different gpmc status
- * @cmd: command type
- * @return status
- */
-int gpmc_read_status(int cmd)
-{
-       int     status = -EINVAL;
-       u32     regval = 0;
-
-       switch (cmd) {
-       case GPMC_GET_IRQ_STATUS:
-               status = gpmc_read_reg(GPMC_IRQSTATUS);
-               break;
-
-       case GPMC_PREFETCH_FIFO_CNT:
-               regval = gpmc_read_reg(GPMC_PREFETCH_STATUS);
-               status = GPMC_PREFETCH_STATUS_FIFO_CNT(regval);
-               break;
-
-       case GPMC_PREFETCH_COUNT:
-               regval = gpmc_read_reg(GPMC_PREFETCH_STATUS);
-               status = GPMC_PREFETCH_STATUS_COUNT(regval);
-               break;
-
-       case GPMC_STATUS_BUFFER:
-               regval = gpmc_read_reg(GPMC_STATUS);
-               /* 1 : buffer is available to write */
-               status = regval & GPMC_STATUS_BUFF_EMPTY;
-               break;
-
-       default:
-               printk(KERN_ERR "gpmc_read_status: Not supported\n");
-       }
-       return status;
-}
-EXPORT_SYMBOL(gpmc_read_status);
-
 /**
  * gpmc_cs_configure - write request to configure gpmc
  * @cs: chip select number
@@ -614,121 +561,10 @@ int gpmc_cs_configure(int cs, int cmd, int wval)
 }
 EXPORT_SYMBOL(gpmc_cs_configure);
 
-/**
- * gpmc_nand_read - nand specific read access request
- * @cs: chip select number
- * @cmd: command type
- */
-int gpmc_nand_read(int cs, int cmd)
-{
-       int rval = -EINVAL;
-
-       switch (cmd) {
-       case GPMC_NAND_DATA:
-               rval = gpmc_cs_read_byte(cs, GPMC_CS_NAND_DATA);
-               break;
-
-       default:
-               printk(KERN_ERR "gpmc_read_nand_ctrl: Not supported\n");
-       }
-       return rval;
-}
-EXPORT_SYMBOL(gpmc_nand_read);
-
-/**
- * gpmc_nand_write - nand specific write request
- * @cs: chip select number
- * @cmd: command type
- * @wval: value to write
- */
-int gpmc_nand_write(int cs, int cmd, int wval)
-{
-       int err = 0;
-
-       switch (cmd) {
-       case GPMC_NAND_COMMAND:
-               gpmc_cs_write_byte(cs, GPMC_CS_NAND_COMMAND, wval);
-               break;
-
-       case GPMC_NAND_ADDRESS:
-               gpmc_cs_write_byte(cs, GPMC_CS_NAND_ADDRESS, wval);
-               break;
-
-       case GPMC_NAND_DATA:
-               gpmc_cs_write_byte(cs, GPMC_CS_NAND_DATA, wval);
-
-       default:
-               printk(KERN_ERR "gpmc_write_nand_ctrl: Not supported\n");
-               err = -EINVAL;
-       }
-       return err;
-}
-EXPORT_SYMBOL(gpmc_nand_write);
-
-
-
-/**
- * gpmc_prefetch_enable - configures and starts prefetch transfer
- * @cs: cs (chip select) number
- * @fifo_th: fifo threshold to be used for read/ write
- * @dma_mode: dma mode enable (1) or disable (0)
- * @u32_count: number of bytes to be transferred
- * @is_write: prefetch read(0) or write post(1) mode
- */
-int gpmc_prefetch_enable(int cs, int fifo_th, int dma_mode,
-                               unsigned int u32_count, int is_write)
-{
-
-       if (fifo_th > PREFETCH_FIFOTHRESHOLD_MAX) {
-               pr_err("gpmc: fifo threshold is not supported\n");
-               return -1;
-       } else if (!(gpmc_read_reg(GPMC_PREFETCH_CONTROL))) {
-               /* Set the amount of bytes to be prefetched */
-               gpmc_write_reg(GPMC_PREFETCH_CONFIG2, u32_count);
-
-               /* Set dma/mpu mode, the prefetch read / post write and
-                * enable the engine. Set which cs is has requested for.
-                */
-               gpmc_write_reg(GPMC_PREFETCH_CONFIG1, ((cs << CS_NUM_SHIFT) |
-                                       PREFETCH_FIFOTHRESHOLD(fifo_th) |
-                                       ENABLE_PREFETCH |
-                                       (dma_mode << DMA_MPU_MODE) |
-                                       (0x1 & is_write)));
-
-               /*  Start the prefetch engine */
-               gpmc_write_reg(GPMC_PREFETCH_CONTROL, 0x1);
-       } else {
-               return -EBUSY;
-       }
-
-       return 0;
-}
-EXPORT_SYMBOL(gpmc_prefetch_enable);
-
-/**
- * gpmc_prefetch_reset - disables and stops the prefetch engine
- */
-int gpmc_prefetch_reset(int cs)
-{
-       u32 config1;
-
-       /* check if the same module/cs is trying to reset */
-       config1 = gpmc_read_reg(GPMC_PREFETCH_CONFIG1);
-       if (((config1 >> CS_NUM_SHIFT) & 0x7) != cs)
-               return -EINVAL;
-
-       /* Stop the PFPW engine */
-       gpmc_write_reg(GPMC_PREFETCH_CONTROL, 0x0);
-
-       /* Reset/disable the PFPW engine */
-       gpmc_write_reg(GPMC_PREFETCH_CONFIG1, 0x0);
-
-       return 0;
-}
-EXPORT_SYMBOL(gpmc_prefetch_reset);
-
 void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
 {
+       int i;
+
        reg->gpmc_status = gpmc_base + GPMC_STATUS;
        reg->gpmc_nand_command = gpmc_base + GPMC_CS0_OFFSET +
                                GPMC_CS_NAND_COMMAND + GPMC_CS_SIZE * cs;
@@ -744,7 +580,17 @@ void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
        reg->gpmc_ecc_control = gpmc_base + GPMC_ECC_CONTROL;
        reg->gpmc_ecc_size_config = gpmc_base + GPMC_ECC_SIZE_CONFIG;
        reg->gpmc_ecc1_result = gpmc_base + GPMC_ECC1_RESULT;
-       reg->gpmc_bch_result0 = gpmc_base + GPMC_ECC_BCH_RESULT_0;
+
+       for (i = 0; i < GPMC_BCH_NUM_REMAINDER; i++) {
+               reg->gpmc_bch_result0[i] = gpmc_base + GPMC_ECC_BCH_RESULT_0 +
+                                          GPMC_BCH_SIZE * i;
+               reg->gpmc_bch_result1[i] = gpmc_base + GPMC_ECC_BCH_RESULT_1 +
+                                          GPMC_BCH_SIZE * i;
+               reg->gpmc_bch_result2[i] = gpmc_base + GPMC_ECC_BCH_RESULT_2 +
+                                          GPMC_BCH_SIZE * i;
+               reg->gpmc_bch_result3[i] = gpmc_base + GPMC_ECC_BCH_RESULT_3 +
+                                          GPMC_BCH_SIZE * i;
+       }
 }
 
 int gpmc_get_client_irq(unsigned irq_config)
@@ -1093,267 +939,3 @@ void omap3_gpmc_restore_context(void)
        }
 }
 #endif /* CONFIG_ARCH_OMAP3 */
-
-/**
- * gpmc_enable_hwecc - enable hardware ecc functionality
- * @cs: chip select number
- * @mode: read/write mode
- * @dev_width: device bus width(1 for x16, 0 for x8)
- * @ecc_size: bytes for which ECC will be generated
- */
-int gpmc_enable_hwecc(int cs, int mode, int dev_width, int ecc_size)
-{
-       unsigned int val;
-
-       /* check if ecc module is in used */
-       if (gpmc_ecc_used != -EINVAL)
-               return -EINVAL;
-
-       gpmc_ecc_used = cs;
-
-       /* clear ecc and enable bits */
-       gpmc_write_reg(GPMC_ECC_CONTROL,
-                       GPMC_ECC_CTRL_ECCCLEAR |
-                       GPMC_ECC_CTRL_ECCREG1);
-
-       /* program ecc and result sizes */
-       val = ((((ecc_size >> 1) - 1) << 22) | (0x0000000F));
-       gpmc_write_reg(GPMC_ECC_SIZE_CONFIG, val);
-
-       switch (mode) {
-       case GPMC_ECC_READ:
-       case GPMC_ECC_WRITE:
-               gpmc_write_reg(GPMC_ECC_CONTROL,
-                               GPMC_ECC_CTRL_ECCCLEAR |
-                               GPMC_ECC_CTRL_ECCREG1);
-               break;
-       case GPMC_ECC_READSYN:
-               gpmc_write_reg(GPMC_ECC_CONTROL,
-                               GPMC_ECC_CTRL_ECCCLEAR |
-                               GPMC_ECC_CTRL_ECCDISABLE);
-               break;
-       default:
-               printk(KERN_INFO "Error: Unrecognized Mode[%d]!\n", mode);
-               break;
-       }
-
-       /* (ECC 16 or 8 bit col) | ( CS  )  | ECC Enable */
-       val = (dev_width << 7) | (cs << 1) | (0x1);
-       gpmc_write_reg(GPMC_ECC_CONFIG, val);
-       return 0;
-}
-EXPORT_SYMBOL_GPL(gpmc_enable_hwecc);
-
-/**
- * gpmc_calculate_ecc - generate non-inverted ecc bytes
- * @cs: chip select number
- * @dat: data pointer over which ecc is computed
- * @ecc_code: ecc code buffer
- *
- * Using non-inverted ECC is considered ugly since writing a blank
- * page (padding) will clear the ECC bytes. This is not a problem as long
- * no one is trying to write data on the seemingly unused page. Reading
- * an erased page will produce an ECC mismatch between generated and read
- * ECC bytes that has to be dealt with separately.
- */
-int gpmc_calculate_ecc(int cs, const u_char *dat, u_char *ecc_code)
-{
-       unsigned int val = 0x0;
-
-       if (gpmc_ecc_used != cs)
-               return -EINVAL;
-
-       /* read ecc result */
-       val = gpmc_read_reg(GPMC_ECC1_RESULT);
-       *ecc_code++ = val;          /* P128e, ..., P1e */
-       *ecc_code++ = val >> 16;    /* P128o, ..., P1o */
-       /* P2048o, P1024o, P512o, P256o, P2048e, P1024e, P512e, P256e */
-       *ecc_code++ = ((val >> 8) & 0x0f) | ((val >> 20) & 0xf0);
-
-       gpmc_ecc_used = -EINVAL;
-       return 0;
-}
-EXPORT_SYMBOL_GPL(gpmc_calculate_ecc);
-
-#ifdef CONFIG_ARCH_OMAP3
-
-/**
- * gpmc_init_hwecc_bch - initialize hardware BCH ecc functionality
- * @cs: chip select number
- * @nsectors: how many 512-byte sectors to process
- * @nerrors: how many errors to correct per sector (4 or 8)
- *
- * This function must be executed before any call to gpmc_enable_hwecc_bch.
- */
-int gpmc_init_hwecc_bch(int cs, int nsectors, int nerrors)
-{
-       /* check if ecc module is in use */
-       if (gpmc_ecc_used != -EINVAL)
-               return -EINVAL;
-
-       /* support only OMAP3 class */
-       if (!cpu_is_omap34xx()) {
-               printk(KERN_ERR "BCH ecc is not supported on this CPU\n");
-               return -EINVAL;
-       }
-
-       /*
-        * For now, assume 4-bit mode is only supported on OMAP3630 ES1.x, x>=1.
-        * Other chips may be added if confirmed to work.
-        */
-       if ((nerrors == 4) &&
-           (!cpu_is_omap3630() || (GET_OMAP_REVISION() == 0))) {
-               printk(KERN_ERR "BCH 4-bit mode is not supported on this CPU\n");
-               return -EINVAL;
-       }
-
-       /* sanity check */
-       if (nsectors > 8) {
-               printk(KERN_ERR "BCH cannot process %d sectors (max is 8)\n",
-                      nsectors);
-               return -EINVAL;
-       }
-
-       return 0;
-}
-EXPORT_SYMBOL_GPL(gpmc_init_hwecc_bch);
-
-/**
- * gpmc_enable_hwecc_bch - enable hardware BCH ecc functionality
- * @cs: chip select number
- * @mode: read/write mode
- * @dev_width: device bus width(1 for x16, 0 for x8)
- * @nsectors: how many 512-byte sectors to process
- * @nerrors: how many errors to correct per sector (4 or 8)
- */
-int gpmc_enable_hwecc_bch(int cs, int mode, int dev_width, int nsectors,
-                         int nerrors)
-{
-       unsigned int val;
-
-       /* check if ecc module is in use */
-       if (gpmc_ecc_used != -EINVAL)
-               return -EINVAL;
-
-       gpmc_ecc_used = cs;
-
-       /* clear ecc and enable bits */
-       gpmc_write_reg(GPMC_ECC_CONTROL, 0x1);
-
-       /*
-        * When using BCH, sector size is hardcoded to 512 bytes.
-        * Here we are using wrapping mode 6 both for reading and writing, with:
-        *  size0 = 0  (no additional protected byte in spare area)
-        *  size1 = 32 (skip 32 nibbles = 16 bytes per sector in spare area)
-        */
-       gpmc_write_reg(GPMC_ECC_SIZE_CONFIG, (32 << 22) | (0 << 12));
-
-       /* BCH configuration */
-       val = ((1                        << 16) | /* enable BCH */
-              (((nerrors == 8) ? 1 : 0) << 12) | /* 8 or 4 bits */
-              (0x06                     <<  8) | /* wrap mode = 6 */
-              (dev_width                <<  7) | /* bus width */
-              (((nsectors-1) & 0x7)     <<  4) | /* number of sectors */
-              (cs                       <<  1) | /* ECC CS */
-              (0x1));                            /* enable ECC */
-
-       gpmc_write_reg(GPMC_ECC_CONFIG, val);
-       gpmc_write_reg(GPMC_ECC_CONTROL, 0x101);
-       return 0;
-}
-EXPORT_SYMBOL_GPL(gpmc_enable_hwecc_bch);
-
-/**
- * gpmc_calculate_ecc_bch4 - Generate 7 ecc bytes per sector of 512 data bytes
- * @cs:  chip select number
- * @dat: The pointer to data on which ecc is computed
- * @ecc: The ecc output buffer
- */
-int gpmc_calculate_ecc_bch4(int cs, const u_char *dat, u_char *ecc)
-{
-       int i;
-       unsigned long nsectors, reg, val1, val2;
-
-       if (gpmc_ecc_used != cs)
-               return -EINVAL;
-
-       nsectors = ((gpmc_read_reg(GPMC_ECC_CONFIG) >> 4) & 0x7) + 1;
-
-       for (i = 0; i < nsectors; i++) {
-
-               reg = GPMC_ECC_BCH_RESULT_0 + 16*i;
-
-               /* Read hw-computed remainder */
-               val1 = gpmc_read_reg(reg + 0);
-               val2 = gpmc_read_reg(reg + 4);
-
-               /*
-                * Add constant polynomial to remainder, in order to get an ecc
-                * sequence of 0xFFs for a buffer filled with 0xFFs; and
-                * left-justify the resulting polynomial.
-                */
-               *ecc++ = 0x28 ^ ((val2 >> 12) & 0xFF);
-               *ecc++ = 0x13 ^ ((val2 >>  4) & 0xFF);
-               *ecc++ = 0xcc ^ (((val2 & 0xF) << 4)|((val1 >> 28) & 0xF));
-               *ecc++ = 0x39 ^ ((val1 >> 20) & 0xFF);
-               *ecc++ = 0x96 ^ ((val1 >> 12) & 0xFF);
-               *ecc++ = 0xac ^ ((val1 >> 4) & 0xFF);
-               *ecc++ = 0x7f ^ ((val1 & 0xF) << 4);
-       }
-
-       gpmc_ecc_used = -EINVAL;
-       return 0;
-}
-EXPORT_SYMBOL_GPL(gpmc_calculate_ecc_bch4);
-
-/**
- * gpmc_calculate_ecc_bch8 - Generate 13 ecc bytes per block of 512 data bytes
- * @cs:  chip select number
- * @dat: The pointer to data on which ecc is computed
- * @ecc: The ecc output buffer
- */
-int gpmc_calculate_ecc_bch8(int cs, const u_char *dat, u_char *ecc)
-{
-       int i;
-       unsigned long nsectors, reg, val1, val2, val3, val4;
-
-       if (gpmc_ecc_used != cs)
-               return -EINVAL;
-
-       nsectors = ((gpmc_read_reg(GPMC_ECC_CONFIG) >> 4) & 0x7) + 1;
-
-       for (i = 0; i < nsectors; i++) {
-
-               reg = GPMC_ECC_BCH_RESULT_0 + 16*i;
-
-               /* Read hw-computed remainder */
-               val1 = gpmc_read_reg(reg + 0);
-               val2 = gpmc_read_reg(reg + 4);
-               val3 = gpmc_read_reg(reg + 8);
-               val4 = gpmc_read_reg(reg + 12);
-
-               /*
-                * Add constant polynomial to remainder, in order to get an ecc
-                * sequence of 0xFFs for a buffer filled with 0xFFs.
-                */
-               *ecc++ = 0xef ^ (val4 & 0xFF);
-               *ecc++ = 0x51 ^ ((val3 >> 24) & 0xFF);
-               *ecc++ = 0x2e ^ ((val3 >> 16) & 0xFF);
-               *ecc++ = 0x09 ^ ((val3 >> 8) & 0xFF);
-               *ecc++ = 0xed ^ (val3 & 0xFF);
-               *ecc++ = 0x93 ^ ((val2 >> 24) & 0xFF);
-               *ecc++ = 0x9a ^ ((val2 >> 16) & 0xFF);
-               *ecc++ = 0xc2 ^ ((val2 >> 8) & 0xFF);
-               *ecc++ = 0x97 ^ (val2 & 0xFF);
-               *ecc++ = 0x79 ^ ((val1 >> 24) & 0xFF);
-               *ecc++ = 0xe5 ^ ((val1 >> 16) & 0xFF);
-               *ecc++ = 0x24 ^ ((val1 >> 8) & 0xFF);
-               *ecc++ = 0xb5 ^ (val1 & 0xFF);
-       }
-
-       gpmc_ecc_used = -EINVAL;
-       return 0;
-}
-EXPORT_SYMBOL_GPL(gpmc_calculate_ecc_bch8);
-
-#endif /* CONFIG_ARCH_OMAP3 */
similarity index 67%
rename from arch/arm/plat-omap/include/plat/gpmc.h
rename to arch/arm/mach-omap2/gpmc.h
index 2e6e2597178c56cf59fd2d710e952db65252ff3a..79f4dfc2adb3cec5d6f40af94796bc8558492a99 100644 (file)
@@ -11,6 +11,8 @@
 #ifndef __OMAP2_GPMC_H
 #define __OMAP2_GPMC_H
 
+#include <linux/platform_data/mtd-nand-omap2.h>
+
 /* Maximum Number of Chip Selects */
 #define GPMC_CS_NUM            8
 
 #define GPMC_SET_IRQ_STATUS    0x00000004
 #define GPMC_CONFIG_WP         0x00000005
 
-#define GPMC_GET_IRQ_STATUS    0x00000006
-#define GPMC_PREFETCH_FIFO_CNT 0x00000007 /* bytes available in FIFO for r/w */
-#define GPMC_PREFETCH_COUNT    0x00000008 /* remaining bytes to be read/write*/
-#define GPMC_STATUS_BUFFER     0x00000009 /* 1: buffer is available to write */
-
-#define GPMC_NAND_COMMAND      0x0000000a
-#define GPMC_NAND_ADDRESS      0x0000000b
-#define GPMC_NAND_DATA         0x0000000c
-
 #define GPMC_ENABLE_IRQ                0x0000000d
 
 /* ECC commands */
 #define GPMC_DEVICETYPE_NOR            0
 #define GPMC_DEVICETYPE_NAND           2
 #define GPMC_CONFIG_WRITEPROTECT       0x00000010
-#define GPMC_STATUS_BUFF_EMPTY         0x00000001
 #define WR_RD_PIN_MONITORING           0x00600000
-#define GPMC_PREFETCH_STATUS_FIFO_CNT(val)     ((val >> 24) & 0x7F)
-#define GPMC_PREFETCH_STATUS_COUNT(val)        (val & 0x00003fff)
 #define GPMC_IRQ_FIFOEVENTENABLE       0x01
 #define GPMC_IRQ_COUNT_EVENT           0x02
 
-#define PREFETCH_FIFOTHRESHOLD_MAX     0x40
-#define PREFETCH_FIFOTHRESHOLD(val)    ((val) << 8)
-
-enum omap_ecc {
-               /* 1-bit ecc: stored at end of spare area */
-       OMAP_ECC_HAMMING_CODE_DEFAULT = 0, /* Default, s/w method */
-       OMAP_ECC_HAMMING_CODE_HW, /* gpmc to detect the error */
-               /* 1-bit ecc: stored at beginning of spare area as romcode */
-       OMAP_ECC_HAMMING_CODE_HW_ROMCODE, /* gpmc method & romcode layout */
-       OMAP_ECC_BCH4_CODE_HW, /* 4-bit BCH ecc code */
-       OMAP_ECC_BCH8_CODE_HW, /* 8-bit BCH ecc code */
-};
 
 /*
  * Note that all values in this struct are in nanoseconds except sync_clk
@@ -133,22 +111,6 @@ struct gpmc_timings {
        u16 wr_data_mux_bus;    /* WRDATAONADMUXBUS */
 };
 
-struct gpmc_nand_regs {
-       void __iomem    *gpmc_status;
-       void __iomem    *gpmc_nand_command;
-       void __iomem    *gpmc_nand_address;
-       void __iomem    *gpmc_nand_data;
-       void __iomem    *gpmc_prefetch_config1;
-       void __iomem    *gpmc_prefetch_config2;
-       void __iomem    *gpmc_prefetch_control;
-       void __iomem    *gpmc_prefetch_status;
-       void __iomem    *gpmc_ecc_config;
-       void __iomem    *gpmc_ecc_control;
-       void __iomem    *gpmc_ecc_size_config;
-       void __iomem    *gpmc_ecc1_result;
-       void __iomem    *gpmc_bch_result0;
-};
-
 extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs);
 extern int gpmc_get_client_irq(unsigned irq_config);
 
@@ -160,31 +122,14 @@ extern unsigned long gpmc_get_fclk_period(void);
 
 extern void gpmc_cs_write_reg(int cs, int idx, u32 val);
 extern u32 gpmc_cs_read_reg(int cs, int idx);
-extern int gpmc_cs_calc_divider(int cs, unsigned int sync_clk);
+extern int gpmc_calc_divider(unsigned int sync_clk);
 extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t);
 extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
 extern void gpmc_cs_free(int cs);
 extern int gpmc_cs_set_reserved(int cs, int reserved);
 extern int gpmc_cs_reserved(int cs);
-extern int gpmc_prefetch_enable(int cs, int fifo_th, int dma_mode,
-                                       unsigned int u32_count, int is_write);
-extern int gpmc_prefetch_reset(int cs);
 extern void omap3_gpmc_save_context(void);
 extern void omap3_gpmc_restore_context(void);
-extern int gpmc_read_status(int cmd);
 extern int gpmc_cs_configure(int cs, int cmd, int wval);
-extern int gpmc_nand_read(int cs, int cmd);
-extern int gpmc_nand_write(int cs, int cmd, int wval);
-
-int gpmc_enable_hwecc(int cs, int mode, int dev_width, int ecc_size);
-int gpmc_calculate_ecc(int cs, const u_char *dat, u_char *ecc_code);
-
-#ifdef CONFIG_ARCH_OMAP3
-int gpmc_init_hwecc_bch(int cs, int nsectors, int nerrors);
-int gpmc_enable_hwecc_bch(int cs, int mode, int dev_width, int nsectors,
-                         int nerrors);
-int gpmc_calculate_ecc_bch4(int cs, const u_char *dat, u_char *ecc);
-int gpmc_calculate_ecc_bch8(int cs, const u_char *dat, u_char *ecc);
-#endif /* CONFIG_ARCH_OMAP3 */
 
 #endif
index e003f2bba30c4c6e5d8e200ab7e186712f3fd307..ab7bf181a1052feb452f26efe34ca2089a291398 100644 (file)
 #include <linux/err.h>
 #include <linux/platform_device.h>
 
-#include <plat/omap_hwmod.h>
-#include <plat/omap_device.h>
+#include "omap_hwmod.h"
+#include "omap_device.h"
 #include "hdq1w.h"
 
+#include "prm.h"
 #include "common.h"
 
-/* Maximum microseconds to wait for OMAP module to softreset */
-#define MAX_MODULE_SOFTRESET_WAIT      10000
-
 /**
  * omap_hdq1w_reset - reset the OMAP HDQ1W module
  * @oh: struct omap_hwmod *
index 0c1efc846d8dddb5b23237a95993288aa6747166..c7e08d2a7a460c94bbd65d533e8922b0cec4e233 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef ARCH_ARM_MACH_OMAP2_HDQ1W_H
 #define ARCH_ARM_MACH_OMAP2_HDQ1W_H
 
-#include <plat/omap_hwmod.h>
+#include "omap_hwmod.h"
 
 /*
  * XXX A future cleanup patch should modify
index 4d3a6324155f95de768fd1416f81ad068e80c3bd..4a964338992a6a9c18ab3c1a96f9e153408d2be1 100644 (file)
 #include <linux/string.h>
 #include <linux/delay.h>
 #include <linux/gpio.h>
-#include <mach/hardware.h>
 #include <linux/platform_data/gpio-omap.h>
 
-#include <plat/mmc.h>
-#include <plat/omap-pm.h>
-#include <plat/omap_device.h>
+#include "soc.h"
+#include "omap_device.h"
+#include "omap-pm.h"
 
 #include "mux.h"
+#include "mmc.h"
 #include "hsmmc.h"
 #include "control.h"
 
index 8763c8520dc2135030dc3a51cce0e5567fe4ca27..1df9b5feda16a5db49d09ca77e4ae8f374f1ee95 100644 (file)
@@ -21,8 +21,8 @@
 #include <linux/err.h>
 #include <linux/hwspinlock.h>
 
-#include <plat/omap_hwmod.h>
-#include <plat/omap_device.h>
+#include "omap_hwmod.h"
+#include "omap_device.h"
 
 static struct hwspinlock_pdata omap_hwspinlock_pdata __initdata = {
        .base_id = 0,
index fc57e67b321f3900b38f95df939f796eac8ef33b..fbb9b152cd5e7d555e12c71de3c31c469f0617b2 100644 (file)
  *
  */
 
-#include <plat/i2c.h>
-#include "common.h"
-#include <plat/omap_hwmod.h>
+#include "soc.h"
+#include "omap_hwmod.h"
+#include "omap_device.h"
 
+#include "prm.h"
+#include "common.h"
 #include "mux.h"
+#include "i2c.h"
 
 /* In register I2C_CON, Bit 15 is the I2C enable bit */
 #define I2C_EN                                 BIT(15)
 #define OMAP2_I2C_CON_OFFSET                   0x24
 #define OMAP4_I2C_CON_OFFSET                   0xA4
 
-/* Maximum microseconds to wait for OMAP module to softreset */
-#define MAX_MODULE_SOFTRESET_WAIT      10000
+#define MAX_OMAP_I2C_HWMOD_NAME_LEN    16
 
-void __init omap2_i2c_mux_pins(int bus_id)
+static void __init omap2_i2c_mux_pins(int bus_id)
 {
        char mux_name[sizeof("i2c2_scl.i2c2_scl")];
 
@@ -104,3 +106,62 @@ int omap_i2c_reset(struct omap_hwmod *oh)
 
        return 0;
 }
+
+static int __init omap_i2c_nr_ports(void)
+{
+       int ports = 0;
+
+       if (cpu_is_omap24xx())
+               ports = 2;
+       else if (cpu_is_omap34xx())
+               ports = 3;
+       else if (cpu_is_omap44xx())
+               ports = 4;
+       return ports;
+}
+
+static const char name[] = "omap_i2c";
+
+int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *i2c_pdata,
+                               int bus_id)
+{
+       int l;
+       struct omap_hwmod *oh;
+       struct platform_device *pdev;
+       char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN];
+       struct omap_i2c_bus_platform_data *pdata;
+       struct omap_i2c_dev_attr *dev_attr;
+
+       if (bus_id > omap_i2c_nr_ports())
+               return -EINVAL;
+
+       omap2_i2c_mux_pins(bus_id);
+
+       l = snprintf(oh_name, MAX_OMAP_I2C_HWMOD_NAME_LEN, "i2c%d", bus_id);
+       WARN(l >= MAX_OMAP_I2C_HWMOD_NAME_LEN,
+               "String buffer overflow in I2C%d device setup\n", bus_id);
+       oh = omap_hwmod_lookup(oh_name);
+       if (!oh) {
+                       pr_err("Could not look up %s\n", oh_name);
+                       return -EEXIST;
+       }
+
+       pdata = i2c_pdata;
+       /*
+        * pass the hwmod class's CPU-specific knowledge of I2C IP revision in
+        * use, and functionality implementation flags, up to the OMAP I2C
+        * driver via platform data
+        */
+       pdata->rev = oh->class->rev;
+
+       dev_attr = (struct omap_i2c_dev_attr *)oh->dev_attr;
+       pdata->flags = dev_attr->flags;
+
+       pdev = omap_device_build(name, bus_id, oh, pdata,
+                       sizeof(struct omap_i2c_bus_platform_data),
+                       NULL, 0, 0);
+       WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
+
+       return PTR_RET(pdev);
+}
+
diff --git a/arch/arm/mach-omap2/i2c.h b/arch/arm/mach-omap2/i2c.h
new file mode 100644 (file)
index 0000000..42b6f2e
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Helper module for board specific I2C bus registration
+ *
+ * Copyright (C) 2009 Nokia Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <plat/i2c.h>
+
+#ifndef __MACH_OMAP2_I2C_H
+#define __MACH_OMAP2_I2C_H
+
+/**
+ * i2c_dev_attr - OMAP I2C controller device attributes for omap_hwmod
+ * @fifo_depth: total controller FIFO size (in bytes)
+ * @flags: differences in hardware support capability
+ *
+ * @fifo_depth represents what exists on the hardware, not what is
+ * actually configured at runtime by the device driver.
+ */
+struct omap_i2c_dev_attr {
+       u8      fifo_depth;
+       u32     flags;
+};
+
+int omap_i2c_reset(struct omap_hwmod *oh);
+
+#endif /* __MACH_OMAP2_I2C_H */
index cf2362ccb234cfe7f980fccfb34c3f7bc8bacf50..f1e1215027894dd76a1056b10a9b7ff8d7995362 100644 (file)
@@ -559,11 +559,12 @@ void __init omap5xxx_check_revision(void)
  * detect the exact revision later on in omap2_detect_revision() once map_io
  * is done.
  */
-void __init omap2_set_globals_tap(struct omap_globals *omap2_globals)
+void __init omap2_set_globals_tap(u32 class, void __iomem *tap)
 {
-       omap_revision = omap2_globals->class;
-       tap_base = omap2_globals->tap;
+       omap_revision = class;
+       tap_base = tap;
 
+       /* XXX What is this intended to do? */
        if (cpu_is_omap34xx())
                tap_prod_id = 0x0210;
        else
index 93d10de7129fc550bea299921a3a0f3a62239630..cfaed13d0040f10ac4d94bfc71ef4029308226c6 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <linux/serial_reg.h>
 
-#include <plat/serial.h>
+#include <mach/serial.h>
 
 #define UART_OFFSET(addr)      ((addr) & 0x00ffffff)
 
diff --git a/arch/arm/mach-omap2/include/mach/gpio.h b/arch/arm/mach-omap2/include/mach/gpio.h
deleted file mode 100644 (file)
index 5621cc5..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/*
- * arch/arm/mach-omap2/include/mach/gpio.h
- */
similarity index 81%
rename from arch/arm/plat-omap/include/plat/serial.h
rename to arch/arm/mach-omap2/include/mach/serial.h
index 65fce44dce342b3650637b53beaeb0e8f1d2c3d8..70eda00db7a4a169b270cc9168bcfd8bb9a6e914 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/arm/plat-omap/include/mach/serial.h
- *
  * Copyright (C) 2009 Texas Instruments
  * Added OMAP4 support- Santosh Shilimkar <santosh.shilimkar@ti.com>
  *
@@ -10,11 +8,6 @@
  * GNU General Public License for more details.
  */
 
-#ifndef __ASM_ARCH_SERIAL_H
-#define __ASM_ARCH_SERIAL_H
-
-#include <linux/init.h>
-
 /*
  * Memory entry used for the DEBUG_LL UART configuration, relative to
  * start of RAM. See also uncompress.h and debug-macro.S.
  */
 #define OMAP_UART_INFO_OFS     0x3ffc
 
-/* OMAP1 serial ports */
-#define OMAP1_UART1_BASE       0xfffb0000
-#define OMAP1_UART2_BASE       0xfffb0800
-#define OMAP1_UART3_BASE       0xfffb9800
-
 /* OMAP2 serial ports */
 #define OMAP2_UART1_BASE       0x4806a000
 #define OMAP2_UART2_BASE       0x4806c000
 #define ZOOM_UART_VIRT         0xfa400000
 
 #define OMAP_PORT_SHIFT                2
-#define OMAP7XX_PORT_SHIFT     0
 #define ZOOM_PORT_SHIFT                1
 
-#define OMAP1510_BASE_BAUD     (12000000/16)
-#define OMAP16XX_BASE_BAUD     (48000000/16)
 #define OMAP24XX_BASE_BAUD     (48000000/16)
 
 /*
  * DEBUG_LL port encoding stored into the UART1 scratchpad register by
  * decomp_setup in uncompress.h
  */
-#define OMAP1UART1             11
-#define OMAP1UART2             12
-#define OMAP1UART3             13
 #define OMAP2UART1             21
 #define OMAP2UART2             22
 #define OMAP2UART3             23
 #define OMAP5UART4             OMAP4UART4
 #define ZOOM_UART              95              /* Only on zoom2/3 */
 
-/* This is only used by 8250.c for omap1510 */
-#define is_omap_port(pt)       ({int __ret = 0;                        \
-                       if ((pt)->port.mapbase == OMAP1_UART1_BASE ||   \
-                           (pt)->port.mapbase == OMAP1_UART2_BASE ||   \
-                           (pt)->port.mapbase == OMAP1_UART3_BASE)     \
-                               __ret = 1;                              \
-                       __ret;                                          \
-                       })
-
 #ifndef __ASSEMBLER__
 
 struct omap_board_data;
@@ -128,5 +101,3 @@ extern void omap_serial_board_init(struct omap_uart_port_info *platform_data);
 extern void omap_serial_init_port(struct omap_board_data *bdata,
                struct omap_uart_port_info *platform_data);
 #endif
-
-#endif
index 78e0557bfd4ed9fdef7a4828b5a9da8bd3574562..8e3546d3e0417e36c644117447c2767286f0fc06 100644 (file)
@@ -1,5 +1,176 @@
 /*
- * arch/arm/mach-omap2/include/mach/uncompress.h
+ * arch/arm/plat-omap/include/mach/uncompress.h
+ *
+ * Serial port stubs for kernel decompress status messages
+ *
+ * Initially based on:
+ * linux-2.4.15-rmk1-dsplinux1.6/arch/arm/plat-omap/include/mach1510/uncompress.h
+ * Copyright (C) 2000 RidgeRun, Inc.
+ * Author: Greg Lonnon <glonnon@ridgerun.com>
+ *
+ * Rewritten by:
+ * Author: <source@mvista.com>
+ * 2004 (c) MontaVista Software, Inc.
+ *
+ * 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 <plat/uncompress.h>
+#include <linux/types.h>
+#include <linux/serial_reg.h>
+
+#include <asm/memory.h>
+#include <asm/mach-types.h>
+
+#include <mach/serial.h>
+
+#define MDR1_MODE_MASK                 0x07
+
+volatile u8 *uart_base;
+int uart_shift;
+
+/*
+ * Store the DEBUG_LL uart number into memory.
+ * See also debug-macro.S, and serial.c for related code.
+ */
+static void set_omap_uart_info(unsigned char port)
+{
+       /*
+        * Get address of some.bss variable and round it down
+        * a la CONFIG_AUTO_ZRELADDR.
+        */
+       u32 ram_start = (u32)&uart_shift & 0xf8000000;
+       u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS);
+       *uart_info = port;
+}
+
+static void putc(int c)
+{
+       if (!uart_base)
+               return;
+
+       /* Check for UART 16x mode */
+       if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0)
+               return;
+
+       while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
+               barrier();
+       uart_base[UART_TX << uart_shift] = c;
+}
+
+static inline void flush(void)
+{
+}
+
+/*
+ * Macros to configure UART1 and debug UART
+ */
+#define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id)              \
+       if (machine_is_##mach()) {                                      \
+               uart_base = (volatile u8 *)(dbg_uart);                  \
+               uart_shift = (dbg_shft);                                \
+               port = (dbg_id);                                        \
+               set_omap_uart_info(port);                               \
+               break;                                                  \
+       }
+
+#define DEBUG_LL_OMAP2(p, mach)                                                \
+       _DEBUG_LL_ENTRY(mach, OMAP2_UART##p##_BASE, OMAP_PORT_SHIFT,    \
+               OMAP2UART##p)
+
+#define DEBUG_LL_OMAP3(p, mach)                                                \
+       _DEBUG_LL_ENTRY(mach, OMAP3_UART##p##_BASE, OMAP_PORT_SHIFT,    \
+               OMAP3UART##p)
+
+#define DEBUG_LL_OMAP4(p, mach)                                                \
+       _DEBUG_LL_ENTRY(mach, OMAP4_UART##p##_BASE, OMAP_PORT_SHIFT,    \
+               OMAP4UART##p)
+
+#define DEBUG_LL_OMAP5(p, mach)                                                \
+       _DEBUG_LL_ENTRY(mach, OMAP5_UART##p##_BASE, OMAP_PORT_SHIFT,    \
+               OMAP5UART##p)
+/* Zoom2/3 shift is different for UART1 and external port */
+#define DEBUG_LL_ZOOM(mach)                                            \
+       _DEBUG_LL_ENTRY(mach, ZOOM_UART_BASE, ZOOM_PORT_SHIFT, ZOOM_UART)
+
+#define DEBUG_LL_TI81XX(p, mach)                                       \
+       _DEBUG_LL_ENTRY(mach, TI81XX_UART##p##_BASE, OMAP_PORT_SHIFT,   \
+               TI81XXUART##p)
+
+#define DEBUG_LL_AM33XX(p, mach)                                       \
+       _DEBUG_LL_ENTRY(mach, AM33XX_UART##p##_BASE, OMAP_PORT_SHIFT,   \
+               AM33XXUART##p)
+
+static inline void arch_decomp_setup(void)
+{
+       int port = 0;
+
+       /*
+        * Initialize the port based on the machine ID from the bootloader.
+        * Note that we're using macros here instead of switch statement
+        * as machine_is functions are optimized out for the boards that
+        * are not selected.
+        */
+       do {
+               /* omap2 based boards using UART1 */
+               DEBUG_LL_OMAP2(1, omap_2430sdp);
+               DEBUG_LL_OMAP2(1, omap_apollon);
+               DEBUG_LL_OMAP2(1, omap_h4);
+
+               /* omap2 based boards using UART3 */
+               DEBUG_LL_OMAP2(3, nokia_n800);
+               DEBUG_LL_OMAP2(3, nokia_n810);
+               DEBUG_LL_OMAP2(3, nokia_n810_wimax);
+
+               /* omap3 based boards using UART1 */
+               DEBUG_LL_OMAP2(1, omap3evm);
+               DEBUG_LL_OMAP3(1, omap_3430sdp);
+               DEBUG_LL_OMAP3(1, omap_3630sdp);
+               DEBUG_LL_OMAP3(1, omap3530_lv_som);
+               DEBUG_LL_OMAP3(1, omap3_torpedo);
+
+               /* omap3 based boards using UART3 */
+               DEBUG_LL_OMAP3(3, cm_t35);
+               DEBUG_LL_OMAP3(3, cm_t3517);
+               DEBUG_LL_OMAP3(3, cm_t3730);
+               DEBUG_LL_OMAP3(3, craneboard);
+               DEBUG_LL_OMAP3(3, devkit8000);
+               DEBUG_LL_OMAP3(3, igep0020);
+               DEBUG_LL_OMAP3(3, igep0030);
+               DEBUG_LL_OMAP3(3, nokia_rm680);
+               DEBUG_LL_OMAP3(3, nokia_rm696);
+               DEBUG_LL_OMAP3(3, nokia_rx51);
+               DEBUG_LL_OMAP3(3, omap3517evm);
+               DEBUG_LL_OMAP3(3, omap3_beagle);
+               DEBUG_LL_OMAP3(3, omap3_pandora);
+               DEBUG_LL_OMAP3(3, omap_ldp);
+               DEBUG_LL_OMAP3(3, overo);
+               DEBUG_LL_OMAP3(3, touchbook);
+
+               /* omap4 based boards using UART3 */
+               DEBUG_LL_OMAP4(3, omap_4430sdp);
+               DEBUG_LL_OMAP4(3, omap4_panda);
+
+               /* omap5 based boards using UART3 */
+               DEBUG_LL_OMAP5(3, omap5_sevm);
+
+               /* zoom2/3 external uart */
+               DEBUG_LL_ZOOM(omap_zoom2);
+               DEBUG_LL_ZOOM(omap_zoom3);
+
+               /* TI8168 base boards using UART3 */
+               DEBUG_LL_TI81XX(3, ti8168evm);
+
+               /* TI8148 base boards using UART1 */
+               DEBUG_LL_TI81XX(1, ti8148evm);
+
+               /* AM33XX base boards using UART1 */
+               DEBUG_LL_AM33XX(1, am335xevm);
+       } while (0);
+}
+
+/*
+ * nothing to do
+ */
+#define arch_decomp_wdog()
index 4234d28dc17177ffbf31d598328a4e8a75c18451..9df757644ccefe6f73ebf547dfa0f5782af26790 100644 (file)
 #include <asm/tlb.h>
 #include <asm/mach/map.h>
 
-#include <plat/sram.h>
-#include <plat/sdrc.h>
-#include <plat/serial.h>
-#include <plat/omap-pm.h>
-#include <plat/omap_hwmod.h>
-#include <plat/multi.h>
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 
+#include "omap_hwmod.h"
 #include "soc.h"
 #include "iomap.h"
 #include "voltage.h"
 #include "clock2xxx.h"
 #include "clock3xxx.h"
 #include "clock44xx.h"
+#include "omap-pm.h"
+#include "sdrc.h"
+#include "control.h"
+#include "serial.h"
+#include "sram.h"
+#include "cm2xxx.h"
+#include "cm3xxx.h"
+#include "prm.h"
+#include "cm.h"
+#include "prcm_mpu44xx.h"
+#include "prminst44xx.h"
+#include "cminst44xx.h"
 
 /*
  * The machine specific code may provide the extra mapping besides the
@@ -265,7 +272,7 @@ static struct map_desc omap54xx_io_desc[] __initdata = {
 #endif
 
 #ifdef CONFIG_SOC_OMAP2420
-void __init omap242x_map_common_io(void)
+void __init omap242x_map_io(void)
 {
        iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
        iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
@@ -273,7 +280,7 @@ void __init omap242x_map_common_io(void)
 #endif
 
 #ifdef CONFIG_SOC_OMAP2430
-void __init omap243x_map_common_io(void)
+void __init omap243x_map_io(void)
 {
        iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
        iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
@@ -281,28 +288,28 @@ void __init omap243x_map_common_io(void)
 #endif
 
 #ifdef CONFIG_ARCH_OMAP3
-void __init omap34xx_map_common_io(void)
+void __init omap3_map_io(void)
 {
        iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
 }
 #endif
 
 #ifdef CONFIG_SOC_TI81XX
-void __init omapti81xx_map_common_io(void)
+void __init ti81xx_map_io(void)
 {
        iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc));
 }
 #endif
 
 #ifdef CONFIG_SOC_AM33XX
-void __init omapam33xx_map_common_io(void)
+void __init am33xx_map_io(void)
 {
        iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc));
 }
 #endif
 
 #ifdef CONFIG_ARCH_OMAP4
-void __init omap44xx_map_common_io(void)
+void __init omap4_map_io(void)
 {
        iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
        omap_barriers_init();
@@ -310,7 +317,7 @@ void __init omap44xx_map_common_io(void)
 #endif
 
 #ifdef CONFIG_SOC_OMAP5
-void __init omap5_map_common_io(void)
+void __init omap5_map_io(void)
 {
        iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc));
 }
@@ -354,11 +361,6 @@ static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
        return omap_hwmod_set_postsetup_state(oh, *(u8 *)data);
 }
 
-static void __init omap_common_init_early(void)
-{
-       omap_init_consistent_dma_size();
-}
-
 static void __init omap_hwmod_init_postsetup(void)
 {
        u8 postsetup_state;
@@ -377,9 +379,15 @@ static void __init omap_hwmod_init_postsetup(void)
 #ifdef CONFIG_SOC_OMAP2420
 void __init omap2420_init_early(void)
 {
-       omap2_set_globals_242x();
+       omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000));
+       omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
+                              OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));
+       omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
+                                 NULL);
+       omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE));
+       omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE), NULL);
        omap2xxx_check_revision();
-       omap_common_init_early();
+       omap2xxx_cm_init();
        omap2xxx_voltagedomains_init();
        omap242x_powerdomains_init();
        omap242x_clockdomains_init();
@@ -399,9 +407,15 @@ void __init omap2420_init_late(void)
 #ifdef CONFIG_SOC_OMAP2430
 void __init omap2430_init_early(void)
 {
-       omap2_set_globals_243x();
+       omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000));
+       omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
+                              OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
+       omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
+                                 NULL);
+       omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE));
+       omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE), NULL);
        omap2xxx_check_revision();
-       omap_common_init_early();
+       omap2xxx_cm_init();
        omap2xxx_voltagedomains_init();
        omap243x_powerdomains_init();
        omap243x_clockdomains_init();
@@ -425,10 +439,16 @@ void __init omap2430_init_late(void)
 #ifdef CONFIG_ARCH_OMAP3
 void __init omap3_init_early(void)
 {
-       omap2_set_globals_3xxx();
+       omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
+       omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
+                              OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
+       omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
+                                 NULL);
+       omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
+       omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), NULL);
        omap3xxx_check_revision();
        omap3xxx_check_features();
-       omap_common_init_early();
+       omap3xxx_cm_init();
        omap3xxx_voltagedomains_init();
        omap3xxx_powerdomains_init();
        omap3xxx_clockdomains_init();
@@ -459,10 +479,14 @@ void __init am35xx_init_early(void)
 
 void __init ti81xx_init_early(void)
 {
-       omap2_set_globals_ti81xx();
+       omap2_set_globals_tap(OMAP343X_CLASS,
+                             OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
+       omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
+                                 NULL);
+       omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE));
+       omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE), NULL);
        omap3xxx_check_revision();
        ti81xx_check_features();
-       omap_common_init_early();
        omap3xxx_voltagedomains_init();
        omap3xxx_powerdomains_init();
        omap3xxx_clockdomains_init();
@@ -517,10 +541,14 @@ void __init ti81xx_init_late(void)
 #ifdef CONFIG_SOC_AM33XX
 void __init am33xx_init_early(void)
 {
-       omap2_set_globals_am33xx();
+       omap2_set_globals_tap(AM335X_CLASS,
+                             AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
+       omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
+                                 NULL);
+       omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE));
+       omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL);
        omap3xxx_check_revision();
        ti81xx_check_features();
-       omap_common_init_early();
        am33xx_voltagedomains_init();
        am33xx_powerdomains_init();
        am33xx_clockdomains_init();
@@ -533,10 +561,18 @@ void __init am33xx_init_early(void)
 #ifdef CONFIG_ARCH_OMAP4
 void __init omap4430_init_early(void)
 {
-       omap2_set_globals_443x();
+       omap2_set_globals_tap(OMAP443X_CLASS,
+                             OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
+       omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
+                                 OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE));
+       omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE));
+       omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
+                            OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE));
+       omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
+       omap_prm_base_init();
+       omap_cm_base_init();
        omap4xxx_check_revision();
        omap4xxx_check_features();
-       omap_common_init_early();
        omap44xx_voltagedomains_init();
        omap44xx_powerdomains_init();
        omap44xx_clockdomains_init();
@@ -556,9 +592,17 @@ void __init omap4430_init_late(void)
 #ifdef CONFIG_SOC_OMAP5
 void __init omap5_init_early(void)
 {
-       omap2_set_globals_5xxx();
+       omap2_set_globals_tap(OMAP54XX_CLASS,
+                             OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
+       omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
+                                 OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE));
+       omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
+       omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
+                            OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
+       omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
+       omap_prm_base_init();
+       omap_cm_base_init();
        omap5xxx_check_revision();
-       omap_common_init_early();
 }
 #endif
 
index 37f8f948047baace501bc6ef4b09f551aa7c9cfa..bf496510eb5e31e2acd4cdb6afbb5a5c46059946 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
-
-#include <plat/dma.h>
-#include <plat/omap_device.h>
 #include <linux/pm_runtime.h>
 
+#include <plat-omap/dma-omap.h>
+
+#include "omap_device.h"
+
 /*
  * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle.
  * Sidetone needs non-gated ICLK and sidetone autoidle is broken.
  */
-#include "cm2xxx_3xxx.h"
+#include "cm3xxx.h"
 #include "cm-regbits-34xx.h"
 
 static int omap3_enable_st_clock(unsigned int id, bool enable)
diff --git a/arch/arm/mach-omap2/mmc.h b/arch/arm/mach-omap2/mmc.h
new file mode 100644 (file)
index 0000000..0cd4b08
--- /dev/null
@@ -0,0 +1,23 @@
+#include <linux/mmc/host.h>
+#include <linux/platform_data/mmc-omap.h>
+
+#define OMAP24XX_NR_MMC                2
+#define OMAP2420_MMC_SIZE      OMAP1_MMC_SIZE
+#define OMAP2_MMC1_BASE                0x4809c000
+
+#define OMAP4_MMC_REG_OFFSET   0x100
+
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
+void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data);
+#else
+static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
+{
+}
+#endif
+
+struct omap_hwmod;
+int omap_msdi_reset(struct omap_hwmod *oh);
+
+/* called from board-specific card detection service routine */
+extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
+                                       int is_closed);
index 9e57b4aadb0694bedc233599ddeb30c8d45a2567..aafdd4ca9f4fc0ac4f7ea2fbf9b83bfce21888d1 100644 (file)
 #include <linux/err.h>
 #include <linux/platform_data/gpio-omap.h>
 
-#include <plat/omap_hwmod.h>
-#include <plat/omap_device.h>
-#include <plat/mmc.h>
-
+#include "prm.h"
 #include "common.h"
 #include "control.h"
+#include "omap_hwmod.h"
+#include "omap_device.h"
 #include "mux.h"
+#include "mmc.h"
 
 /*
  * MSDI_CON_OFFSET: offset in bytes of the MSDI IP block's CON register
@@ -44,9 +44,6 @@
 #define MSDI_CON_CLKD_MASK                     (0x3f << 0)
 #define MSDI_CON_CLKD_SHIFT                    0
 
-/* Maximum microseconds to wait for OMAP module to softreset */
-#define MAX_MODULE_SOFTRESET_WAIT      10000
-
 /* MSDI_TARGET_RESET_CLKD: clock divisor to use throughout the reset */
 #define MSDI_TARGET_RESET_CLKD         0x3ff
 
index 701e17cba46855bb4c57e441d10ac76fc55c7fb9..26126343d6ac8a6badead78ca640bfc366e686cb 100644 (file)
@@ -36,8 +36,9 @@
 #include <linux/interrupt.h>
 
 
-#include <plat/omap_hwmod.h>
+#include "omap_hwmod.h"
 
+#include "soc.h"
 #include "control.h"
 #include "mux.h"
 #include "prm.h"
index ff4e6a0e9c7c7ef367ddffe6d92735a7e7e3389c..3f5fd7e3549dc36487e243f4840a5de2e0220b81 100644 (file)
@@ -50,6 +50,7 @@
 #include <asm/suspend.h>
 #include <asm/hardware/cache-l2x0.h>
 
+#include "soc.h"
 #include "common.h"
 #include "omap44xx.h"
 #include "omap4-sar-layout.h"
similarity index 98%
rename from arch/arm/plat-omap/omap-pm-noop.c
rename to arch/arm/mach-omap2/omap-pm-noop.c
index 9722f418ae1fa845b4008afd3a38b722ecf942d2..6a3be2bebddb638ec5b34c0241ee780e1f9e3918 100644 (file)
@@ -22,9 +22,8 @@
 #include <linux/device.h>
 #include <linux/platform_device.h>
 
-/* Interface documentation is in mach/omap-pm.h */
-#include <plat/omap-pm.h>
-#include <plat/omap_device.h>
+#include "omap_device.h"
+#include "omap-pm.h"
 
 static bool off_mode_enabled;
 static int dummy_context_loss_counter;
index e089e4d1ae38f2d3a12890087ab514a69bf57ccd..b970440cffca0b5484c90dd7b6e08c7caf5b6bc2 100644 (file)
@@ -18,7 +18,6 @@
 #include <asm/cacheflush.h>
 #include <asm/memblock.h>
 
-#include <plat/omap-secure.h>
 #include "omap-secure.h"
 
 static phys_addr_t omap_secure_memblock_base;
index c90a43589abef73c787cd2fbda38c26a11b0b0ae..0e729170c46b81f2ee7a263c797853abc7d01ab3 100644 (file)
@@ -52,6 +52,13 @@ extern u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs,
                                u32 arg1, u32 arg2, u32 arg3, u32 arg4);
 extern u32 omap_smc2(u32 id, u32 falg, u32 pargs);
 extern phys_addr_t omap_secure_ram_mempool_base(void);
+extern int omap_secure_ram_reserve_memblock(void);
 
+#ifdef CONFIG_OMAP4_ERRATA_I688
+extern int omap_barrier_reserve_memblock(void);
+#else
+static inline void omap_barrier_reserve_memblock(void)
+{ }
+#endif
 #endif /* __ASSEMBLER__ */
 #endif /* OMAP_ARCH_OMAP_SECURE_H */
diff --git a/arch/arm/mach-omap2/omap2-restart.c b/arch/arm/mach-omap2/omap2-restart.c
new file mode 100644 (file)
index 0000000..be6bc89
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * omap2-restart.c - code common to all OMAP2xxx machines.
+ *
+ * Copyright (C) 2012 Texas Instruments
+ * Paul Walmsley
+ *
+ * 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/clk.h>
+#include <linux/io.h>
+
+#include "common.h"
+#include "prm2xxx.h"
+
+/*
+ * reset_virt_prcm_set_ck, reset_sys_ck: pointers to the virt_prcm_set
+ * clock and the sys_ck.  Used during the reset process
+ */
+static struct clk *reset_virt_prcm_set_ck, *reset_sys_ck;
+
+/* Reboot handling */
+
+/**
+ * omap2xxx_restart - Set DPLL to bypass mode for reboot to work
+ *
+ * Set the DPLL to bypass so that reboot completes successfully.  No
+ * return value.
+ */
+void omap2xxx_restart(char mode, const char *cmd)
+{
+       u32 rate;
+
+       rate = clk_get_rate(reset_sys_ck);
+       clk_set_rate(reset_virt_prcm_set_ck, rate);
+
+       /* XXX Should save the cmd argument for use after the reboot */
+
+       omap2xxx_prm_dpll_reset(); /* never returns */
+       while (1);
+}
+
+/**
+ * omap2xxx_common_look_up_clks_for_reset - look up clocks needed for restart
+ *
+ * Some clocks need to be looked up in advance for the SoC restart
+ * operation to work - see omap2xxx_restart().  Returns -EINVAL upon
+ * error or 0 upon success.
+ */
+static int __init omap2xxx_common_look_up_clks_for_reset(void)
+{
+       reset_virt_prcm_set_ck = clk_get(NULL, "virt_prcm_set");
+       if (IS_ERR(reset_virt_prcm_set_ck))
+               return -EINVAL;
+
+       reset_sys_ck = clk_get(NULL, "sys_ck");
+       if (IS_ERR(reset_sys_ck))
+               return -EINVAL;
+
+       return 0;
+}
+core_initcall(omap2xxx_common_look_up_clks_for_reset);
diff --git a/arch/arm/mach-omap2/omap3-restart.c b/arch/arm/mach-omap2/omap3-restart.c
new file mode 100644 (file)
index 0000000..923c582
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * omap3-restart.c - Code common to all OMAP3xxx machines.
+ *
+ * Copyright (C) 2009, 2012 Texas Instruments
+ * Copyright (C) 2010 Nokia Corporation
+ * Tony Lindgren <tony@atomide.com>
+ * Santosh Shilimkar <santosh.shilimkar@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#include "iomap.h"
+#include "common.h"
+#include "control.h"
+#include "prm3xxx.h"
+
+/* Global address base setup code */
+
+/**
+ * omap3xxx_restart - trigger a software restart of the SoC
+ * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
+ * @cmd: passed from the userspace program rebooting the system (if provided)
+ *
+ * Resets the SoC.  For @cmd, see the 'reboot' syscall in
+ * kernel/sys.c.  No return value.
+ */
+void omap3xxx_restart(char mode, const char *cmd)
+{
+       omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
+       omap3xxx_prm_dpll3_reset(); /* never returns */
+       while (1);
+}
index e1f289748c5d5d7021b8f079c878bb723466785e..5695885ea340b6b754b3d36d5c181c78c67731b6 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/memblock.h>
 
-#include <plat/sram.h>
-#include <plat/omap-secure.h>
-#include <plat/mmc.h>
-
 #include "omap-wakeupgen.h"
-
 #include "soc.h"
+#include "iomap.h"
 #include "common.h"
+#include "mmc.h"
 #include "hsmmc.h"
+#include "prminst44xx.h"
+#include "prcm_mpu44xx.h"
 #include "omap4-sar-layout.h"
+#include "omap-secure.h"
+#include "sram.h"
 
 #ifdef CONFIG_CACHE_L2X0
 static void __iomem *l2cache_base;
@@ -281,3 +282,19 @@ int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
        return 0;
 }
 #endif
+
+/**
+ * omap44xx_restart - trigger a software restart of the SoC
+ * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
+ * @cmd: passed from the userspace program rebooting the system (if provided)
+ *
+ * Resets the SoC.  For @cmd, see the 'reboot' syscall in
+ * kernel/sys.c.  No return value.
+ */
+void omap44xx_restart(char mode, const char *cmd)
+{
+       /* XXX Should save 'cmd' into scratchpad for use after reboot */
+       omap4_prminst_global_warm_sw_reset(); /* never returns */
+       while (1);
+}
+
similarity index 99%
rename from arch/arm/plat-omap/omap_device.c
rename to arch/arm/mach-omap2/omap_device.c
index 7a7d1f2a65e99495e849db5449bbb81d008facf1..0ef934fec364a674d98e09cb625425e8461e4bcb 100644 (file)
@@ -89,9 +89,8 @@
 #include <linux/of.h>
 #include <linux/notifier.h>
 
-#include <plat/omap_device.h>
-#include <plat/omap_hwmod.h>
-#include <plat/clock.h>
+#include "omap_device.h"
+#include "omap_hwmod.h"
 
 /* These parameters are passed to _omap_device_{de,}activate() */
 #define USE_WAKEUP_LAT                 0
similarity index 99%
rename from arch/arm/plat-omap/include/plat/omap_device.h
rename to arch/arm/mach-omap2/omap_device.h
index 106f50665804952edaf78b3f21167a78b9d5e1ec..0933c599bf896a7002c448e99fa97ef3a97425dc 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 
-#include <plat/omap_hwmod.h>
+#include "omap_hwmod.h"
 
 extern struct dev_pm_domain omap_device_pm_domain;
 
index b969ab1d258b91894415c3507bd8b50cd2aefa50..139adca3bda1941621bcf89d7d38f8df98b35502 100644 (file)
 #include <linux/slab.h>
 #include <linux/bootmem.h>
 
-#include <plat/clock.h>
-#include <plat/omap_hwmod.h>
-#include <plat/prcm.h>
+#include "clock.h"
+#include "omap_hwmod.h"
 
 #include "soc.h"
 #include "common.h"
 #include "clockdomain.h"
 #include "powerdomain.h"
-#include "cm2xxx_3xxx.h"
+#include "cm2xxx.h"
+#include "cm3xxx.h"
 #include "cminst44xx.h"
 #include "cm33xx.h"
-#include "prm2xxx_3xxx.h"
+#include "prm.h"
+#include "prm3xxx.h"
 #include "prm44xx.h"
 #include "prm33xx.h"
 #include "prminst44xx.h"
 #include "mux.h"
 #include "pm.h"
 
-/* Maximum microseconds to wait for OMAP module to softreset */
-#define MAX_MODULE_SOFTRESET_WAIT      10000
-
 /* Name of the OMAP hwmod for the MPU */
 #define MPU_INITIATOR_NAME             "mpu"
 
@@ -2063,7 +2061,8 @@ static int _enable(struct omap_hwmod *oh)
                        _enable_sysc(oh);
                }
        } else {
-               _omap4_disable_module(oh);
+               if (soc_ops.disable_module)
+                       soc_ops.disable_module(oh);
                _disable_clocks(oh);
                pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n",
                         oh->name, r);
@@ -2668,7 +2667,34 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
 /* Static functions intended only for use in soc_ops field function pointers */
 
 /**
- * _omap2_wait_target_ready - wait for a module to leave slave idle
+ * _omap2xxx_wait_target_ready - wait for a module to leave slave idle
+ * @oh: struct omap_hwmod *
+ *
+ * Wait for a module @oh to leave slave idle.  Returns 0 if the module
+ * does not have an IDLEST bit or if the module successfully leaves
+ * slave idle; otherwise, pass along the return value of the
+ * appropriate *_cm*_wait_module_ready() function.
+ */
+static int _omap2xxx_wait_target_ready(struct omap_hwmod *oh)
+{
+       if (!oh)
+               return -EINVAL;
+
+       if (oh->flags & HWMOD_NO_IDLEST)
+               return 0;
+
+       if (!_find_mpu_rt_port(oh))
+               return 0;
+
+       /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
+
+       return omap2xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs,
+                                            oh->prcm.omap2.idlest_reg_id,
+                                            oh->prcm.omap2.idlest_idle_bit);
+}
+
+/**
+ * _omap3xxx_wait_target_ready - wait for a module to leave slave idle
  * @oh: struct omap_hwmod *
  *
  * Wait for a module @oh to leave slave idle.  Returns 0 if the module
@@ -2676,7 +2702,7 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
  * slave idle; otherwise, pass along the return value of the
  * appropriate *_cm*_wait_module_ready() function.
  */
-static int _omap2_wait_target_ready(struct omap_hwmod *oh)
+static int _omap3xxx_wait_target_ready(struct omap_hwmod *oh)
 {
        if (!oh)
                return -EINVAL;
@@ -2689,9 +2715,9 @@ static int _omap2_wait_target_ready(struct omap_hwmod *oh)
 
        /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
 
-       return omap2_cm_wait_module_ready(oh->prcm.omap2.module_offs,
-                                         oh->prcm.omap2.idlest_reg_id,
-                                         oh->prcm.omap2.idlest_idle_bit);
+       return omap3xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs,
+                                            oh->prcm.omap2.idlest_reg_id,
+                                            oh->prcm.omap2.idlest_idle_bit);
 }
 
 /**
@@ -3959,8 +3985,13 @@ int omap_hwmod_pad_route_irq(struct omap_hwmod *oh, int pad_idx, int irq_idx)
  */
 void __init omap_hwmod_init(void)
 {
-       if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
-               soc_ops.wait_target_ready = _omap2_wait_target_ready;
+       if (cpu_is_omap24xx()) {
+               soc_ops.wait_target_ready = _omap2xxx_wait_target_ready;
+               soc_ops.assert_hardreset = _omap2_assert_hardreset;
+               soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
+               soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;
+       } else if (cpu_is_omap34xx()) {
+               soc_ops.wait_target_ready = _omap3xxx_wait_target_ready;
                soc_ops.assert_hardreset = _omap2_assert_hardreset;
                soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
                soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;
similarity index 99%
rename from arch/arm/plat-omap/include/plat/omap_hwmod.h
rename to arch/arm/mach-omap2/omap_hwmod.h
index b3349f7b1a2cda6458ed75b541a07298c84e7234..87b59b45c678c65da3d8e59a85161c09c11c577b 100644 (file)
@@ -35,7 +35,6 @@
 #include <linux/list.h>
 #include <linux/ioport.h>
 #include <linux/spinlock.h>
-#include <plat/cpu.h>
 
 struct omap_device;
 
index b5db6007c523413cfd0e2b4f1063b5451a231f00..a8b3368dca3dff7825509174d903595ae4d1da87 100644 (file)
  * XXX handle crossbar/shared link difference for L3?
  * XXX these should be marked initdata for multi-OMAP kernels
  */
+
+#include <linux/i2c-omap.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 
-#include <plat/omap_hwmod.h>
-#include <plat/dma.h>
-#include <plat/serial.h>
-#include <plat/i2c.h>
+#include <plat-omap/dma-omap.h>
 #include <plat/dmtimer.h>
+
+#include "omap_hwmod.h"
 #include "l3_2xxx.h"
 #include "l4_2xxx.h"
-#include <plat/mmc.h>
 
 #include "omap_hwmod_common_data.h"
 
 #include "cm-regbits-24xx.h"
 #include "prm-regbits-24xx.h"
+#include "i2c.h"
+#include "mmc.h"
+#include "serial.h"
 #include "wd_timer.h"
 
 /*
index c455e41b02374ce7028a2bb3b9c0f8c45a57f1eb..dc768c50e523d4c49dda1a0580a5c3d089424103 100644 (file)
  * XXX handle crossbar/shared link difference for L3?
  * XXX these should be marked initdata for multi-OMAP kernels
  */
+
+#include <linux/i2c-omap.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 
-#include <plat/omap_hwmod.h>
-#include <plat/dma.h>
-#include <plat/serial.h>
-#include <plat/i2c.h>
+#include <plat-omap/dma-omap.h>
 #include <plat/dmtimer.h>
-#include <plat/mmc.h>
+
+#include "omap_hwmod.h"
+#include "mmc.h"
 #include "l3_2xxx.h"
 
 #include "soc.h"
 #include "omap_hwmod_common_data.h"
 #include "prm-regbits-24xx.h"
 #include "cm-regbits-24xx.h"
+#include "i2c.h"
 #include "wd_timer.h"
 
 /*
index cbb4ef6544adfba32c0336c6f5054ec5b10aef45..0413daba2dba1bdc88e4522cf9c6c04bf76acca0 100644 (file)
@@ -13,8 +13,7 @@
  */
 #include <asm/sizes.h>
 
-#include <plat/omap_hwmod.h>
-#include <plat/serial.h>
+#include "omap_hwmod.h"
 
 #include "omap_hwmod_common_data.h"
 
index 8851bbb6bb2414e1206449e3e954232c4c443c1b..40d6c93d98530cd673b3ba1ff29245a94a79b3da 100644 (file)
@@ -9,13 +9,14 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#include <plat/omap_hwmod.h>
-#include <plat/serial.h>
-#include <plat/dma.h>
-#include <plat/common.h>
+
+#include <plat-omap/dma-omap.h>
+
+#include "omap_hwmod.h"
 #include "hdq1w.h"
 
 #include "omap_hwmod_common_data.h"
+#include "dma.h"
 
 /* UART */
 
index 1a1287d62648df38ebe2f20474d91afa4c1ddf92..47901a5e76de517b9f86d5f4bc83b0614857e5e1 100644 (file)
  */
 #include <asm/sizes.h>
 
-#include <plat/omap_hwmod.h>
-#include <plat/serial.h>
+#include "omap_hwmod.h"
 #include "l3_2xxx.h"
 #include "l4_2xxx.h"
+#include "serial.h"
 
 #include "omap_hwmod_common_data.h"
 
index bd9220ed5ab9d9fda89cca30b4bf1c339cad9f6d..a0116d08cf4575bd5cc604feed0595019b9c4611 100644 (file)
@@ -8,13 +8,13 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#include <plat/omap_hwmod.h>
-#include <plat/serial.h>
+
 #include <linux/platform_data/gpio-omap.h>
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 #include <plat/dmtimer.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 
+#include "omap_hwmod.h"
 #include "omap_hwmod_common_data.h"
 #include "cm-regbits-24xx.h"
 #include "prm-regbits-24xx.h"
index 59d5c1cd316d5eb71c924b3b945ff166e94b9088..ad8d43b33273917edd49b6e228fe06f978abdc41 100644 (file)
  * GNU General Public License for more details.
  */
 
-#include <plat/omap_hwmod.h>
-#include <plat/cpu.h>
+#include <linux/i2c-omap.h>
+
+#include "omap_hwmod.h"
 #include <linux/platform_data/gpio-omap.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
-#include <plat/dma.h>
-#include <plat/mmc.h>
-#include <plat/i2c.h>
 
 #include "omap_hwmod_common_data.h"
 
@@ -28,6 +26,8 @@
 #include "cm33xx.h"
 #include "prm33xx.h"
 #include "prm-regbits-33xx.h"
+#include "i2c.h"
+#include "mmc.h"
 
 /*
  * IP blocks
index f67b7ee07dd4f5575e206c2098bb67c88fa32873..abe66ced903fe0e5a032bd827f547c79640fffc1 100644 (file)
  *
  * XXX these should be marked initdata for multi-OMAP kernels
  */
+
+#include <linux/i2c-omap.h>
 #include <linux/power/smartreflex.h>
 #include <linux/platform_data/gpio-omap.h>
 
-#include <plat/omap_hwmod.h>
-#include <plat/dma.h>
-#include <plat/serial.h>
+#include <plat-omap/dma-omap.h>
 #include "l3_3xxx.h"
 #include "l4_3xxx.h"
-#include <plat/i2c.h>
-#include <plat/mmc.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <plat/dmtimer.h>
 #include "am35xx.h"
 
 #include "soc.h"
+#include "omap_hwmod.h"
 #include "omap_hwmod_common_data.h"
 #include "prm-regbits-34xx.h"
 #include "cm-regbits-34xx.h"
+
+#include "dma.h"
+#include "i2c.h"
+#include "mmc.h"
 #include "wd_timer.h"
+#include "serial.h"
 
 /*
  * OMAP3xxx hardware module integration data
index 652d0285bd6dd7b1a445bcbab02e395e04c5e11a..7a6132848f5d209511b51139b1d124eb7798492a 100644 (file)
 #include <linux/io.h>
 #include <linux/platform_data/gpio-omap.h>
 #include <linux/power/smartreflex.h>
+#include <linux/i2c-omap.h>
+
+#include <plat-omap/dma-omap.h>
 
-#include <plat/omap_hwmod.h>
-#include <plat/i2c.h>
-#include <plat/dma.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
-#include <plat/mmc.h>
 #include <plat/dmtimer.h>
-#include <plat/common.h>
 #include <plat/iommu.h>
 
+#include "omap_hwmod.h"
 #include "omap_hwmod_common_data.h"
 #include "cm1_44xx.h"
 #include "cm2_44xx.h"
 #include "prm44xx.h"
 #include "prm-regbits-44xx.h"
+#include "i2c.h"
+#include "mmc.h"
 #include "wd_timer.h"
 
 /* Base offset for all OMAP4 interrupts external to MPUSS */
index 9f1ccdc8cc8cc0e137cc8b694a650f623c194646..79d623b83e496d5d79d6901a61c36754a9635b77 100644 (file)
@@ -16,7 +16,7 @@
  * data and their integration with other OMAP modules and Linux.
  */
 
-#include <plat/omap_hwmod.h>
+#include "omap_hwmod.h"
 
 #include "omap_hwmod_common_data.h"
 
index 2bc8f1705d4aa7ce18d779c27089116990979d14..cfcce299177c537750d7143919e294ff6aec2532 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef __ARCH_ARM_MACH_OMAP2_OMAP_HWMOD_COMMON_DATA_H
 #define __ARCH_ARM_MACH_OMAP2_OMAP_HWMOD_COMMON_DATA_H
 
-#include <plat/omap_hwmod.h>
+#include "omap_hwmod.h"
 
 #include "common.h"
 #include "display.h"
index c784c12f98a1445e3ea9ef97e77f2fea904aa05a..7e437bf6024ca2ef694913c3a3eac9dac1f16e87 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H
 #define __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H
 
-#include <plat/omap_hwmod.h>
+#include "omap_hwmod.h"
 
 #include "voltage.h"
 
index d992db8ff0b07481fe21f24b410f9771dd3cda83..4d76a3ca5bf3de373b08104bc1792e013671e835 100644 (file)
 #include <linux/io.h>
 #include <linux/err.h>
 #include <linux/usb.h>
-
-#include <plat/usb.h>
+#include <linux/usb/musb.h>
 
 #include "soc.h"
 #include "control.h"
+#include "usb.h"
 
 void am35x_musb_reset(void)
 {
index f515a1a056d55c96facdb49c9eec0911d8f6c728..2bf35dc091be445ac8cc8ef3f833a261c76a96bb 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/kernel.h>
 #include <linux/i2c/twl.h>
 
+#include "soc.h"
 #include "voltage.h"
 
 #include "pm.h"
index 58e16aef40bbd92f73ea631ce2e777028ddfaf53..bd41d59a7cab08ecbca342a665f5f944aa67b6bc 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/opp.h>
 #include <linux/cpu.h>
 
-#include <plat/omap_device.h>
+#include "omap_device.h"
 
 #include "omap_opp_data.h"
 
index 75cef5f67a8a6bbc9b39840d7e1339d7bbc16a2d..62772e0e0d6959061068b31c8472f18ae84451a7 100644 (file)
@@ -19,6 +19,7 @@
  */
 #include <linux/module.h>
 
+#include "soc.h"
 #include "control.h"
 #include "omap_opp_data.h"
 #include "pm.h"
index 46092cd806fae24d14b90829c163190579104a05..3cf4fdfd7ab0b11a0a7b1695d14092529e7db863 100644 (file)
 #include <linux/module.h>
 #include <linux/slab.h>
 
-#include <plat/clock.h>
+#include "clock.h"
 #include "powerdomain.h"
 #include "clockdomain.h"
 #include <plat/dmtimer.h>
-#include <plat/omap-pm.h>
+#include "omap-pm.h"
 
+#include "soc.h"
 #include "cm2xxx_3xxx.h"
 #include "prm2xxx_3xxx.h"
 #include "pm.h"
index ea61c32957bdaeeb69f5f21467dcc291b05d397f..331478f9b86403cd73d770bc564602c6b912b01e 100644 (file)
 
 #include <asm/system_misc.h>
 
-#include <plat/omap-pm.h>
-#include <plat/omap_device.h>
+#include "omap-pm.h"
+#include "omap_device.h"
 #include "common.h"
 
+#include "soc.h"
 #include "prcm-common.h"
 #include "voltage.h"
 #include "powerdomain.h"
index 8af6cd6ac331ffd2cfdf32c53782a9fdafad952f..13e1f4303989aeca16241e79637e62f9c429d497 100644 (file)
 #include <linux/gpio.h>
 #include <linux/platform_data/gpio-omap.h>
 
+#include <asm/fncpy.h>
+
 #include <asm/mach/time.h>
 #include <asm/mach/irq.h>
 #include <asm/mach-types.h>
 #include <asm/system_misc.h>
 
-#include <plat/clock.h>
-#include <plat/sram.h>
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 
+#include "soc.h"
 #include "common.h"
-#include "prm2xxx_3xxx.h"
+#include "clock.h"
+#include "prm2xxx.h"
 #include "prm-regbits-24xx.h"
-#include "cm2xxx_3xxx.h"
+#include "cm2xxx.h"
 #include "cm-regbits-24xx.h"
 #include "sdrc.h"
+#include "sram.h"
 #include "pm.h"
 #include "control.h"
 #include "powerdomain.h"
index 3a904de4313ec82deb6b4f2e61d460e318ef0e87..7703200614222aa8e16aaf15f715191dee62a71c 100644 (file)
 
 #include <trace/events/power.h>
 
+#include <asm/fncpy.h>
 #include <asm/suspend.h>
 #include <asm/system_misc.h>
 
-#include <plat/sram.h>
 #include "clockdomain.h"
 #include "powerdomain.h"
-#include <plat/sdrc.h>
-#include <plat/prcm.h>
-#include <plat/gpmc.h>
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 
+#include "soc.h"
 #include "common.h"
-#include "cm2xxx_3xxx.h"
+#include "cm3xxx.h"
 #include "cm-regbits-34xx.h"
+#include "gpmc.h"
 #include "prm-regbits-34xx.h"
-
-#include "prm2xxx_3xxx.h"
+#include "prm3xxx.h"
 #include "pm.h"
 #include "sdrc.h"
+#include "sram.h"
 #include "control.h"
 
 /* pm34xx errata defined in pm.h */
index 04922d1490683d8c0a7d443ea6806a9032535b29..7da75aed1514bf8374aa54310b70c29a7d895693 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include <asm/system_misc.h>
 
+#include "soc.h"
 #include "common.h"
 #include "clockdomain.h"
 #include "powerdomain.h"
index 2a791766283d171b145fb7678ae0c78e1e1cb121..3cf79b54ce61ac7fc3c72a0de6bc52a43e68f2a2 100644 (file)
@@ -15,8 +15,9 @@
 
 #include <asm/pmu.h>
 
-#include <plat/omap_hwmod.h>
-#include <plat/omap_device.h>
+#include "soc.h"
+#include "omap_hwmod.h"
+#include "omap_device.h"
 
 static char *omap2_pmu_oh_names[] = {"mpu"};
 static char *omap3_pmu_oh_names[] = {"mpu", "debugss"};
index 1678a3284233ec02b424bca2eea207396c32f2c7..dea62a9aad0751d77796b5c3fbbba513c9ae6f02 100644 (file)
@@ -29,8 +29,6 @@
 
 #include <asm/cpu.h>
 
-#include <plat/prcm.h>
-
 #include "powerdomain.h"
 #include "clockdomain.h"
 
index baee90608d11b8ddd444df041e401b4ef5314456..5277d56eb37f283fb9de3c33846639ee05ebba96 100644 (file)
@@ -22,8 +22,6 @@
 
 #include <linux/atomic.h>
 
-#include <plat/cpu.h>
-
 #include "voltage.h"
 
 /* Powerdomain basic power states */
diff --git a/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c b/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
deleted file mode 100644 (file)
index 3950ccf..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * OMAP2 and OMAP3 powerdomain control
- *
- * Copyright (C) 2009-2011 Texas Instruments, Inc.
- * Copyright (C) 2007-2009 Nokia Corporation
- *
- * Derived from mach-omap2/powerdomain.c written by Paul Walmsley
- * Rajendra Nayak <rnayak@ti.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/io.h>
-#include <linux/errno.h>
-#include <linux/delay.h>
-#include <linux/bug.h>
-
-#include <plat/prcm.h>
-
-#include "powerdomain.h"
-#include "prm.h"
-#include "prm-regbits-24xx.h"
-#include "prm-regbits-34xx.h"
-
-
-/* Common functions across OMAP2 and OMAP3 */
-static int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
-{
-       omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
-                               (pwrst << OMAP_POWERSTATE_SHIFT),
-                               pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
-       return 0;
-}
-
-static int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
-{
-       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
-                                            OMAP2_PM_PWSTCTRL,
-                                            OMAP_POWERSTATE_MASK);
-}
-
-static int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm)
-{
-       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
-                                            OMAP2_PM_PWSTST,
-                                            OMAP_POWERSTATEST_MASK);
-}
-
-static int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
-                                                               u8 pwrst)
-{
-       u32 m;
-
-       m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
-
-       omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
-                                  OMAP2_PM_PWSTCTRL);
-
-       return 0;
-}
-
-static int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
-                                                               u8 pwrst)
-{
-       u32 m;
-
-       m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
-
-       omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
-                                  OMAP2_PM_PWSTCTRL);
-
-       return 0;
-}
-
-static int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
-{
-       u32 m;
-
-       m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
-
-       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTST,
-                                            m);
-}
-
-static int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
-{
-       u32 m;
-
-       m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
-
-       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
-                                            OMAP2_PM_PWSTCTRL, m);
-}
-
-static int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
-{
-       u32 v;
-
-       v = pwrst << __ffs(OMAP3430_LOGICL1CACHERETSTATE_MASK);
-       omap2_prm_rmw_mod_reg_bits(OMAP3430_LOGICL1CACHERETSTATE_MASK, v,
-                                  pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
-
-       return 0;
-}
-
-static int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm)
-{
-       u32 c = 0;
-
-       /*
-        * REVISIT: pwrdm_wait_transition() may be better implemented
-        * via a callback and a periodic timer check -- how long do we expect
-        * powerdomain transitions to take?
-        */
-
-       /* XXX Is this udelay() value meaningful? */
-       while ((omap2_prm_read_mod_reg(pwrdm->prcm_offs, OMAP2_PM_PWSTST) &
-               OMAP_INTRANSITION_MASK) &&
-               (c++ < PWRDM_TRANSITION_BAILOUT))
-                       udelay(1);
-
-       if (c > PWRDM_TRANSITION_BAILOUT) {
-               pr_err("powerdomain: %s: waited too long to complete transition\n",
-                      pwrdm->name);
-               return -EAGAIN;
-       }
-
-       pr_debug("powerdomain: completed transition in %d loops\n", c);
-
-       return 0;
-}
-
-/* Applicable only for OMAP3. Not supported on OMAP2 */
-static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
-{
-       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
-                                            OMAP3430_PM_PREPWSTST,
-                                            OMAP3430_LASTPOWERSTATEENTERED_MASK);
-}
-
-static int omap3_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
-{
-       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
-                                            OMAP2_PM_PWSTST,
-                                            OMAP3430_LOGICSTATEST_MASK);
-}
-
-static int omap3_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
-{
-       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
-                                            OMAP2_PM_PWSTCTRL,
-                                            OMAP3430_LOGICSTATEST_MASK);
-}
-
-static int omap3_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
-{
-       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
-                                            OMAP3430_PM_PREPWSTST,
-                                            OMAP3430_LASTLOGICSTATEENTERED_MASK);
-}
-
-static int omap3_get_mem_bank_lastmemst_mask(u8 bank)
-{
-       switch (bank) {
-       case 0:
-               return OMAP3430_LASTMEM1STATEENTERED_MASK;
-       case 1:
-               return OMAP3430_LASTMEM2STATEENTERED_MASK;
-       case 2:
-               return OMAP3430_LASTSHAREDL2CACHEFLATSTATEENTERED_MASK;
-       case 3:
-               return OMAP3430_LASTL2FLATMEMSTATEENTERED_MASK;
-       default:
-               WARN_ON(1); /* should never happen */
-               return -EEXIST;
-       }
-       return 0;
-}
-
-static int omap3_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
-{
-       u32 m;
-
-       m = omap3_get_mem_bank_lastmemst_mask(bank);
-
-       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
-                               OMAP3430_PM_PREPWSTST, m);
-}
-
-static int omap3_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
-{
-       omap2_prm_write_mod_reg(0, pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST);
-       return 0;
-}
-
-static int omap3_pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm)
-{
-       return omap2_prm_rmw_mod_reg_bits(0,
-                                         1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
-                                         pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
-}
-
-static int omap3_pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm)
-{
-       return omap2_prm_rmw_mod_reg_bits(1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
-                                         0, pwrdm->prcm_offs,
-                                         OMAP2_PM_PWSTCTRL);
-}
-
-struct pwrdm_ops omap2_pwrdm_operations = {
-       .pwrdm_set_next_pwrst   = omap2_pwrdm_set_next_pwrst,
-       .pwrdm_read_next_pwrst  = omap2_pwrdm_read_next_pwrst,
-       .pwrdm_read_pwrst       = omap2_pwrdm_read_pwrst,
-       .pwrdm_set_logic_retst  = omap2_pwrdm_set_logic_retst,
-       .pwrdm_set_mem_onst     = omap2_pwrdm_set_mem_onst,
-       .pwrdm_set_mem_retst    = omap2_pwrdm_set_mem_retst,
-       .pwrdm_read_mem_pwrst   = omap2_pwrdm_read_mem_pwrst,
-       .pwrdm_read_mem_retst   = omap2_pwrdm_read_mem_retst,
-       .pwrdm_wait_transition  = omap2_pwrdm_wait_transition,
-};
-
-struct pwrdm_ops omap3_pwrdm_operations = {
-       .pwrdm_set_next_pwrst   = omap2_pwrdm_set_next_pwrst,
-       .pwrdm_read_next_pwrst  = omap2_pwrdm_read_next_pwrst,
-       .pwrdm_read_pwrst       = omap2_pwrdm_read_pwrst,
-       .pwrdm_read_prev_pwrst  = omap3_pwrdm_read_prev_pwrst,
-       .pwrdm_set_logic_retst  = omap2_pwrdm_set_logic_retst,
-       .pwrdm_read_logic_pwrst = omap3_pwrdm_read_logic_pwrst,
-       .pwrdm_read_logic_retst = omap3_pwrdm_read_logic_retst,
-       .pwrdm_read_prev_logic_pwrst    = omap3_pwrdm_read_prev_logic_pwrst,
-       .pwrdm_set_mem_onst     = omap2_pwrdm_set_mem_onst,
-       .pwrdm_set_mem_retst    = omap2_pwrdm_set_mem_retst,
-       .pwrdm_read_mem_pwrst   = omap2_pwrdm_read_mem_pwrst,
-       .pwrdm_read_mem_retst   = omap2_pwrdm_read_mem_retst,
-       .pwrdm_read_prev_mem_pwrst      = omap3_pwrdm_read_prev_mem_pwrst,
-       .pwrdm_clear_all_prev_pwrst     = omap3_pwrdm_clear_all_prev_pwrst,
-       .pwrdm_enable_hdwr_sar  = omap3_pwrdm_enable_hdwr_sar,
-       .pwrdm_disable_hdwr_sar = omap3_pwrdm_disable_hdwr_sar,
-       .pwrdm_wait_transition  = omap2_pwrdm_wait_transition,
-};
diff --git a/arch/arm/mach-omap2/powerdomain33xx.c b/arch/arm/mach-omap2/powerdomain33xx.c
deleted file mode 100644 (file)
index 67c5663..0000000
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * AM33XX Powerdomain control
- *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
- *
- * Derived from mach-omap2/powerdomain44xx.c written by Rajendra Nayak
- * <rnayak@ti.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.
- *
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- * kind, whether express or implied; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/io.h>
-#include <linux/errno.h>
-#include <linux/delay.h>
-
-#include <plat/prcm.h>
-
-#include "powerdomain.h"
-#include "prm33xx.h"
-#include "prm-regbits-33xx.h"
-
-
-static int am33xx_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
-{
-       am33xx_prm_rmw_reg_bits(OMAP_POWERSTATE_MASK,
-                               (pwrst << OMAP_POWERSTATE_SHIFT),
-                               pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
-       return 0;
-}
-
-static int am33xx_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
-{
-       u32 v;
-
-       v = am33xx_prm_read_reg(pwrdm->prcm_offs,  pwrdm->pwrstctrl_offs);
-       v &= OMAP_POWERSTATE_MASK;
-       v >>= OMAP_POWERSTATE_SHIFT;
-
-       return v;
-}
-
-static int am33xx_pwrdm_read_pwrst(struct powerdomain *pwrdm)
-{
-       u32 v;
-
-       v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
-       v &= OMAP_POWERSTATEST_MASK;
-       v >>= OMAP_POWERSTATEST_SHIFT;
-
-       return v;
-}
-
-static int am33xx_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
-{
-       u32 v;
-
-       v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
-       v &= AM33XX_LASTPOWERSTATEENTERED_MASK;
-       v >>= AM33XX_LASTPOWERSTATEENTERED_SHIFT;
-
-       return v;
-}
-
-static int am33xx_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
-{
-       am33xx_prm_rmw_reg_bits(AM33XX_LOWPOWERSTATECHANGE_MASK,
-                               (1 << AM33XX_LOWPOWERSTATECHANGE_SHIFT),
-                               pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
-       return 0;
-}
-
-static int am33xx_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
-{
-       am33xx_prm_rmw_reg_bits(AM33XX_LASTPOWERSTATEENTERED_MASK,
-                               AM33XX_LASTPOWERSTATEENTERED_MASK,
-                               pwrdm->prcm_offs, pwrdm->pwrstst_offs);
-       return 0;
-}
-
-static int am33xx_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
-{
-       u32 m;
-
-       m = pwrdm->logicretstate_mask;
-       if (!m)
-               return -EINVAL;
-
-       am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
-                               pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
-
-       return 0;
-}
-
-static int am33xx_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
-{
-       u32 v;
-
-       v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
-       v &= AM33XX_LOGICSTATEST_MASK;
-       v >>= AM33XX_LOGICSTATEST_SHIFT;
-
-       return v;
-}
-
-static int am33xx_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
-{
-       u32 v, m;
-
-       m = pwrdm->logicretstate_mask;
-       if (!m)
-               return -EINVAL;
-
-       v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
-       v &= m;
-       v >>= __ffs(m);
-
-       return v;
-}
-
-static int am33xx_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
-               u8 pwrst)
-{
-       u32 m;
-
-       m = pwrdm->mem_on_mask[bank];
-       if (!m)
-               return -EINVAL;
-
-       am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
-                               pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
-
-       return 0;
-}
-
-static int am33xx_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
-                                       u8 pwrst)
-{
-       u32 m;
-
-       m = pwrdm->mem_ret_mask[bank];
-       if (!m)
-               return -EINVAL;
-
-       am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
-                               pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
-
-       return 0;
-}
-
-static int am33xx_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
-{
-       u32 m, v;
-
-       m = pwrdm->mem_pwrst_mask[bank];
-       if (!m)
-               return -EINVAL;
-
-       v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
-       v &= m;
-       v >>= __ffs(m);
-
-       return v;
-}
-
-static int am33xx_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
-{
-       u32 m, v;
-
-       m = pwrdm->mem_retst_mask[bank];
-       if (!m)
-               return -EINVAL;
-
-       v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
-       v &= m;
-       v >>= __ffs(m);
-
-       return v;
-}
-
-static int am33xx_pwrdm_wait_transition(struct powerdomain *pwrdm)
-{
-       u32 c = 0;
-
-       /*
-        * REVISIT: pwrdm_wait_transition() may be better implemented
-        * via a callback and a periodic timer check -- how long do we expect
-        * powerdomain transitions to take?
-        */
-
-       /* XXX Is this udelay() value meaningful? */
-       while ((am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs)
-                       & OMAP_INTRANSITION_MASK) &&
-                       (c++ < PWRDM_TRANSITION_BAILOUT))
-               udelay(1);
-
-       if (c > PWRDM_TRANSITION_BAILOUT) {
-               pr_err("powerdomain: %s: waited too long to complete transition\n",
-                      pwrdm->name);
-               return -EAGAIN;
-       }
-
-       pr_debug("powerdomain: completed transition in %d loops\n", c);
-
-       return 0;
-}
-
-struct pwrdm_ops am33xx_pwrdm_operations = {
-       .pwrdm_set_next_pwrst           = am33xx_pwrdm_set_next_pwrst,
-       .pwrdm_read_next_pwrst          = am33xx_pwrdm_read_next_pwrst,
-       .pwrdm_read_pwrst               = am33xx_pwrdm_read_pwrst,
-       .pwrdm_read_prev_pwrst          = am33xx_pwrdm_read_prev_pwrst,
-       .pwrdm_set_logic_retst          = am33xx_pwrdm_set_logic_retst,
-       .pwrdm_read_logic_pwrst         = am33xx_pwrdm_read_logic_pwrst,
-       .pwrdm_read_logic_retst         = am33xx_pwrdm_read_logic_retst,
-       .pwrdm_clear_all_prev_pwrst     = am33xx_pwrdm_clear_all_prev_pwrst,
-       .pwrdm_set_lowpwrstchange       = am33xx_pwrdm_set_lowpwrstchange,
-       .pwrdm_read_mem_pwrst           = am33xx_pwrdm_read_mem_pwrst,
-       .pwrdm_read_mem_retst           = am33xx_pwrdm_read_mem_retst,
-       .pwrdm_set_mem_onst             = am33xx_pwrdm_set_mem_onst,
-       .pwrdm_set_mem_retst            = am33xx_pwrdm_set_mem_retst,
-       .pwrdm_wait_transition          = am33xx_pwrdm_wait_transition,
-};
diff --git a/arch/arm/mach-omap2/powerdomain44xx.c b/arch/arm/mach-omap2/powerdomain44xx.c
deleted file mode 100644 (file)
index aceb4f4..0000000
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * OMAP4 powerdomain control
- *
- * Copyright (C) 2009-2010, 2012 Texas Instruments, Inc.
- * Copyright (C) 2007-2009 Nokia Corporation
- *
- * Derived from mach-omap2/powerdomain.c written by Paul Walmsley
- * Rajendra Nayak <rnayak@ti.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/io.h>
-#include <linux/errno.h>
-#include <linux/delay.h>
-#include <linux/bug.h>
-
-#include "powerdomain.h"
-#include <plat/prcm.h>
-#include "prm2xxx_3xxx.h"
-#include "prm44xx.h"
-#include "prminst44xx.h"
-#include "prm-regbits-44xx.h"
-
-static int omap4_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
-{
-       omap4_prminst_rmw_inst_reg_bits(OMAP_POWERSTATE_MASK,
-                                       (pwrst << OMAP_POWERSTATE_SHIFT),
-                                       pwrdm->prcm_partition,
-                                       pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
-       return 0;
-}
-
-static int omap4_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
-{
-       u32 v;
-
-       v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
-                                       OMAP4_PM_PWSTCTRL);
-       v &= OMAP_POWERSTATE_MASK;
-       v >>= OMAP_POWERSTATE_SHIFT;
-
-       return v;
-}
-
-static int omap4_pwrdm_read_pwrst(struct powerdomain *pwrdm)
-{
-       u32 v;
-
-       v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
-                                       OMAP4_PM_PWSTST);
-       v &= OMAP_POWERSTATEST_MASK;
-       v >>= OMAP_POWERSTATEST_SHIFT;
-
-       return v;
-}
-
-static int omap4_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
-{
-       u32 v;
-
-       v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
-                                       OMAP4_PM_PWSTST);
-       v &= OMAP4430_LASTPOWERSTATEENTERED_MASK;
-       v >>= OMAP4430_LASTPOWERSTATEENTERED_SHIFT;
-
-       return v;
-}
-
-static int omap4_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
-{
-       omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOWPOWERSTATECHANGE_MASK,
-                                       (1 << OMAP4430_LOWPOWERSTATECHANGE_SHIFT),
-                                       pwrdm->prcm_partition,
-                                       pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
-       return 0;
-}
-
-static int omap4_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
-{
-       omap4_prminst_rmw_inst_reg_bits(OMAP4430_LASTPOWERSTATEENTERED_MASK,
-                                       OMAP4430_LASTPOWERSTATEENTERED_MASK,
-                                       pwrdm->prcm_partition,
-                                       pwrdm->prcm_offs, OMAP4_PM_PWSTST);
-       return 0;
-}
-
-static int omap4_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
-{
-       u32 v;
-
-       v = pwrst << __ffs(OMAP4430_LOGICRETSTATE_MASK);
-       omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOGICRETSTATE_MASK, v,
-                                       pwrdm->prcm_partition, pwrdm->prcm_offs,
-                                       OMAP4_PM_PWSTCTRL);
-
-       return 0;
-}
-
-static int omap4_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
-                                   u8 pwrst)
-{
-       u32 m;
-
-       m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
-
-       omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
-                                       pwrdm->prcm_partition, pwrdm->prcm_offs,
-                                       OMAP4_PM_PWSTCTRL);
-
-       return 0;
-}
-
-static int omap4_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
-                                    u8 pwrst)
-{
-       u32 m;
-
-       m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
-
-       omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
-                                       pwrdm->prcm_partition, pwrdm->prcm_offs,
-                                       OMAP4_PM_PWSTCTRL);
-
-       return 0;
-}
-
-static int omap4_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
-{
-       u32 v;
-
-       v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
-                                       OMAP4_PM_PWSTST);
-       v &= OMAP4430_LOGICSTATEST_MASK;
-       v >>= OMAP4430_LOGICSTATEST_SHIFT;
-
-       return v;
-}
-
-static int omap4_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
-{
-       u32 v;
-
-       v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
-                                       OMAP4_PM_PWSTCTRL);
-       v &= OMAP4430_LOGICRETSTATE_MASK;
-       v >>= OMAP4430_LOGICRETSTATE_SHIFT;
-
-       return v;
-}
-
-/**
- * omap4_pwrdm_read_prev_logic_pwrst - read the previous logic powerstate
- * @pwrdm: struct powerdomain * to read the state for
- *
- * Reads the previous logic powerstate for a powerdomain. This
- * function must determine the previous logic powerstate by first
- * checking the previous powerstate for the domain. If that was OFF,
- * then logic has been lost. If previous state was RETENTION, the
- * function reads the setting for the next retention logic state to
- * see the actual value.  In every other case, the logic is
- * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
- * depending whether the logic was retained or not.
- */
-static int omap4_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
-{
-       int state;
-
-       state = omap4_pwrdm_read_prev_pwrst(pwrdm);
-
-       if (state == PWRDM_POWER_OFF)
-               return PWRDM_POWER_OFF;
-
-       if (state != PWRDM_POWER_RET)
-               return PWRDM_POWER_RET;
-
-       return omap4_pwrdm_read_logic_retst(pwrdm);
-}
-
-static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
-{
-       u32 m, v;
-
-       m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
-
-       v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
-                                       OMAP4_PM_PWSTST);
-       v &= m;
-       v >>= __ffs(m);
-
-       return v;
-}
-
-static int omap4_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
-{
-       u32 m, v;
-
-       m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
-
-       v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
-                                       OMAP4_PM_PWSTCTRL);
-       v &= m;
-       v >>= __ffs(m);
-
-       return v;
-}
-
-/**
- * omap4_pwrdm_read_prev_mem_pwrst - reads the previous memory powerstate
- * @pwrdm: struct powerdomain * to read mem powerstate for
- * @bank: memory bank index
- *
- * Reads the previous memory powerstate for a powerdomain. This
- * function must determine the previous memory powerstate by first
- * checking the previous powerstate for the domain. If that was OFF,
- * then logic has been lost. If previous state was RETENTION, the
- * function reads the setting for the next memory retention state to
- * see the actual value.  In every other case, the logic is
- * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
- * depending whether logic was retained or not.
- */
-static int omap4_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
-{
-       int state;
-
-       state = omap4_pwrdm_read_prev_pwrst(pwrdm);
-
-       if (state == PWRDM_POWER_OFF)
-               return PWRDM_POWER_OFF;
-
-       if (state != PWRDM_POWER_RET)
-               return PWRDM_POWER_RET;
-
-       return omap4_pwrdm_read_mem_retst(pwrdm, bank);
-}
-
-static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm)
-{
-       u32 c = 0;
-
-       /*
-        * REVISIT: pwrdm_wait_transition() may be better implemented
-        * via a callback and a periodic timer check -- how long do we expect
-        * powerdomain transitions to take?
-        */
-
-       /* XXX Is this udelay() value meaningful? */
-       while ((omap4_prminst_read_inst_reg(pwrdm->prcm_partition,
-                                           pwrdm->prcm_offs,
-                                           OMAP4_PM_PWSTST) &
-               OMAP_INTRANSITION_MASK) &&
-              (c++ < PWRDM_TRANSITION_BAILOUT))
-               udelay(1);
-
-       if (c > PWRDM_TRANSITION_BAILOUT) {
-               pr_err("powerdomain: %s: waited too long to complete transition\n",
-                      pwrdm->name);
-               return -EAGAIN;
-       }
-
-       pr_debug("powerdomain: completed transition in %d loops\n", c);
-
-       return 0;
-}
-
-struct pwrdm_ops omap4_pwrdm_operations = {
-       .pwrdm_set_next_pwrst   = omap4_pwrdm_set_next_pwrst,
-       .pwrdm_read_next_pwrst  = omap4_pwrdm_read_next_pwrst,
-       .pwrdm_read_pwrst       = omap4_pwrdm_read_pwrst,
-       .pwrdm_read_prev_pwrst  = omap4_pwrdm_read_prev_pwrst,
-       .pwrdm_set_lowpwrstchange       = omap4_pwrdm_set_lowpwrstchange,
-       .pwrdm_clear_all_prev_pwrst     = omap4_pwrdm_clear_all_prev_pwrst,
-       .pwrdm_set_logic_retst  = omap4_pwrdm_set_logic_retst,
-       .pwrdm_read_logic_pwrst = omap4_pwrdm_read_logic_pwrst,
-       .pwrdm_read_prev_logic_pwrst    = omap4_pwrdm_read_prev_logic_pwrst,
-       .pwrdm_read_logic_retst = omap4_pwrdm_read_logic_retst,
-       .pwrdm_read_mem_pwrst   = omap4_pwrdm_read_mem_pwrst,
-       .pwrdm_read_mem_retst   = omap4_pwrdm_read_mem_retst,
-       .pwrdm_read_prev_mem_pwrst      = omap4_pwrdm_read_prev_mem_pwrst,
-       .pwrdm_set_mem_onst     = omap4_pwrdm_set_mem_onst,
-       .pwrdm_set_mem_retst    = omap4_pwrdm_set_mem_retst,
-       .pwrdm_wait_transition  = omap4_pwrdm_wait_transition,
-};
index 2385c1f009ee32338db1508a71863801dbd6e60c..ba520d4f7c7bf45d81503497a01ae9d9f555b032 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 
+#include "soc.h"
 #include "powerdomain.h"
 #include "powerdomains2xxx_3xxx_data.h"
 
index 72df97482cc04f7eb95f8f5acfe87aa2372081e0..c7d355fafd24ef27b363e44fbc3220ffd13ab7c8 100644 (file)
 #define OMAP3430_EN_CORE_MASK                          (1 << 0)
 
 
-/*
- * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP
- * submodule to exit hardreset
- */
-#define MAX_MODULE_HARDRESET_WAIT              10000
 
 /*
  * Maximum time(us) it takes to output the signal WUCLKOUT of the last
  * microseconds on OMAP4, so this timeout may be too high.
  */
 #define MAX_IOPAD_LATCH_TIME                   100
-
 # ifndef __ASSEMBLER__
-extern void __iomem *prm_base;
-extern void __iomem *cm_base;
-extern void __iomem *cm2_base;
-extern void __iomem *prcm_mpu_base;
-
-#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
-extern void omap_prm_base_init(void);
-extern void omap_cm_base_init(void);
-#else
-static inline void omap_prm_base_init(void)
-{
-}
-static inline void omap_cm_base_init(void)
-{
-}
-#endif
 
 /**
  * struct omap_prcm_irq - describes a PRCM interrupt bit
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
deleted file mode 100644 (file)
index 0f51e03..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * linux/arch/arm/mach-omap2/prcm.c
- *
- * OMAP 24xx Power Reset and Clock Management (PRCM) functions
- *
- * Copyright (C) 2005 Nokia Corporation
- *
- * Written by Tony Lindgren <tony.lindgren@nokia.com>
- *
- * Copyright (C) 2007 Texas Instruments, Inc.
- * Rajendra Nayak <rnayak@ti.com>
- *
- * Some pieces of code Copyright (C) 2005 Texas Instruments, Inc.
- * Upgraded with OMAP4 support by Abhijit Pagare <abhijitpagare@ti.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/delay.h>
-#include <linux/export.h>
-
-#include "common.h"
-#include <plat/prcm.h>
-
-#include "clock.h"
-#include "clock2xxx.h"
-#include "cm2xxx_3xxx.h"
-#include "prm2xxx_3xxx.h"
-#include "prm44xx.h"
-#include "prminst44xx.h"
-#include "cminst44xx.h"
-#include "prm-regbits-24xx.h"
-#include "prm-regbits-44xx.h"
-#include "control.h"
-
-void __iomem *prm_base;
-void __iomem *cm_base;
-void __iomem *cm2_base;
-void __iomem *prcm_mpu_base;
-
-#define MAX_MODULE_ENABLE_WAIT         100000
-
-u32 omap_prcm_get_reset_sources(void)
-{
-       /* XXX This presumably needs modification for 34XX */
-       if (cpu_is_omap24xx() || cpu_is_omap34xx())
-               return omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST) & 0x7f;
-       if (cpu_is_omap44xx())
-               return omap2_prm_read_mod_reg(WKUP_MOD, OMAP4_RM_RSTST) & 0x7f;
-
-       return 0;
-}
-EXPORT_SYMBOL(omap_prcm_get_reset_sources);
-
-/* Resets clock rates and reboots the system. Only called from system.h */
-void omap_prcm_restart(char mode, const char *cmd)
-{
-       s16 prcm_offs = 0;
-
-       if (cpu_is_omap24xx()) {
-               omap2xxx_clk_prepare_for_reboot();
-
-               prcm_offs = WKUP_MOD;
-       } else if (cpu_is_omap34xx()) {
-               prcm_offs = OMAP3430_GR_MOD;
-               omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
-       } else if (cpu_is_omap44xx()) {
-               omap4_prminst_global_warm_sw_reset(); /* never returns */
-       } else {
-               WARN_ON(1);
-       }
-
-       /*
-        * As per Errata i520, in some cases, user will not be able to
-        * access DDR memory after warm-reset.
-        * This situation occurs while the warm-reset happens during a read
-        * access to DDR memory. In that particular condition, DDR memory
-        * does not respond to a corrupted read command due to the warm
-        * reset occurrence but SDRC is waiting for read completion.
-        * SDRC is not sensitive to the warm reset, but the interconnect is
-        * reset on the fly, thus causing a misalignment between SDRC logic,
-        * interconnect logic and DDR memory state.
-        * WORKAROUND:
-        * Steps to perform before a Warm reset is trigged:
-        * 1. enable self-refresh on idle request
-        * 2. put SDRC in idle
-        * 3. wait until SDRC goes to idle
-        * 4. generate SW reset (Global SW reset)
-        *
-        * Steps to be performed after warm reset occurs (in bootloader):
-        * if HW warm reset is the source, apply below steps before any
-        * accesses to SDRAM:
-        * 1. Reset SMS and SDRC and wait till reset is complete
-        * 2. Re-initialize SMS, SDRC and memory
-        *
-        * NOTE: Above work around is required only if arch reset is implemented
-        * using Global SW reset(GLOBAL_SW_RST). DPLL3 reset does not need
-        * the WA since it resets SDRC as well as part of cold reset.
-        */
-
-       /* XXX should be moved to some OMAP2/3 specific code */
-       omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, prcm_offs,
-                                  OMAP2_RM_RSTCTRL);
-       omap2_prm_read_mod_reg(prcm_offs, OMAP2_RM_RSTCTRL); /* OCP barrier */
-}
-
-/**
- * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness
- * @reg: physical address of module IDLEST register
- * @mask: value to mask against to determine if the module is active
- * @idlest: idle state indicator (0 or 1) for the clock
- * @name: name of the clock (for printk)
- *
- * Returns 1 if the module indicated readiness in time, or 0 if it
- * failed to enable in roughly MAX_MODULE_ENABLE_WAIT microseconds.
- *
- * XXX This function is deprecated.  It should be removed once the
- * hwmod conversion is complete.
- */
-int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
-                               const char *name)
-{
-       int i = 0;
-       int ena = 0;
-
-       if (idlest)
-               ena = 0;
-       else
-               ena = mask;
-
-       /* Wait for lock */
-       omap_test_timeout(((__raw_readl(reg) & mask) == ena),
-                         MAX_MODULE_ENABLE_WAIT, i);
-
-       if (i < MAX_MODULE_ENABLE_WAIT)
-               pr_debug("cm: Module associated with clock %s ready after %d loops\n",
-                        name, i);
-       else
-               pr_err("cm: Module associated with clock %s didn't enable in %d tries\n",
-                      name, MAX_MODULE_ENABLE_WAIT);
-
-       return (i < MAX_MODULE_ENABLE_WAIT) ? 1 : 0;
-};
-
-void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
-{
-       if (omap2_globals->prm)
-               prm_base = omap2_globals->prm;
-       if (omap2_globals->cm)
-               cm_base = omap2_globals->cm;
-       if (omap2_globals->cm2)
-               cm2_base = omap2_globals->cm2;
-       if (omap2_globals->prcm_mpu)
-               prcm_mpu_base = omap2_globals->prcm_mpu;
-
-       if (cpu_is_omap44xx() || soc_is_omap54xx()) {
-               omap_prm_base_init();
-               omap_cm_base_init();
-       }
-}
-
-/*
- * Stubbed functions so that common files continue to build when
- * custom builds are used
- * XXX These are temporary and should be removed at the earliest possible
- * opportunity
- */
-int __weak omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
-                                       u16 clkctrl_offs)
-{
-       return 0;
-}
-
-void __weak omap4_cminst_module_enable(u8 mode, u8 part, u16 inst,
-                               s16 cdoffs, u16 clkctrl_offs)
-{
-}
-
-void __weak omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
-                                u16 clkctrl_offs)
-{
-}
index 928dbd4f20ed7d7809eb21bd0abb061d944259d5..c30e44a7fab082baca6bc8f802082de11a7c21ff 100644 (file)
 #include "prcm_mpu44xx.h"
 #include "cm-regbits-44xx.h"
 
+/*
+ * prcm_mpu_base: the virtual address of the start of the PRCM_MPU IP
+ *   block registers
+ */
+void __iomem *prcm_mpu_base;
+
 /* PRCM_MPU low-level functions */
 
 u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg)
@@ -43,3 +49,14 @@ u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
 
        return v;
 }
+
+/**
+ * omap2_set_globals_prcm_mpu - set the MPU PRCM base address (for early use)
+ * @prcm_mpu: PRCM_MPU base virtual address
+ *
+ * XXX Will be replaced when the PRM/CM drivers are completed.
+ */
+void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu)
+{
+       prcm_mpu_base = prcm_mpu;
+}
index 8a6e250f04b50a023e485df50fe2c1f21a1dc55f..884af7bb4afd952b67a55e70fb06dc1457c4292d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP44xx PRCM MPU instance offset macros
  *
- * Copyright (C) 2010 Texas Instruments, Inc.
+ * Copyright (C) 2010, 2012 Texas Instruments, Inc.
  * Copyright (C) 2010 Nokia Corporation
  *
  * Paul Walmsley (paul@pwsan.com)
 #ifndef __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H
 #define __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H
 
+#include "common.h"
+
+# ifndef __ASSEMBLER__
+extern void __iomem *prcm_mpu_base;
+# endif
+
 #define OMAP4430_PRCM_MPU_BASE                 0x48243000
 
 #define OMAP44XX_PRCM_MPU_REGADDR(inst, reg)                           \
@@ -98,6 +104,7 @@ extern u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 idx);
 extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx);
 extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,
                                            s16 idx);
+extern void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu);
 # endif
 
 #endif
index 6ac966103f341c1d17b9b0d3362a5782f85c7202..638da6dd41c318d8038caecff47627770dbf6c08 100644 (file)
@@ -14,7 +14,7 @@
  * published by the Free Software Foundation.
  */
 
-#include "prm2xxx_3xxx.h"
+#include "prm2xxx.h"
 
 /* Bits shared between registers */
 
 
 /* RM_RSTST_WKUP specific bits */
 /* 2430 calls EXTWMPU_RST "EXTWARM_RST" and GLOBALWMPU_RST "GLOBALWARM_RST" */
+#define OMAP24XX_EXTWMPU_RST_SHIFT                     6
 #define OMAP24XX_EXTWMPU_RST_MASK                      (1 << 6)
+#define OMAP24XX_SECU_WD_RST_SHIFT                     5
 #define OMAP24XX_SECU_WD_RST_MASK                      (1 << 5)
+#define OMAP24XX_MPU_WD_RST_SHIFT                      4
 #define OMAP24XX_MPU_WD_RST_MASK                       (1 << 4)
+#define OMAP24XX_SECU_VIOL_RST_SHIFT                   3
 #define OMAP24XX_SECU_VIOL_RST_MASK                    (1 << 3)
 
 /* PM_WKEN_WKUP specific bits */
index 64c087af6a8b72694cf0969ae08b090e5ebb49bf..838b594d4e13f546ac45d32fa84218216fea76ca 100644 (file)
@@ -14,7 +14,7 @@
 #define __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_34XX_H
 
 
-#include "prm2xxx_3xxx.h"
+#include "prm3xxx.h"
 
 /* Shared register bits */
 
 #define OMAP3430_RSTTIME1_MASK                         (0xff << 0)
 
 /* PRM_RSTST */
+#define OMAP3430_ICECRUSHER_RST_SHIFT                  10
 #define OMAP3430_ICECRUSHER_RST_MASK                   (1 << 10)
+#define OMAP3430_ICEPICK_RST_SHIFT                     9
 #define OMAP3430_ICEPICK_RST_MASK                      (1 << 9)
+#define OMAP3430_VDD2_VOLTAGE_MANAGER_RST_SHIFT                8
 #define OMAP3430_VDD2_VOLTAGE_MANAGER_RST_MASK         (1 << 8)
+#define OMAP3430_VDD1_VOLTAGE_MANAGER_RST_SHIFT                7
 #define OMAP3430_VDD1_VOLTAGE_MANAGER_RST_MASK         (1 << 7)
+#define OMAP3430_EXTERNAL_WARM_RST_SHIFT               6
 #define OMAP3430_EXTERNAL_WARM_RST_MASK                        (1 << 6)
+#define OMAP3430_SECURE_WD_RST_SHIFT                   5
 #define OMAP3430_SECURE_WD_RST_MASK                    (1 << 5)
+#define OMAP3430_MPU_WD_RST_SHIFT                      4
 #define OMAP3430_MPU_WD_RST_MASK                       (1 << 4)
+#define OMAP3430_SECURITY_VIOL_RST_SHIFT               3
 #define OMAP3430_SECURITY_VIOL_RST_MASK                        (1 << 3)
+#define OMAP3430_GLOBAL_SW_RST_SHIFT                   1
 #define OMAP3430_GLOBAL_SW_RST_MASK                    (1 << 1)
+#define OMAP3430_GLOBAL_COLD_RST_SHIFT                 0
 #define OMAP3430_GLOBAL_COLD_RST_MASK                  (1 << 0)
 
 /* PRM_VOLTCTRL */
index 39d562169d185d11a3a3d5aebcaa541754423dea..a1a266ce90dac1e2e0874128f2ea260b3b979dff 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP2/3/4 Power/Reset Management (PRM) bitfield definitions
  *
- * Copyright (C) 2007-2009 Texas Instruments, Inc.
+ * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
  * Copyright (C) 2010 Nokia Corporation
  *
  * Paul Walmsley
 
 #include "prcm-common.h"
 
+# ifndef __ASSEMBLER__
+extern void __iomem *prm_base;
+extern void omap2_set_globals_prm(void __iomem *prm);
+# endif
+
+
+/*
+ * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP
+ * module to softreset
+ */
+#define MAX_MODULE_SOFTRESET_WAIT              10000
+
+/*
+ * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP
+ * submodule to exit hardreset
+ */
+#define MAX_MODULE_HARDRESET_WAIT              10000
+
+/*
+ * Register bitfields
+ */
+
 /*
  * 24XX: PM_PWSTST_CORE, PM_PWSTST_GFX, PM_PWSTST_MPU, PM_PWSTST_DSP
  *
 #define OMAP_POWERSTATE_SHIFT                          0
 #define OMAP_POWERSTATE_MASK                           (0x3 << 0)
 
+/*
+ * Standardized OMAP reset source bits
+ *
+ * To the extent these happen to match the hardware register bit
+ * shifts, it's purely coincidental.  Used by omap-wdt.c.
+ * OMAP_UNKNOWN_RST_SRC_ID_SHIFT is a special value, used whenever
+ * there are any bits remaining in the global PRM_RSTST register that
+ * haven't been identified, or when the PRM code for the current SoC
+ * doesn't know how to interpret the register.
+ */
+#define OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT                      0
+#define OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT                      1
+#define OMAP_SECU_VIOL_RST_SRC_ID_SHIFT                                2
+#define OMAP_MPU_WD_RST_SRC_ID_SHIFT                           3
+#define OMAP_SECU_WD_RST_SRC_ID_SHIFT                          4
+#define OMAP_EXTWARM_RST_SRC_ID_SHIFT                          5
+#define OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT                       6
+#define OMAP_VDD_IVA_VM_RST_SRC_ID_SHIFT                       7
+#define OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT                      8
+#define OMAP_ICEPICK_RST_SRC_ID_SHIFT                          9
+#define OMAP_ICECRUSHER_RST_SRC_ID_SHIFT                       10
+#define OMAP_C2C_RST_SRC_ID_SHIFT                              11
+#define OMAP_UNKNOWN_RST_SRC_ID_SHIFT                          12
+
+#ifndef __ASSEMBLER__
+
+/**
+ * struct prm_reset_src_map - map register bitshifts to standard bitshifts
+ * @reg_shift: bitshift in the PRM reset source register
+ * @std_shift: bitshift equivalent in the standard reset source list
+ *
+ * The fields are signed because -1 is used as a terminator.
+ */
+struct prm_reset_src_map {
+       s8 reg_shift;
+       s8 std_shift;
+};
+
+/**
+ * struct prm_ll_data - fn ptrs to per-SoC PRM function implementations
+ * @read_reset_sources: ptr to the Soc PRM-specific get_reset_source impl
+ */
+struct prm_ll_data {
+       u32 (*read_reset_sources)(void);
+};
+
+extern int prm_register(struct prm_ll_data *pld);
+extern int prm_unregister(struct prm_ll_data *pld);
+
+extern u32 prm_read_reset_sources(void);
+
+#endif
+
 
 #endif
diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c
new file mode 100644 (file)
index 0000000..bf24fc4
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * OMAP2xxx PRM module functions
+ *
+ * Copyright (C) 2010-2012 Texas Instruments, Inc.
+ * Copyright (C) 2010 Nokia Corporation
+ * Benoît Cousson
+ * Paul Walmsley
+ * Rajendra Nayak <rnayak@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+
+#include "common.h"
+#include <plat/cpu.h>
+
+#include "vp.h"
+#include "powerdomain.h"
+#include "clockdomain.h"
+#include "prm2xxx.h"
+#include "cm2xxx_3xxx.h"
+#include "prm-regbits-24xx.h"
+
+/*
+ * omap2xxx_prm_reset_src_map - map from bits in the PRM_RSTST_WKUP
+ *   hardware register (which are specific to the OMAP2xxx SoCs) to
+ *   reset source ID bit shifts (which is an OMAP SoC-independent
+ *   enumeration)
+ */
+static struct prm_reset_src_map omap2xxx_prm_reset_src_map[] = {
+       { OMAP_GLOBALCOLD_RST_SHIFT, OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT },
+       { OMAP_GLOBALWARM_RST_SHIFT, OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT },
+       { OMAP24XX_SECU_VIOL_RST_SHIFT, OMAP_SECU_VIOL_RST_SRC_ID_SHIFT },
+       { OMAP24XX_MPU_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
+       { OMAP24XX_SECU_WD_RST_SHIFT, OMAP_SECU_WD_RST_SRC_ID_SHIFT },
+       { OMAP24XX_EXTWMPU_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT },
+       { -1, -1 },
+};
+
+/**
+ * omap2xxx_prm_read_reset_sources - return the last SoC reset source
+ *
+ * Return a u32 representing the last reset sources of the SoC.  The
+ * returned reset source bits are standardized across OMAP SoCs.
+ */
+static u32 omap2xxx_prm_read_reset_sources(void)
+{
+       struct prm_reset_src_map *p;
+       u32 r = 0;
+       u32 v;
+
+       v = omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST);
+
+       p = omap2xxx_prm_reset_src_map;
+       while (p->reg_shift >= 0 && p->std_shift >= 0) {
+               if (v & (1 << p->reg_shift))
+                       r |= 1 << p->std_shift;
+               p++;
+       }
+
+       return r;
+}
+
+/**
+ * omap2xxx_prm_dpll_reset - use DPLL reset to reboot the OMAP SoC
+ *
+ * Set the DPLL reset bit, which should reboot the SoC.  This is the
+ * recommended way to restart the SoC.  No return value.
+ */
+void omap2xxx_prm_dpll_reset(void)
+{
+       omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, WKUP_MOD,
+                                  OMAP2_RM_RSTCTRL);
+       /* OCP barrier */
+       omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTCTRL);
+}
+
+int omap2xxx_clkdm_sleep(struct clockdomain *clkdm)
+{
+       omap2_prm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
+                                  clkdm->pwrdm.ptr->prcm_offs,
+                                  OMAP2_PM_PWSTCTRL);
+       return 0;
+}
+
+int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm)
+{
+       omap2_prm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
+                                    clkdm->pwrdm.ptr->prcm_offs,
+                                    OMAP2_PM_PWSTCTRL);
+       return 0;
+}
+
+struct pwrdm_ops omap2_pwrdm_operations = {
+       .pwrdm_set_next_pwrst   = omap2_pwrdm_set_next_pwrst,
+       .pwrdm_read_next_pwrst  = omap2_pwrdm_read_next_pwrst,
+       .pwrdm_read_pwrst       = omap2_pwrdm_read_pwrst,
+       .pwrdm_set_logic_retst  = omap2_pwrdm_set_logic_retst,
+       .pwrdm_set_mem_onst     = omap2_pwrdm_set_mem_onst,
+       .pwrdm_set_mem_retst    = omap2_pwrdm_set_mem_retst,
+       .pwrdm_read_mem_pwrst   = omap2_pwrdm_read_mem_pwrst,
+       .pwrdm_read_mem_retst   = omap2_pwrdm_read_mem_retst,
+       .pwrdm_wait_transition  = omap2_pwrdm_wait_transition,
+};
+
+/*
+ *
+ */
+
+static struct prm_ll_data omap2xxx_prm_ll_data = {
+       .read_reset_sources = &omap2xxx_prm_read_reset_sources,
+};
+
+static int __init omap2xxx_prm_init(void)
+{
+       if (!cpu_is_omap24xx())
+               return 0;
+
+       return prm_register(&omap2xxx_prm_ll_data);
+}
+subsys_initcall(omap2xxx_prm_init);
+
+static void __exit omap2xxx_prm_exit(void)
+{
+       if (!cpu_is_omap24xx())
+               return;
+
+       /* Should never happen */
+       WARN(prm_unregister(&omap2xxx_prm_ll_data),
+            "%s: prm_ll_data function pointer mismatch\n", __func__);
+}
+__exitcall(omap2xxx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm2xxx.h b/arch/arm/mach-omap2/prm2xxx.h
new file mode 100644 (file)
index 0000000..fe8a14f
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * OMAP2xxx Power/Reset Management (PRM) register definitions
+ *
+ * Copyright (C) 2007-2009, 2011-2012 Texas Instruments, Inc.
+ * Copyright (C) 2008-2010 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ *
+ * The PRM hardware modules on the OMAP2/3 are quite similar to each
+ * other.  The PRM on OMAP4 has a new register layout, and is handled
+ * in a separate file.
+ */
+#ifndef __ARCH_ARM_MACH_OMAP2_PRM2XXX_H
+#define __ARCH_ARM_MACH_OMAP2_PRM2XXX_H
+
+#include "prcm-common.h"
+#include "prm.h"
+#include "prm2xxx_3xxx.h"
+
+#define OMAP2420_PRM_REGADDR(module, reg)                              \
+               OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg))
+#define OMAP2430_PRM_REGADDR(module, reg)                              \
+               OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg))
+
+/*
+ * OMAP2-specific global PRM registers
+ * Use __raw_{read,write}l() with these registers.
+ *
+ * With a few exceptions, these are the register names beginning with
+ * PRCM_* on 24xx.  (The exceptions are the IRQSTATUS and IRQENABLE
+ * bits.)
+ *
+ */
+
+#define OMAP2_PRCM_REVISION_OFFSET     0x0000
+#define OMAP2420_PRCM_REVISION         OMAP2420_PRM_REGADDR(OCP_MOD, 0x0000)
+#define OMAP2_PRCM_SYSCONFIG_OFFSET    0x0010
+#define OMAP2420_PRCM_SYSCONFIG                OMAP2420_PRM_REGADDR(OCP_MOD, 0x0010)
+
+#define OMAP2_PRCM_IRQSTATUS_MPU_OFFSET        0x0018
+#define OMAP2420_PRCM_IRQSTATUS_MPU    OMAP2420_PRM_REGADDR(OCP_MOD, 0x0018)
+#define OMAP2_PRCM_IRQENABLE_MPU_OFFSET        0x001c
+#define OMAP2420_PRCM_IRQENABLE_MPU    OMAP2420_PRM_REGADDR(OCP_MOD, 0x001c)
+
+#define OMAP2_PRCM_VOLTCTRL_OFFSET     0x0050
+#define OMAP2420_PRCM_VOLTCTRL         OMAP2420_PRM_REGADDR(OCP_MOD, 0x0050)
+#define OMAP2_PRCM_VOLTST_OFFSET       0x0054
+#define OMAP2420_PRCM_VOLTST           OMAP2420_PRM_REGADDR(OCP_MOD, 0x0054)
+#define OMAP2_PRCM_CLKSRC_CTRL_OFFSET  0x0060
+#define OMAP2420_PRCM_CLKSRC_CTRL      OMAP2420_PRM_REGADDR(OCP_MOD, 0x0060)
+#define OMAP2_PRCM_CLKOUT_CTRL_OFFSET  0x0070
+#define OMAP2420_PRCM_CLKOUT_CTRL      OMAP2420_PRM_REGADDR(OCP_MOD, 0x0070)
+#define OMAP2_PRCM_CLKEMUL_CTRL_OFFSET 0x0078
+#define OMAP2420_PRCM_CLKEMUL_CTRL     OMAP2420_PRM_REGADDR(OCP_MOD, 0x0078)
+#define OMAP2_PRCM_CLKCFG_CTRL_OFFSET  0x0080
+#define OMAP2420_PRCM_CLKCFG_CTRL      OMAP2420_PRM_REGADDR(OCP_MOD, 0x0080)
+#define OMAP2_PRCM_CLKCFG_STATUS_OFFSET        0x0084
+#define OMAP2420_PRCM_CLKCFG_STATUS    OMAP2420_PRM_REGADDR(OCP_MOD, 0x0084)
+#define OMAP2_PRCM_VOLTSETUP_OFFSET    0x0090
+#define OMAP2420_PRCM_VOLTSETUP                OMAP2420_PRM_REGADDR(OCP_MOD, 0x0090)
+#define OMAP2_PRCM_CLKSSETUP_OFFSET    0x0094
+#define OMAP2420_PRCM_CLKSSETUP                OMAP2420_PRM_REGADDR(OCP_MOD, 0x0094)
+#define OMAP2_PRCM_POLCTRL_OFFSET      0x0098
+#define OMAP2420_PRCM_POLCTRL          OMAP2420_PRM_REGADDR(OCP_MOD, 0x0098)
+
+#define OMAP2430_PRCM_REVISION         OMAP2430_PRM_REGADDR(OCP_MOD, 0x0000)
+#define OMAP2430_PRCM_SYSCONFIG                OMAP2430_PRM_REGADDR(OCP_MOD, 0x0010)
+
+#define OMAP2430_PRCM_IRQSTATUS_MPU    OMAP2430_PRM_REGADDR(OCP_MOD, 0x0018)
+#define OMAP2430_PRCM_IRQENABLE_MPU    OMAP2430_PRM_REGADDR(OCP_MOD, 0x001c)
+
+#define OMAP2430_PRCM_VOLTCTRL         OMAP2430_PRM_REGADDR(OCP_MOD, 0x0050)
+#define OMAP2430_PRCM_VOLTST           OMAP2430_PRM_REGADDR(OCP_MOD, 0x0054)
+#define OMAP2430_PRCM_CLKSRC_CTRL      OMAP2430_PRM_REGADDR(OCP_MOD, 0x0060)
+#define OMAP2430_PRCM_CLKOUT_CTRL      OMAP2430_PRM_REGADDR(OCP_MOD, 0x0070)
+#define OMAP2430_PRCM_CLKEMUL_CTRL     OMAP2430_PRM_REGADDR(OCP_MOD, 0x0078)
+#define OMAP2430_PRCM_CLKCFG_CTRL      OMAP2430_PRM_REGADDR(OCP_MOD, 0x0080)
+#define OMAP2430_PRCM_CLKCFG_STATUS    OMAP2430_PRM_REGADDR(OCP_MOD, 0x0084)
+#define OMAP2430_PRCM_VOLTSETUP                OMAP2430_PRM_REGADDR(OCP_MOD, 0x0090)
+#define OMAP2430_PRCM_CLKSSETUP                OMAP2430_PRM_REGADDR(OCP_MOD, 0x0094)
+#define OMAP2430_PRCM_POLCTRL          OMAP2430_PRM_REGADDR(OCP_MOD, 0x0098)
+
+/*
+ * Module specific PRM register offsets from PRM_BASE + domain offset
+ *
+ * Use prm_{read,write}_mod_reg() with these registers.
+ *
+ * With a few exceptions, these are the register names beginning with
+ * {PM,RM}_* on both OMAP2/3 SoC families..  (The exceptions are the
+ * IRQSTATUS and IRQENABLE bits.)
+ */
+
+/* Register offsets appearing on both OMAP2 and OMAP3 */
+
+#define OMAP2_RM_RSTCTRL                               0x0050
+#define OMAP2_RM_RSTTIME                               0x0054
+#define OMAP2_RM_RSTST                                 0x0058
+#define OMAP2_PM_PWSTCTRL                              0x00e0
+#define OMAP2_PM_PWSTST                                        0x00e4
+
+#define PM_WKEN                                                0x00a0
+#define PM_WKEN1                                       PM_WKEN
+#define PM_WKST                                                0x00b0
+#define PM_WKST1                                       PM_WKST
+#define PM_WKDEP                                       0x00c8
+#define PM_EVGENCTRL                                   0x00d4
+#define PM_EVGENONTIM                                  0x00d8
+#define PM_EVGENOFFTIM                                 0x00dc
+
+/* OMAP2xxx specific register offsets */
+#define OMAP24XX_PM_WKEN2                              0x00a4
+#define OMAP24XX_PM_WKST2                              0x00b4
+
+#define OMAP24XX_PRCM_IRQSTATUS_DSP                    0x00f0  /* IVA mod */
+#define OMAP24XX_PRCM_IRQENABLE_DSP                    0x00f4  /* IVA mod */
+#define OMAP24XX_PRCM_IRQSTATUS_IVA                    0x00f8
+#define OMAP24XX_PRCM_IRQENABLE_IVA                    0x00fc
+
+#ifndef __ASSEMBLER__
+/* Function prototypes */
+extern int omap2xxx_clkdm_sleep(struct clockdomain *clkdm);
+extern int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm);
+
+extern void omap2xxx_prm_dpll_reset(void);
+
+extern int __init prm2xxx_init(void);
+extern int __exit prm2xxx_exit(void);
+
+#endif
+
+#endif
index 9529984d8d2b10f6f40c5eecd720b01aba118525..30517f5af70708e360c140ef22374adc7560ec89 100644 (file)
 #include <linux/errno.h>
 #include <linux/err.h>
 #include <linux/io.h>
-#include <linux/irq.h>
 
-#include <plat/prcm.h>
-
-#include "soc.h"
 #include "common.h"
-#include "vp.h"
-
+#include "powerdomain.h"
 #include "prm2xxx_3xxx.h"
-#include "cm2xxx_3xxx.h"
 #include "prm-regbits-24xx.h"
-#include "prm-regbits-34xx.h"
-
-static const struct omap_prcm_irq omap3_prcm_irqs[] = {
-       OMAP_PRCM_IRQ("wkup",   0,      0),
-       OMAP_PRCM_IRQ("io",     9,      1),
-};
-
-static struct omap_prcm_irq_setup omap3_prcm_irq_setup = {
-       .ack                    = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
-       .mask                   = OMAP3_PRM_IRQENABLE_MPU_OFFSET,
-       .nr_regs                = 1,
-       .irqs                   = omap3_prcm_irqs,
-       .nr_irqs                = ARRAY_SIZE(omap3_prcm_irqs),
-       .irq                    = 11 + OMAP_INTC_START,
-       .read_pending_irqs      = &omap3xxx_prm_read_pending_irqs,
-       .ocp_barrier            = &omap3xxx_prm_ocp_barrier,
-       .save_and_clear_irqen   = &omap3xxx_prm_save_and_clear_irqen,
-       .restore_irqen          = &omap3xxx_prm_restore_irqen,
-};
-
-u32 omap2_prm_read_mod_reg(s16 module, u16 idx)
-{
-       return __raw_readl(prm_base + module + idx);
-}
-
-void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx)
-{
-       __raw_writel(val, prm_base + module + idx);
-}
-
-/* Read-modify-write a register in a PRM module. Caller must lock */
-u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
-{
-       u32 v;
-
-       v = omap2_prm_read_mod_reg(module, idx);
-       v &= ~mask;
-       v |= bits;
-       omap2_prm_write_mod_reg(v, module, idx);
-
-       return v;
-}
-
-/* Read a PRM register, AND it, and shift the result down to bit 0 */
-u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
-{
-       u32 v;
-
-       v = omap2_prm_read_mod_reg(domain, idx);
-       v &= mask;
-       v >>= __ffs(mask);
-
-       return v;
-}
-
-u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
-{
-       return omap2_prm_rmw_mod_reg_bits(bits, bits, module, idx);
-}
-
-u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
-{
-       return omap2_prm_rmw_mod_reg_bits(bits, 0x0, module, idx);
-}
-
+#include "clockdomain.h"
 
 /**
  * omap2_prm_is_hardreset_asserted - read the HW reset line state of
@@ -104,9 +34,6 @@ u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
  */
 int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift)
 {
-       if (!(cpu_is_omap24xx() || cpu_is_omap34xx()))
-               return -EINVAL;
-
        return omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL,
                                       (1 << shift));
 }
@@ -127,9 +54,6 @@ int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift)
 {
        u32 mask;
 
-       if (!(cpu_is_omap24xx() || cpu_is_omap34xx()))
-               return -EINVAL;
-
        mask = 1 << shift;
        omap2_prm_rmw_mod_reg_bits(mask, mask, prm_mod, OMAP2_RM_RSTCTRL);
 
@@ -156,9 +80,6 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift)
        u32 rst, st;
        int c;
 
-       if (!(cpu_is_omap24xx() || cpu_is_omap34xx()))
-               return -EINVAL;
-
        rst = 1 << rst_shift;
        st = 1 << st_shift;
 
@@ -178,188 +99,155 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift)
        return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
 }
 
-/* PRM VP */
-
-/*
- * struct omap3_vp - OMAP3 VP register access description.
- * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
- */
-struct omap3_vp {
-       u32 tranxdone_status;
-};
-
-static struct omap3_vp omap3_vp[] = {
-       [OMAP3_VP_VDD_MPU_ID] = {
-               .tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK,
-       },
-       [OMAP3_VP_VDD_CORE_ID] = {
-               .tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK,
-       },
-};
-
-#define MAX_VP_ID ARRAY_SIZE(omap3_vp);
-
-u32 omap3_prm_vp_check_txdone(u8 vp_id)
-{
-       struct omap3_vp *vp = &omap3_vp[vp_id];
-       u32 irqstatus;
 
-       irqstatus = omap2_prm_read_mod_reg(OCP_MOD,
-                                          OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
-       return irqstatus & vp->tranxdone_status;
-}
+/* Powerdomain low-level functions */
 
-void omap3_prm_vp_clear_txdone(u8 vp_id)
+/* Common functions across OMAP2 and OMAP3 */
+int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
 {
-       struct omap3_vp *vp = &omap3_vp[vp_id];
-
-       omap2_prm_write_mod_reg(vp->tranxdone_status,
-                               OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
+       omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
+                                  (pwrst << OMAP_POWERSTATE_SHIFT),
+                                  pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
+       return 0;
 }
 
-u32 omap3_prm_vcvp_read(u8 offset)
+int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
 {
-       return omap2_prm_read_mod_reg(OMAP3430_GR_MOD, offset);
+       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
+                                            OMAP2_PM_PWSTCTRL,
+                                            OMAP_POWERSTATE_MASK);
 }
 
-void omap3_prm_vcvp_write(u32 val, u8 offset)
+int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm)
 {
-       omap2_prm_write_mod_reg(val, OMAP3430_GR_MOD, offset);
+       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
+                                            OMAP2_PM_PWSTST,
+                                            OMAP_POWERSTATEST_MASK);
 }
 
-u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset)
+int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
+                                                               u8 pwrst)
 {
-       return omap2_prm_rmw_mod_reg_bits(mask, bits, OMAP3430_GR_MOD, offset);
+       u32 m;
+
+       m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
+
+       omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
+                                  OMAP2_PM_PWSTCTRL);
+
+       return 0;
 }
 
-/**
- * omap3xxx_prm_read_pending_irqs - read pending PRM MPU IRQs into @events
- * @events: ptr to a u32, preallocated by caller
- *
- * Read PRM_IRQSTATUS_MPU bits, AND'ed with the currently-enabled PRM
- * MPU IRQs, and store the result into the u32 pointed to by @events.
- * No return value.
- */
-void omap3xxx_prm_read_pending_irqs(unsigned long *events)
+int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
+                                                               u8 pwrst)
 {
-       u32 mask, st;
+       u32 m;
+
+       m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
 
-       /* XXX Can the mask read be avoided (e.g., can it come from RAM?) */
-       mask = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET);
-       st = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
+       omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
+                                  OMAP2_PM_PWSTCTRL);
 
-       events[0] = mask & st;
+       return 0;
 }
 
-/**
- * omap3xxx_prm_ocp_barrier - force buffered MPU writes to the PRM to complete
- *
- * Force any buffered writes to the PRM IP block to complete.  Needed
- * by the PRM IRQ handler, which reads and writes directly to the IP
- * block, to avoid race conditions after acknowledging or clearing IRQ
- * bits.  No return value.
- */
-void omap3xxx_prm_ocp_barrier(void)
+int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 {
-       omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET);
+       u32 m;
+
+       m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
+
+       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTST,
+                                            m);
 }
 
-/**
- * omap3xxx_prm_save_and_clear_irqen - save/clear PRM_IRQENABLE_MPU reg
- * @saved_mask: ptr to a u32 array to save IRQENABLE bits
- *
- * Save the PRM_IRQENABLE_MPU register to @saved_mask.  @saved_mask
- * must be allocated by the caller.  Intended to be used in the PRM
- * interrupt handler suspend callback.  The OCP barrier is needed to
- * ensure the write to disable PRM interrupts reaches the PRM before
- * returning; otherwise, spurious interrupts might occur.  No return
- * value.
- */
-void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask)
+int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
 {
-       saved_mask[0] = omap2_prm_read_mod_reg(OCP_MOD,
-                                              OMAP3_PRM_IRQENABLE_MPU_OFFSET);
-       omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET);
+       u32 m;
+
+       m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
 
-       /* OCP barrier */
-       omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET);
+       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
+                                            OMAP2_PM_PWSTCTRL, m);
 }
 
-/**
- * omap3xxx_prm_restore_irqen - set PRM_IRQENABLE_MPU register from args
- * @saved_mask: ptr to a u32 array of IRQENABLE bits saved previously
- *
- * Restore the PRM_IRQENABLE_MPU register from @saved_mask.  Intended
- * to be used in the PRM interrupt handler resume callback to restore
- * values saved by omap3xxx_prm_save_and_clear_irqen().  No OCP
- * barrier should be needed here; any pending PRM interrupts will fire
- * once the writes reach the PRM.  No return value.
- */
-void omap3xxx_prm_restore_irqen(u32 *saved_mask)
+int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
 {
-       omap2_prm_write_mod_reg(saved_mask[0], OCP_MOD,
-                               OMAP3_PRM_IRQENABLE_MPU_OFFSET);
+       u32 v;
+
+       v = pwrst << __ffs(OMAP_LOGICRETSTATE_MASK);
+       omap2_prm_rmw_mod_reg_bits(OMAP_LOGICRETSTATE_MASK, v, pwrdm->prcm_offs,
+                                  OMAP2_PM_PWSTCTRL);
+
+       return 0;
 }
 
-/**
- * omap3xxx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain
- *
- * Clear any previously-latched I/O wakeup events and ensure that the
- * I/O wakeup gates are aligned with the current mux settings.  Works
- * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then
- * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit.  No
- * return value.
- */
-void omap3xxx_prm_reconfigure_io_chain(void)
+int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm)
 {
-       int i = 0;
+       u32 c = 0;
 
-       omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
-                                  PM_WKEN);
+       /*
+        * REVISIT: pwrdm_wait_transition() may be better implemented
+        * via a callback and a periodic timer check -- how long do we expect
+        * powerdomain transitions to take?
+        */
 
-       omap_test_timeout(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) &
-                         OMAP3430_ST_IO_CHAIN_MASK,
-                         MAX_IOPAD_LATCH_TIME, i);
-       if (i == MAX_IOPAD_LATCH_TIME)
-               pr_warn("PRM: I/O chain clock line assertion timed out\n");
+       /* XXX Is this udelay() value meaningful? */
+       while ((omap2_prm_read_mod_reg(pwrdm->prcm_offs, OMAP2_PM_PWSTST) &
+               OMAP_INTRANSITION_MASK) &&
+               (c++ < PWRDM_TRANSITION_BAILOUT))
+                       udelay(1);
 
-       omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
-                                    PM_WKEN);
+       if (c > PWRDM_TRANSITION_BAILOUT) {
+               pr_err("powerdomain: %s: waited too long to complete transition\n",
+                      pwrdm->name);
+               return -EAGAIN;
+       }
 
-       omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK, WKUP_MOD,
-                                  PM_WKST);
+       pr_debug("powerdomain: completed transition in %d loops\n", c);
 
-       omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST);
+       return 0;
 }
 
-/**
- * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches
- *
- * Activates the I/O wakeup event latches and allows events logged by
- * those latches to signal a wakeup event to the PRCM.  For I/O
- * wakeups to occur, WAKEUPENABLE bits must be set in the pad mux
- * registers, and omap3xxx_prm_reconfigure_io_chain() must be called.
- * No return value.
- */
-static void __init omap3xxx_prm_enable_io_wakeup(void)
+int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
+                         struct clockdomain *clkdm2)
+{
+       omap2_prm_set_mod_reg_bits((1 << clkdm2->dep_bit),
+                                  clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
+       return 0;
+}
+
+int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1,
+                         struct clockdomain *clkdm2)
+{
+       omap2_prm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
+                                    clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
+       return 0;
+}
+
+int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1,
+                          struct clockdomain *clkdm2)
 {
-       if (omap3_has_io_wakeup())
-               omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
-                                          PM_WKEN);
+       return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
+                                            PM_WKDEP, (1 << clkdm2->dep_bit));
 }
 
-static int __init omap3xxx_prcm_init(void)
+int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm)
 {
-       int ret = 0;
-
-       if (cpu_is_omap34xx()) {
-               omap3xxx_prm_enable_io_wakeup();
-               ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup);
-               if (!ret)
-                       irq_set_status_flags(omap_prcm_event_to_irq("io"),
-                                            IRQ_NOAUTOEN);
+       struct clkdm_dep *cd;
+       u32 mask = 0;
+
+       for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
+               if (!cd->clkdm)
+                       continue; /* only happens if data is erroneous */
+
+               /* PRM accesses are slow, so minimize them */
+               mask |= 1 << cd->clkdm->dep_bit;
+               atomic_set(&cd->wkdep_usecount, 0);
        }
 
-       return ret;
+       omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
+                                    PM_WKDEP);
+       return 0;
 }
-subsys_initcall(omap3xxx_prcm_init);
+
index c19d249b481675557f36ebdf315b23c5752d1d4b..78532d6fecd71e6e04ff0f7283a458d1285eb1d7 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * OMAP2/3 Power/Reset Management (PRM) register definitions
+ * OMAP2xxx/3xxx-common Power/Reset Management (PRM) register definitions
  *
- * Copyright (C) 2007-2009, 2011 Texas Instruments, Inc.
+ * Copyright (C) 2007-2009, 2011-2012 Texas Instruments, Inc.
  * Copyright (C) 2008-2010 Nokia Corporation
  * Paul Walmsley
  *
 #include "prcm-common.h"
 #include "prm.h"
 
-#define OMAP2420_PRM_REGADDR(module, reg)                              \
-               OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg))
-#define OMAP2430_PRM_REGADDR(module, reg)                              \
-               OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg))
-#define OMAP34XX_PRM_REGADDR(module, reg)                              \
-               OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
-
-
-/*
- * OMAP2-specific global PRM registers
- * Use __raw_{read,write}l() with these registers.
- *
- * With a few exceptions, these are the register names beginning with
- * PRCM_* on 24xx.  (The exceptions are the IRQSTATUS and IRQENABLE
- * bits.)
- *
- */
-
-#define OMAP2_PRCM_REVISION_OFFSET     0x0000
-#define OMAP2420_PRCM_REVISION         OMAP2420_PRM_REGADDR(OCP_MOD, 0x0000)
-#define OMAP2_PRCM_SYSCONFIG_OFFSET    0x0010
-#define OMAP2420_PRCM_SYSCONFIG                OMAP2420_PRM_REGADDR(OCP_MOD, 0x0010)
-
-#define OMAP2_PRCM_IRQSTATUS_MPU_OFFSET        0x0018
-#define OMAP2420_PRCM_IRQSTATUS_MPU    OMAP2420_PRM_REGADDR(OCP_MOD, 0x0018)
-#define OMAP2_PRCM_IRQENABLE_MPU_OFFSET        0x001c
-#define OMAP2420_PRCM_IRQENABLE_MPU    OMAP2420_PRM_REGADDR(OCP_MOD, 0x001c)
-
-#define OMAP2_PRCM_VOLTCTRL_OFFSET     0x0050
-#define OMAP2420_PRCM_VOLTCTRL         OMAP2420_PRM_REGADDR(OCP_MOD, 0x0050)
-#define OMAP2_PRCM_VOLTST_OFFSET       0x0054
-#define OMAP2420_PRCM_VOLTST           OMAP2420_PRM_REGADDR(OCP_MOD, 0x0054)
-#define OMAP2_PRCM_CLKSRC_CTRL_OFFSET  0x0060
-#define OMAP2420_PRCM_CLKSRC_CTRL      OMAP2420_PRM_REGADDR(OCP_MOD, 0x0060)
-#define OMAP2_PRCM_CLKOUT_CTRL_OFFSET  0x0070
-#define OMAP2420_PRCM_CLKOUT_CTRL      OMAP2420_PRM_REGADDR(OCP_MOD, 0x0070)
-#define OMAP2_PRCM_CLKEMUL_CTRL_OFFSET 0x0078
-#define OMAP2420_PRCM_CLKEMUL_CTRL     OMAP2420_PRM_REGADDR(OCP_MOD, 0x0078)
-#define OMAP2_PRCM_CLKCFG_CTRL_OFFSET  0x0080
-#define OMAP2420_PRCM_CLKCFG_CTRL      OMAP2420_PRM_REGADDR(OCP_MOD, 0x0080)
-#define OMAP2_PRCM_CLKCFG_STATUS_OFFSET        0x0084
-#define OMAP2420_PRCM_CLKCFG_STATUS    OMAP2420_PRM_REGADDR(OCP_MOD, 0x0084)
-#define OMAP2_PRCM_VOLTSETUP_OFFSET    0x0090
-#define OMAP2420_PRCM_VOLTSETUP                OMAP2420_PRM_REGADDR(OCP_MOD, 0x0090)
-#define OMAP2_PRCM_CLKSSETUP_OFFSET    0x0094
-#define OMAP2420_PRCM_CLKSSETUP                OMAP2420_PRM_REGADDR(OCP_MOD, 0x0094)
-#define OMAP2_PRCM_POLCTRL_OFFSET      0x0098
-#define OMAP2420_PRCM_POLCTRL          OMAP2420_PRM_REGADDR(OCP_MOD, 0x0098)
-
-#define OMAP2430_PRCM_REVISION         OMAP2430_PRM_REGADDR(OCP_MOD, 0x0000)
-#define OMAP2430_PRCM_SYSCONFIG                OMAP2430_PRM_REGADDR(OCP_MOD, 0x0010)
-
-#define OMAP2430_PRCM_IRQSTATUS_MPU    OMAP2430_PRM_REGADDR(OCP_MOD, 0x0018)
-#define OMAP2430_PRCM_IRQENABLE_MPU    OMAP2430_PRM_REGADDR(OCP_MOD, 0x001c)
-
-#define OMAP2430_PRCM_VOLTCTRL         OMAP2430_PRM_REGADDR(OCP_MOD, 0x0050)
-#define OMAP2430_PRCM_VOLTST           OMAP2430_PRM_REGADDR(OCP_MOD, 0x0054)
-#define OMAP2430_PRCM_CLKSRC_CTRL      OMAP2430_PRM_REGADDR(OCP_MOD, 0x0060)
-#define OMAP2430_PRCM_CLKOUT_CTRL      OMAP2430_PRM_REGADDR(OCP_MOD, 0x0070)
-#define OMAP2430_PRCM_CLKEMUL_CTRL     OMAP2430_PRM_REGADDR(OCP_MOD, 0x0078)
-#define OMAP2430_PRCM_CLKCFG_CTRL      OMAP2430_PRM_REGADDR(OCP_MOD, 0x0080)
-#define OMAP2430_PRCM_CLKCFG_STATUS    OMAP2430_PRM_REGADDR(OCP_MOD, 0x0084)
-#define OMAP2430_PRCM_VOLTSETUP                OMAP2430_PRM_REGADDR(OCP_MOD, 0x0090)
-#define OMAP2430_PRCM_CLKSSETUP                OMAP2430_PRM_REGADDR(OCP_MOD, 0x0094)
-#define OMAP2430_PRCM_POLCTRL          OMAP2430_PRM_REGADDR(OCP_MOD, 0x0098)
-
-/*
- * OMAP3-specific global PRM registers
- * Use __raw_{read,write}l() with these registers.
- *
- * With a few exceptions, these are the register names beginning with
- * PRM_* on 34xx.  (The exceptions are the IRQSTATUS and IRQENABLE
- * bits.)
- */
-
-#define OMAP3_PRM_REVISION_OFFSET      0x0004
-#define OMAP3430_PRM_REVISION          OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0004)
-#define OMAP3_PRM_SYSCONFIG_OFFSET     0x0014
-#define OMAP3430_PRM_SYSCONFIG         OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0014)
-
-#define OMAP3_PRM_IRQSTATUS_MPU_OFFSET 0x0018
-#define OMAP3430_PRM_IRQSTATUS_MPU     OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0018)
-#define OMAP3_PRM_IRQENABLE_MPU_OFFSET 0x001c
-#define OMAP3430_PRM_IRQENABLE_MPU     OMAP34XX_PRM_REGADDR(OCP_MOD, 0x001c)
-
-
-#define OMAP3_PRM_VC_SMPS_SA_OFFSET    0x0020
-#define OMAP3430_PRM_VC_SMPS_SA                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0020)
-#define OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET        0x0024
-#define OMAP3430_PRM_VC_SMPS_VOL_RA    OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0024)
-#define OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET        0x0028
-#define OMAP3430_PRM_VC_SMPS_CMD_RA    OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0028)
-#define OMAP3_PRM_VC_CMD_VAL_0_OFFSET  0x002c
-#define OMAP3430_PRM_VC_CMD_VAL_0      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x002c)
-#define OMAP3_PRM_VC_CMD_VAL_1_OFFSET  0x0030
-#define OMAP3430_PRM_VC_CMD_VAL_1      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0030)
-#define OMAP3_PRM_VC_CH_CONF_OFFSET    0x0034
-#define OMAP3430_PRM_VC_CH_CONF                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0034)
-#define OMAP3_PRM_VC_I2C_CFG_OFFSET    0x0038
-#define OMAP3430_PRM_VC_I2C_CFG                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0038)
-#define OMAP3_PRM_VC_BYPASS_VAL_OFFSET 0x003c
-#define OMAP3430_PRM_VC_BYPASS_VAL     OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x003c)
-#define OMAP3_PRM_RSTCTRL_OFFSET       0x0050
-#define OMAP3430_PRM_RSTCTRL           OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0050)
-#define OMAP3_PRM_RSTTIME_OFFSET       0x0054
-#define OMAP3430_PRM_RSTTIME           OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0054)
-#define OMAP3_PRM_RSTST_OFFSET 0x0058
-#define OMAP3430_PRM_RSTST             OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0058)
-#define OMAP3_PRM_VOLTCTRL_OFFSET      0x0060
-#define OMAP3430_PRM_VOLTCTRL          OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0060)
-#define OMAP3_PRM_SRAM_PCHARGE_OFFSET  0x0064
-#define OMAP3430_PRM_SRAM_PCHARGE      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0064)
-#define OMAP3_PRM_CLKSRC_CTRL_OFFSET   0x0070
-#define OMAP3430_PRM_CLKSRC_CTRL       OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0070)
-#define OMAP3_PRM_VOLTSETUP1_OFFSET    0x0090
-#define OMAP3430_PRM_VOLTSETUP1                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0090)
-#define OMAP3_PRM_VOLTOFFSET_OFFSET    0x0094
-#define OMAP3430_PRM_VOLTOFFSET                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0094)
-#define OMAP3_PRM_CLKSETUP_OFFSET      0x0098
-#define OMAP3430_PRM_CLKSETUP          OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0098)
-#define OMAP3_PRM_POLCTRL_OFFSET       0x009c
-#define OMAP3430_PRM_POLCTRL           OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x009c)
-#define OMAP3_PRM_VOLTSETUP2_OFFSET    0x00a0
-#define OMAP3430_PRM_VOLTSETUP2                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00a0)
-#define OMAP3_PRM_VP1_CONFIG_OFFSET    0x00b0
-#define OMAP3430_PRM_VP1_CONFIG                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b0)
-#define OMAP3_PRM_VP1_VSTEPMIN_OFFSET  0x00b4
-#define OMAP3430_PRM_VP1_VSTEPMIN      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b4)
-#define OMAP3_PRM_VP1_VSTEPMAX_OFFSET  0x00b8
-#define OMAP3430_PRM_VP1_VSTEPMAX      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b8)
-#define OMAP3_PRM_VP1_VLIMITTO_OFFSET  0x00bc
-#define OMAP3430_PRM_VP1_VLIMITTO      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00bc)
-#define OMAP3_PRM_VP1_VOLTAGE_OFFSET   0x00c0
-#define OMAP3430_PRM_VP1_VOLTAGE       OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c0)
-#define OMAP3_PRM_VP1_STATUS_OFFSET    0x00c4
-#define OMAP3430_PRM_VP1_STATUS                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c4)
-#define OMAP3_PRM_VP2_CONFIG_OFFSET    0x00d0
-#define OMAP3430_PRM_VP2_CONFIG                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d0)
-#define OMAP3_PRM_VP2_VSTEPMIN_OFFSET  0x00d4
-#define OMAP3430_PRM_VP2_VSTEPMIN      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d4)
-#define OMAP3_PRM_VP2_VSTEPMAX_OFFSET  0x00d8
-#define OMAP3430_PRM_VP2_VSTEPMAX      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d8)
-#define OMAP3_PRM_VP2_VLIMITTO_OFFSET  0x00dc
-#define OMAP3430_PRM_VP2_VLIMITTO      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00dc)
-#define OMAP3_PRM_VP2_VOLTAGE_OFFSET   0x00e0
-#define OMAP3430_PRM_VP2_VOLTAGE       OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e0)
-#define OMAP3_PRM_VP2_STATUS_OFFSET    0x00e4
-#define OMAP3430_PRM_VP2_STATUS                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e4)
-
-#define OMAP3_PRM_CLKSEL_OFFSET        0x0040
-#define OMAP3430_PRM_CLKSEL            OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0040)
-#define OMAP3_PRM_CLKOUT_CTRL_OFFSET   0x0070
-#define OMAP3430_PRM_CLKOUT_CTRL       OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
-
 /*
  * Module specific PRM register offsets from PRM_BASE + domain offset
  *
 #define PM_EVGENONTIM                                  0x00d8
 #define PM_EVGENOFFTIM                                 0x00dc
 
-/* OMAP2xxx specific register offsets */
-#define OMAP24XX_PM_WKEN2                              0x00a4
-#define OMAP24XX_PM_WKST2                              0x00b4
-
-#define OMAP24XX_PRCM_IRQSTATUS_DSP                    0x00f0  /* IVA mod */
-#define OMAP24XX_PRCM_IRQENABLE_DSP                    0x00f4  /* IVA mod */
-#define OMAP24XX_PRCM_IRQSTATUS_IVA                    0x00f8
-#define OMAP24XX_PRCM_IRQENABLE_IVA                    0x00fc
 
-/* OMAP3 specific register offsets */
-#define OMAP3430ES2_PM_WKEN3                           0x00f0
-#define OMAP3430ES2_PM_WKST3                           0x00b8
-
-#define OMAP3430_PM_MPUGRPSEL                          0x00a4
-#define OMAP3430_PM_MPUGRPSEL1                         OMAP3430_PM_MPUGRPSEL
-#define OMAP3430ES2_PM_MPUGRPSEL3                      0x00f8
-
-#define OMAP3430_PM_IVAGRPSEL                          0x00a8
-#define OMAP3430_PM_IVAGRPSEL1                         OMAP3430_PM_IVAGRPSEL
-#define OMAP3430ES2_PM_IVAGRPSEL3                      0x00f4
-
-#define OMAP3430_PM_PREPWSTST                          0x00e8
-
-#define OMAP3430_PRM_IRQSTATUS_IVA2                    0x00f8
-#define OMAP3430_PRM_IRQENABLE_IVA2                    0x00fc
+#ifndef __ASSEMBLER__
 
+#include <linux/io.h>
+#include "powerdomain.h"
 
-#ifndef __ASSEMBLER__
 /* Power/reset management domain register get/set */
-extern u32 omap2_prm_read_mod_reg(s16 module, u16 idx);
-extern void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx);
-extern u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
-extern u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx);
-extern u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx);
-extern u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask);
+static inline u32 omap2_prm_read_mod_reg(s16 module, u16 idx)
+{
+       return __raw_readl(prm_base + module + idx);
+}
+
+static inline void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx)
+{
+       __raw_writel(val, prm_base + module + idx);
+}
+
+/* Read-modify-write a register in a PRM module. Caller must lock */
+static inline u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module,
+                                            s16 idx)
+{
+       u32 v;
+
+       v = omap2_prm_read_mod_reg(module, idx);
+       v &= ~mask;
+       v |= bits;
+       omap2_prm_write_mod_reg(v, module, idx);
+
+       return v;
+}
+
+/* Read a PRM register, AND it, and shift the result down to bit 0 */
+static inline u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
+{
+       u32 v;
+
+       v = omap2_prm_read_mod_reg(domain, idx);
+       v &= mask;
+       v >>= __ffs(mask);
+
+       return v;
+}
+
+static inline u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
+{
+       return omap2_prm_rmw_mod_reg_bits(bits, bits, module, idx);
+}
+
+static inline u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
+{
+       return omap2_prm_rmw_mod_reg_bits(bits, 0x0, module, idx);
+}
 
 /* These omap2_ PRM functions apply to both OMAP2 and 3 */
 extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift);
 extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift);
 extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift);
 
-/* OMAP3-specific VP functions */
-u32 omap3_prm_vp_check_txdone(u8 vp_id);
-void omap3_prm_vp_clear_txdone(u8 vp_id);
-
-/*
- * OMAP3 access functions for voltage controller (VC) and
- * voltage proccessor (VP) in the PRM.
- */
-extern u32 omap3_prm_vcvp_read(u8 offset);
-extern void omap3_prm_vcvp_write(u32 val, u8 offset);
-extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
-
-extern void omap3xxx_prm_reconfigure_io_chain(void);
-
-/* PRM interrupt-related functions */
-extern void omap3xxx_prm_read_pending_irqs(unsigned long *events);
-extern void omap3xxx_prm_ocp_barrier(void);
-extern void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask);
-extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
+extern int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst);
+extern int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm);
+extern int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm);
+extern int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
+                                   u8 pwrst);
+extern int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
+                                    u8 pwrst);
+extern int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank);
+extern int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank);
+extern int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst);
+extern int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm);
+
+extern int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
+                                struct clockdomain *clkdm2);
+extern int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1,
+                                struct clockdomain *clkdm2);
+extern int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1,
+                                 struct clockdomain *clkdm2);
+extern int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm);
 
 #endif /* __ASSEMBLER */
 
@@ -348,7 +211,9 @@ extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
  *
  * 3430: RM_RSTST_CORE, RM_RSTST_EMU
  */
+#define OMAP_GLOBALWARM_RST_SHIFT                      1
 #define OMAP_GLOBALWARM_RST_MASK                       (1 << 1)
+#define OMAP_GLOBALCOLD_RST_SHIFT                      0
 #define OMAP_GLOBALCOLD_RST_MASK                       (1 << 0)
 
 /*
@@ -376,11 +241,4 @@ extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
 #define OMAP_LOGICRETSTATE_MASK                                (1 << 2)
 
 
-/*
- * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP
- * submodule to exit hardreset
- */
-#define MAX_MODULE_HARDRESET_WAIT              10000
-
-
 #endif
index e7dbb6cf1255dd077aca1a4965dc9f59f659de24..1ac73883f8913c5894aff5f5267222c9f35343ee 100644 (file)
@@ -19,9 +19,8 @@
 #include <linux/err.h>
 #include <linux/io.h>
 
-#include <plat/common.h>
-
 #include "common.h"
+#include "powerdomain.h"
 #include "prm33xx.h"
 #include "prm-regbits-33xx.h"
 
@@ -133,3 +132,204 @@ int am33xx_prm_deassert_hardreset(u8 shift, s16 inst,
 
        return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
 }
+
+static int am33xx_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
+{
+       am33xx_prm_rmw_reg_bits(OMAP_POWERSTATE_MASK,
+                               (pwrst << OMAP_POWERSTATE_SHIFT),
+                               pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
+       return 0;
+}
+
+static int am33xx_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
+{
+       u32 v;
+
+       v = am33xx_prm_read_reg(pwrdm->prcm_offs,  pwrdm->pwrstctrl_offs);
+       v &= OMAP_POWERSTATE_MASK;
+       v >>= OMAP_POWERSTATE_SHIFT;
+
+       return v;
+}
+
+static int am33xx_pwrdm_read_pwrst(struct powerdomain *pwrdm)
+{
+       u32 v;
+
+       v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
+       v &= OMAP_POWERSTATEST_MASK;
+       v >>= OMAP_POWERSTATEST_SHIFT;
+
+       return v;
+}
+
+static int am33xx_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
+{
+       u32 v;
+
+       v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
+       v &= AM33XX_LASTPOWERSTATEENTERED_MASK;
+       v >>= AM33XX_LASTPOWERSTATEENTERED_SHIFT;
+
+       return v;
+}
+
+static int am33xx_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
+{
+       am33xx_prm_rmw_reg_bits(AM33XX_LOWPOWERSTATECHANGE_MASK,
+                               (1 << AM33XX_LOWPOWERSTATECHANGE_SHIFT),
+                               pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
+       return 0;
+}
+
+static int am33xx_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
+{
+       am33xx_prm_rmw_reg_bits(AM33XX_LASTPOWERSTATEENTERED_MASK,
+                               AM33XX_LASTPOWERSTATEENTERED_MASK,
+                               pwrdm->prcm_offs, pwrdm->pwrstst_offs);
+       return 0;
+}
+
+static int am33xx_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
+{
+       u32 m;
+
+       m = pwrdm->logicretstate_mask;
+       if (!m)
+               return -EINVAL;
+
+       am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
+                               pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
+
+       return 0;
+}
+
+static int am33xx_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
+{
+       u32 v;
+
+       v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
+       v &= AM33XX_LOGICSTATEST_MASK;
+       v >>= AM33XX_LOGICSTATEST_SHIFT;
+
+       return v;
+}
+
+static int am33xx_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
+{
+       u32 v, m;
+
+       m = pwrdm->logicretstate_mask;
+       if (!m)
+               return -EINVAL;
+
+       v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
+       v &= m;
+       v >>= __ffs(m);
+
+       return v;
+}
+
+static int am33xx_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
+               u8 pwrst)
+{
+       u32 m;
+
+       m = pwrdm->mem_on_mask[bank];
+       if (!m)
+               return -EINVAL;
+
+       am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
+                               pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
+
+       return 0;
+}
+
+static int am33xx_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
+                                       u8 pwrst)
+{
+       u32 m;
+
+       m = pwrdm->mem_ret_mask[bank];
+       if (!m)
+               return -EINVAL;
+
+       am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
+                               pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
+
+       return 0;
+}
+
+static int am33xx_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
+{
+       u32 m, v;
+
+       m = pwrdm->mem_pwrst_mask[bank];
+       if (!m)
+               return -EINVAL;
+
+       v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
+       v &= m;
+       v >>= __ffs(m);
+
+       return v;
+}
+
+static int am33xx_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
+{
+       u32 m, v;
+
+       m = pwrdm->mem_retst_mask[bank];
+       if (!m)
+               return -EINVAL;
+
+       v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
+       v &= m;
+       v >>= __ffs(m);
+
+       return v;
+}
+
+static int am33xx_pwrdm_wait_transition(struct powerdomain *pwrdm)
+{
+       u32 c = 0;
+
+       /*
+        * REVISIT: pwrdm_wait_transition() may be better implemented
+        * via a callback and a periodic timer check -- how long do we expect
+        * powerdomain transitions to take?
+        */
+
+       /* XXX Is this udelay() value meaningful? */
+       while ((am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs)
+                       & OMAP_INTRANSITION_MASK) &&
+                       (c++ < PWRDM_TRANSITION_BAILOUT))
+               udelay(1);
+
+       if (c > PWRDM_TRANSITION_BAILOUT) {
+               pr_err("powerdomain: %s: waited too long to complete transition\n",
+                      pwrdm->name);
+               return -EAGAIN;
+       }
+
+       pr_debug("powerdomain: completed transition in %d loops\n", c);
+
+       return 0;
+}
+
+struct pwrdm_ops am33xx_pwrdm_operations = {
+       .pwrdm_set_next_pwrst           = am33xx_pwrdm_set_next_pwrst,
+       .pwrdm_read_next_pwrst          = am33xx_pwrdm_read_next_pwrst,
+       .pwrdm_read_pwrst               = am33xx_pwrdm_read_pwrst,
+       .pwrdm_read_prev_pwrst          = am33xx_pwrdm_read_prev_pwrst,
+       .pwrdm_set_logic_retst          = am33xx_pwrdm_set_logic_retst,
+       .pwrdm_read_logic_pwrst         = am33xx_pwrdm_read_logic_pwrst,
+       .pwrdm_read_logic_retst         = am33xx_pwrdm_read_logic_retst,
+       .pwrdm_clear_all_prev_pwrst     = am33xx_pwrdm_clear_all_prev_pwrst,
+       .pwrdm_set_lowpwrstchange       = am33xx_pwrdm_set_lowpwrstchange,
+       .pwrdm_read_mem_pwrst           = am33xx_pwrdm_read_mem_pwrst,
+       .pwrdm_read_mem_retst           = am33xx_pwrdm_read_mem_retst,
+       .pwrdm_set_mem_onst             = am33xx_pwrdm_set_mem_onst,
+       .pwrdm_set_mem_retst            = am33xx_pwrdm_set_mem_retst,
+       .pwrdm_wait_transition          = am33xx_pwrdm_wait_transition,
+};
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
new file mode 100644 (file)
index 0000000..b86116c
--- /dev/null
@@ -0,0 +1,417 @@
+/*
+ * OMAP3xxx PRM module functions
+ *
+ * Copyright (C) 2010-2012 Texas Instruments, Inc.
+ * Copyright (C) 2010 Nokia Corporation
+ * Benoît Cousson
+ * Paul Walmsley
+ * Rajendra Nayak <rnayak@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+
+#include "common.h"
+#include <plat/cpu.h>
+
+#include "vp.h"
+#include "powerdomain.h"
+#include "prm3xxx.h"
+#include "prm2xxx_3xxx.h"
+#include "cm2xxx_3xxx.h"
+#include "prm-regbits-34xx.h"
+
+static const struct omap_prcm_irq omap3_prcm_irqs[] = {
+       OMAP_PRCM_IRQ("wkup",   0,      0),
+       OMAP_PRCM_IRQ("io",     9,      1),
+};
+
+static struct omap_prcm_irq_setup omap3_prcm_irq_setup = {
+       .ack                    = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
+       .mask                   = OMAP3_PRM_IRQENABLE_MPU_OFFSET,
+       .nr_regs                = 1,
+       .irqs                   = omap3_prcm_irqs,
+       .nr_irqs                = ARRAY_SIZE(omap3_prcm_irqs),
+       .irq                    = 11 + OMAP_INTC_START,
+       .read_pending_irqs      = &omap3xxx_prm_read_pending_irqs,
+       .ocp_barrier            = &omap3xxx_prm_ocp_barrier,
+       .save_and_clear_irqen   = &omap3xxx_prm_save_and_clear_irqen,
+       .restore_irqen          = &omap3xxx_prm_restore_irqen,
+};
+
+/*
+ * omap3_prm_reset_src_map - map from bits in the PRM_RSTST hardware
+ *   register (which are specific to OMAP3xxx SoCs) to reset source ID
+ *   bit shifts (which is an OMAP SoC-independent enumeration)
+ */
+static struct prm_reset_src_map omap3xxx_prm_reset_src_map[] = {
+       { OMAP3430_GLOBAL_COLD_RST_SHIFT, OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT },
+       { OMAP3430_GLOBAL_SW_RST_SHIFT, OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT },
+       { OMAP3430_SECURITY_VIOL_RST_SHIFT, OMAP_SECU_VIOL_RST_SRC_ID_SHIFT },
+       { OMAP3430_MPU_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
+       { OMAP3430_SECURE_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
+       { OMAP3430_EXTERNAL_WARM_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT },
+       { OMAP3430_VDD1_VOLTAGE_MANAGER_RST_SHIFT,
+         OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT },
+       { OMAP3430_VDD2_VOLTAGE_MANAGER_RST_SHIFT,
+         OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT },
+       { OMAP3430_ICEPICK_RST_SHIFT, OMAP_ICEPICK_RST_SRC_ID_SHIFT },
+       { OMAP3430_ICECRUSHER_RST_SHIFT, OMAP_ICECRUSHER_RST_SRC_ID_SHIFT },
+       { -1, -1 },
+};
+
+/* PRM VP */
+
+/*
+ * struct omap3_vp - OMAP3 VP register access description.
+ * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
+ */
+struct omap3_vp {
+       u32 tranxdone_status;
+};
+
+static struct omap3_vp omap3_vp[] = {
+       [OMAP3_VP_VDD_MPU_ID] = {
+               .tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK,
+       },
+       [OMAP3_VP_VDD_CORE_ID] = {
+               .tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK,
+       },
+};
+
+#define MAX_VP_ID ARRAY_SIZE(omap3_vp);
+
+u32 omap3_prm_vp_check_txdone(u8 vp_id)
+{
+       struct omap3_vp *vp = &omap3_vp[vp_id];
+       u32 irqstatus;
+
+       irqstatus = omap2_prm_read_mod_reg(OCP_MOD,
+                                          OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
+       return irqstatus & vp->tranxdone_status;
+}
+
+void omap3_prm_vp_clear_txdone(u8 vp_id)
+{
+       struct omap3_vp *vp = &omap3_vp[vp_id];
+
+       omap2_prm_write_mod_reg(vp->tranxdone_status,
+                               OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
+}
+
+u32 omap3_prm_vcvp_read(u8 offset)
+{
+       return omap2_prm_read_mod_reg(OMAP3430_GR_MOD, offset);
+}
+
+void omap3_prm_vcvp_write(u32 val, u8 offset)
+{
+       omap2_prm_write_mod_reg(val, OMAP3430_GR_MOD, offset);
+}
+
+u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset)
+{
+       return omap2_prm_rmw_mod_reg_bits(mask, bits, OMAP3430_GR_MOD, offset);
+}
+
+/**
+ * omap3xxx_prm_dpll3_reset - use DPLL3 reset to reboot the OMAP SoC
+ *
+ * Set the DPLL3 reset bit, which should reboot the SoC.  This is the
+ * recommended way to restart the SoC, considering Errata i520.  No
+ * return value.
+ */
+void omap3xxx_prm_dpll3_reset(void)
+{
+       omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, OMAP3430_GR_MOD,
+                                  OMAP2_RM_RSTCTRL);
+       /* OCP barrier */
+       omap2_prm_read_mod_reg(OMAP3430_GR_MOD, OMAP2_RM_RSTCTRL);
+}
+
+/**
+ * omap3xxx_prm_read_pending_irqs - read pending PRM MPU IRQs into @events
+ * @events: ptr to a u32, preallocated by caller
+ *
+ * Read PRM_IRQSTATUS_MPU bits, AND'ed with the currently-enabled PRM
+ * MPU IRQs, and store the result into the u32 pointed to by @events.
+ * No return value.
+ */
+void omap3xxx_prm_read_pending_irqs(unsigned long *events)
+{
+       u32 mask, st;
+
+       /* XXX Can the mask read be avoided (e.g., can it come from RAM?) */
+       mask = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET);
+       st = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
+
+       events[0] = mask & st;
+}
+
+/**
+ * omap3xxx_prm_ocp_barrier - force buffered MPU writes to the PRM to complete
+ *
+ * Force any buffered writes to the PRM IP block to complete.  Needed
+ * by the PRM IRQ handler, which reads and writes directly to the IP
+ * block, to avoid race conditions after acknowledging or clearing IRQ
+ * bits.  No return value.
+ */
+void omap3xxx_prm_ocp_barrier(void)
+{
+       omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET);
+}
+
+/**
+ * omap3xxx_prm_save_and_clear_irqen - save/clear PRM_IRQENABLE_MPU reg
+ * @saved_mask: ptr to a u32 array to save IRQENABLE bits
+ *
+ * Save the PRM_IRQENABLE_MPU register to @saved_mask.  @saved_mask
+ * must be allocated by the caller.  Intended to be used in the PRM
+ * interrupt handler suspend callback.  The OCP barrier is needed to
+ * ensure the write to disable PRM interrupts reaches the PRM before
+ * returning; otherwise, spurious interrupts might occur.  No return
+ * value.
+ */
+void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask)
+{
+       saved_mask[0] = omap2_prm_read_mod_reg(OCP_MOD,
+                                              OMAP3_PRM_IRQENABLE_MPU_OFFSET);
+       omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET);
+
+       /* OCP barrier */
+       omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET);
+}
+
+/**
+ * omap3xxx_prm_restore_irqen - set PRM_IRQENABLE_MPU register from args
+ * @saved_mask: ptr to a u32 array of IRQENABLE bits saved previously
+ *
+ * Restore the PRM_IRQENABLE_MPU register from @saved_mask.  Intended
+ * to be used in the PRM interrupt handler resume callback to restore
+ * values saved by omap3xxx_prm_save_and_clear_irqen().  No OCP
+ * barrier should be needed here; any pending PRM interrupts will fire
+ * once the writes reach the PRM.  No return value.
+ */
+void omap3xxx_prm_restore_irqen(u32 *saved_mask)
+{
+       omap2_prm_write_mod_reg(saved_mask[0], OCP_MOD,
+                               OMAP3_PRM_IRQENABLE_MPU_OFFSET);
+}
+
+/**
+ * omap3xxx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain
+ *
+ * Clear any previously-latched I/O wakeup events and ensure that the
+ * I/O wakeup gates are aligned with the current mux settings.  Works
+ * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then
+ * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit.  No
+ * return value.
+ */
+void omap3xxx_prm_reconfigure_io_chain(void)
+{
+       int i = 0;
+
+       omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
+                                  PM_WKEN);
+
+       omap_test_timeout(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) &
+                         OMAP3430_ST_IO_CHAIN_MASK,
+                         MAX_IOPAD_LATCH_TIME, i);
+       if (i == MAX_IOPAD_LATCH_TIME)
+               pr_warn("PRM: I/O chain clock line assertion timed out\n");
+
+       omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
+                                    PM_WKEN);
+
+       omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK, WKUP_MOD,
+                                  PM_WKST);
+
+       omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST);
+}
+
+/**
+ * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches
+ *
+ * Activates the I/O wakeup event latches and allows events logged by
+ * those latches to signal a wakeup event to the PRCM.  For I/O
+ * wakeups to occur, WAKEUPENABLE bits must be set in the pad mux
+ * registers, and omap3xxx_prm_reconfigure_io_chain() must be called.
+ * No return value.
+ */
+static void __init omap3xxx_prm_enable_io_wakeup(void)
+{
+       if (omap3_has_io_wakeup())
+               omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
+                                          PM_WKEN);
+}
+
+/**
+ * omap3xxx_prm_read_reset_sources - return the last SoC reset source
+ *
+ * Return a u32 representing the last reset sources of the SoC.  The
+ * returned reset source bits are standardized across OMAP SoCs.
+ */
+static u32 omap3xxx_prm_read_reset_sources(void)
+{
+       struct prm_reset_src_map *p;
+       u32 r = 0;
+       u32 v;
+
+       v = omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST);
+
+       p = omap3xxx_prm_reset_src_map;
+       while (p->reg_shift >= 0 && p->std_shift >= 0) {
+               if (v & (1 << p->reg_shift))
+                       r |= 1 << p->std_shift;
+               p++;
+       }
+
+       return r;
+}
+
+/* Powerdomain low-level functions */
+
+/* Applicable only for OMAP3. Not supported on OMAP2 */
+static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
+{
+       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
+                                            OMAP3430_PM_PREPWSTST,
+                                            OMAP3430_LASTPOWERSTATEENTERED_MASK);
+}
+
+static int omap3_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
+{
+       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
+                                            OMAP2_PM_PWSTST,
+                                            OMAP3430_LOGICSTATEST_MASK);
+}
+
+static int omap3_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
+{
+       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
+                                            OMAP2_PM_PWSTCTRL,
+                                            OMAP3430_LOGICSTATEST_MASK);
+}
+
+static int omap3_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
+{
+       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
+                                            OMAP3430_PM_PREPWSTST,
+                                            OMAP3430_LASTLOGICSTATEENTERED_MASK);
+}
+
+static int omap3_get_mem_bank_lastmemst_mask(u8 bank)
+{
+       switch (bank) {
+       case 0:
+               return OMAP3430_LASTMEM1STATEENTERED_MASK;
+       case 1:
+               return OMAP3430_LASTMEM2STATEENTERED_MASK;
+       case 2:
+               return OMAP3430_LASTSHAREDL2CACHEFLATSTATEENTERED_MASK;
+       case 3:
+               return OMAP3430_LASTL2FLATMEMSTATEENTERED_MASK;
+       default:
+               WARN_ON(1); /* should never happen */
+               return -EEXIST;
+       }
+       return 0;
+}
+
+static int omap3_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
+{
+       u32 m;
+
+       m = omap3_get_mem_bank_lastmemst_mask(bank);
+
+       return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
+                               OMAP3430_PM_PREPWSTST, m);
+}
+
+static int omap3_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
+{
+       omap2_prm_write_mod_reg(0, pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST);
+       return 0;
+}
+
+static int omap3_pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm)
+{
+       return omap2_prm_rmw_mod_reg_bits(0,
+                                         1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
+                                         pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
+}
+
+static int omap3_pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm)
+{
+       return omap2_prm_rmw_mod_reg_bits(1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
+                                         0, pwrdm->prcm_offs,
+                                         OMAP2_PM_PWSTCTRL);
+}
+
+struct pwrdm_ops omap3_pwrdm_operations = {
+       .pwrdm_set_next_pwrst   = omap2_pwrdm_set_next_pwrst,
+       .pwrdm_read_next_pwrst  = omap2_pwrdm_read_next_pwrst,
+       .pwrdm_read_pwrst       = omap2_pwrdm_read_pwrst,
+       .pwrdm_read_prev_pwrst  = omap3_pwrdm_read_prev_pwrst,
+       .pwrdm_set_logic_retst  = omap2_pwrdm_set_logic_retst,
+       .pwrdm_read_logic_pwrst = omap3_pwrdm_read_logic_pwrst,
+       .pwrdm_read_logic_retst = omap3_pwrdm_read_logic_retst,
+       .pwrdm_read_prev_logic_pwrst    = omap3_pwrdm_read_prev_logic_pwrst,
+       .pwrdm_set_mem_onst     = omap2_pwrdm_set_mem_onst,
+       .pwrdm_set_mem_retst    = omap2_pwrdm_set_mem_retst,
+       .pwrdm_read_mem_pwrst   = omap2_pwrdm_read_mem_pwrst,
+       .pwrdm_read_mem_retst   = omap2_pwrdm_read_mem_retst,
+       .pwrdm_read_prev_mem_pwrst      = omap3_pwrdm_read_prev_mem_pwrst,
+       .pwrdm_clear_all_prev_pwrst     = omap3_pwrdm_clear_all_prev_pwrst,
+       .pwrdm_enable_hdwr_sar  = omap3_pwrdm_enable_hdwr_sar,
+       .pwrdm_disable_hdwr_sar = omap3_pwrdm_disable_hdwr_sar,
+       .pwrdm_wait_transition  = omap2_pwrdm_wait_transition,
+};
+
+/*
+ *
+ */
+
+static struct prm_ll_data omap3xxx_prm_ll_data = {
+       .read_reset_sources = &omap3xxx_prm_read_reset_sources,
+};
+
+static int __init omap3xxx_prm_init(void)
+{
+       int ret;
+
+       if (!cpu_is_omap34xx())
+               return 0;
+
+       ret = prm_register(&omap3xxx_prm_ll_data);
+       if (ret)
+               return ret;
+
+       omap3xxx_prm_enable_io_wakeup();
+       ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup);
+       if (!ret)
+               irq_set_status_flags(omap_prcm_event_to_irq("io"),
+                                    IRQ_NOAUTOEN);
+
+
+       return ret;
+}
+subsys_initcall(omap3xxx_prm_init);
+
+static void __exit omap3xxx_prm_exit(void)
+{
+       if (!cpu_is_omap34xx())
+               return;
+
+       /* Should never happen */
+       WARN(prm_unregister(&omap3xxx_prm_ll_data),
+            "%s: prm_ll_data function pointer mismatch\n", __func__);
+}
+__exitcall(omap3xxx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm3xxx.h b/arch/arm/mach-omap2/prm3xxx.h
new file mode 100644 (file)
index 0000000..10cd41a
--- /dev/null
@@ -0,0 +1,162 @@
+/*
+ * OMAP3xxx Power/Reset Management (PRM) register definitions
+ *
+ * Copyright (C) 2007-2009, 2011-2012 Texas Instruments, Inc.
+ * Copyright (C) 2008-2010 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ *
+ * The PRM hardware modules on the OMAP2/3 are quite similar to each
+ * other.  The PRM on OMAP4 has a new register layout, and is handled
+ * in a separate file.
+ */
+#ifndef __ARCH_ARM_MACH_OMAP2_PRM3XXX_H
+#define __ARCH_ARM_MACH_OMAP2_PRM3XXX_H
+
+#include "prcm-common.h"
+#include "prm.h"
+#include "prm2xxx_3xxx.h"
+
+#define OMAP34XX_PRM_REGADDR(module, reg)                              \
+               OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
+
+
+/*
+ * OMAP3-specific global PRM registers
+ * Use __raw_{read,write}l() with these registers.
+ *
+ * With a few exceptions, these are the register names beginning with
+ * PRM_* on 34xx.  (The exceptions are the IRQSTATUS and IRQENABLE
+ * bits.)
+ */
+
+#define OMAP3_PRM_REVISION_OFFSET      0x0004
+#define OMAP3430_PRM_REVISION          OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0004)
+#define OMAP3_PRM_SYSCONFIG_OFFSET     0x0014
+#define OMAP3430_PRM_SYSCONFIG         OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0014)
+
+#define OMAP3_PRM_IRQSTATUS_MPU_OFFSET 0x0018
+#define OMAP3430_PRM_IRQSTATUS_MPU     OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0018)
+#define OMAP3_PRM_IRQENABLE_MPU_OFFSET 0x001c
+#define OMAP3430_PRM_IRQENABLE_MPU     OMAP34XX_PRM_REGADDR(OCP_MOD, 0x001c)
+
+
+#define OMAP3_PRM_VC_SMPS_SA_OFFSET    0x0020
+#define OMAP3430_PRM_VC_SMPS_SA                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0020)
+#define OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET        0x0024
+#define OMAP3430_PRM_VC_SMPS_VOL_RA    OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0024)
+#define OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET        0x0028
+#define OMAP3430_PRM_VC_SMPS_CMD_RA    OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0028)
+#define OMAP3_PRM_VC_CMD_VAL_0_OFFSET  0x002c
+#define OMAP3430_PRM_VC_CMD_VAL_0      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x002c)
+#define OMAP3_PRM_VC_CMD_VAL_1_OFFSET  0x0030
+#define OMAP3430_PRM_VC_CMD_VAL_1      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0030)
+#define OMAP3_PRM_VC_CH_CONF_OFFSET    0x0034
+#define OMAP3430_PRM_VC_CH_CONF                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0034)
+#define OMAP3_PRM_VC_I2C_CFG_OFFSET    0x0038
+#define OMAP3430_PRM_VC_I2C_CFG                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0038)
+#define OMAP3_PRM_VC_BYPASS_VAL_OFFSET 0x003c
+#define OMAP3430_PRM_VC_BYPASS_VAL     OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x003c)
+#define OMAP3_PRM_RSTCTRL_OFFSET       0x0050
+#define OMAP3430_PRM_RSTCTRL           OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0050)
+#define OMAP3_PRM_RSTTIME_OFFSET       0x0054
+#define OMAP3430_PRM_RSTTIME           OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0054)
+#define OMAP3_PRM_RSTST_OFFSET 0x0058
+#define OMAP3430_PRM_RSTST             OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0058)
+#define OMAP3_PRM_VOLTCTRL_OFFSET      0x0060
+#define OMAP3430_PRM_VOLTCTRL          OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0060)
+#define OMAP3_PRM_SRAM_PCHARGE_OFFSET  0x0064
+#define OMAP3430_PRM_SRAM_PCHARGE      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0064)
+#define OMAP3_PRM_CLKSRC_CTRL_OFFSET   0x0070
+#define OMAP3430_PRM_CLKSRC_CTRL       OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0070)
+#define OMAP3_PRM_VOLTSETUP1_OFFSET    0x0090
+#define OMAP3430_PRM_VOLTSETUP1                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0090)
+#define OMAP3_PRM_VOLTOFFSET_OFFSET    0x0094
+#define OMAP3430_PRM_VOLTOFFSET                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0094)
+#define OMAP3_PRM_CLKSETUP_OFFSET      0x0098
+#define OMAP3430_PRM_CLKSETUP          OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0098)
+#define OMAP3_PRM_POLCTRL_OFFSET       0x009c
+#define OMAP3430_PRM_POLCTRL           OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x009c)
+#define OMAP3_PRM_VOLTSETUP2_OFFSET    0x00a0
+#define OMAP3430_PRM_VOLTSETUP2                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00a0)
+#define OMAP3_PRM_VP1_CONFIG_OFFSET    0x00b0
+#define OMAP3430_PRM_VP1_CONFIG                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b0)
+#define OMAP3_PRM_VP1_VSTEPMIN_OFFSET  0x00b4
+#define OMAP3430_PRM_VP1_VSTEPMIN      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b4)
+#define OMAP3_PRM_VP1_VSTEPMAX_OFFSET  0x00b8
+#define OMAP3430_PRM_VP1_VSTEPMAX      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b8)
+#define OMAP3_PRM_VP1_VLIMITTO_OFFSET  0x00bc
+#define OMAP3430_PRM_VP1_VLIMITTO      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00bc)
+#define OMAP3_PRM_VP1_VOLTAGE_OFFSET   0x00c0
+#define OMAP3430_PRM_VP1_VOLTAGE       OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c0)
+#define OMAP3_PRM_VP1_STATUS_OFFSET    0x00c4
+#define OMAP3430_PRM_VP1_STATUS                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c4)
+#define OMAP3_PRM_VP2_CONFIG_OFFSET    0x00d0
+#define OMAP3430_PRM_VP2_CONFIG                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d0)
+#define OMAP3_PRM_VP2_VSTEPMIN_OFFSET  0x00d4
+#define OMAP3430_PRM_VP2_VSTEPMIN      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d4)
+#define OMAP3_PRM_VP2_VSTEPMAX_OFFSET  0x00d8
+#define OMAP3430_PRM_VP2_VSTEPMAX      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d8)
+#define OMAP3_PRM_VP2_VLIMITTO_OFFSET  0x00dc
+#define OMAP3430_PRM_VP2_VLIMITTO      OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00dc)
+#define OMAP3_PRM_VP2_VOLTAGE_OFFSET   0x00e0
+#define OMAP3430_PRM_VP2_VOLTAGE       OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e0)
+#define OMAP3_PRM_VP2_STATUS_OFFSET    0x00e4
+#define OMAP3430_PRM_VP2_STATUS                OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e4)
+
+#define OMAP3_PRM_CLKSEL_OFFSET        0x0040
+#define OMAP3430_PRM_CLKSEL            OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0040)
+#define OMAP3_PRM_CLKOUT_CTRL_OFFSET   0x0070
+#define OMAP3430_PRM_CLKOUT_CTRL       OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
+
+/* OMAP3 specific register offsets */
+#define OMAP3430ES2_PM_WKEN3                           0x00f0
+#define OMAP3430ES2_PM_WKST3                           0x00b8
+
+#define OMAP3430_PM_MPUGRPSEL                          0x00a4
+#define OMAP3430_PM_MPUGRPSEL1                         OMAP3430_PM_MPUGRPSEL
+#define OMAP3430ES2_PM_MPUGRPSEL3                      0x00f8
+
+#define OMAP3430_PM_IVAGRPSEL                          0x00a8
+#define OMAP3430_PM_IVAGRPSEL1                         OMAP3430_PM_IVAGRPSEL
+#define OMAP3430ES2_PM_IVAGRPSEL3                      0x00f4
+
+#define OMAP3430_PM_PREPWSTST                          0x00e8
+
+#define OMAP3430_PRM_IRQSTATUS_IVA2                    0x00f8
+#define OMAP3430_PRM_IRQENABLE_IVA2                    0x00fc
+
+
+#ifndef __ASSEMBLER__
+
+/* OMAP3-specific VP functions */
+u32 omap3_prm_vp_check_txdone(u8 vp_id);
+void omap3_prm_vp_clear_txdone(u8 vp_id);
+
+/*
+ * OMAP3 access functions for voltage controller (VC) and
+ * voltage proccessor (VP) in the PRM.
+ */
+extern u32 omap3_prm_vcvp_read(u8 offset);
+extern void omap3_prm_vcvp_write(u32 val, u8 offset);
+extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
+
+extern void omap3xxx_prm_reconfigure_io_chain(void);
+
+/* PRM interrupt-related functions */
+extern void omap3xxx_prm_read_pending_irqs(unsigned long *events);
+extern void omap3xxx_prm_ocp_barrier(void);
+extern void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask);
+extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
+
+extern void omap3xxx_prm_dpll3_reset(void);
+
+extern u32 omap3xxx_prm_get_reset_sources(void);
+
+#endif /* __ASSEMBLER */
+
+
+#endif
index f0c4d5f4a17498306afacfa3beb9968d8ca759e0..6d3467af205d238617dfc27088cd8292eb04877b 100644 (file)
@@ -1,10 +1,11 @@
 /*
  * OMAP4 PRM module functions
  *
- * Copyright (C) 2011 Texas Instruments, Inc.
+ * Copyright (C) 2011-2012 Texas Instruments, Inc.
  * Copyright (C) 2010 Nokia Corporation
  * Benoît Cousson
  * Paul Walmsley
+ * Rajendra Nayak <rnayak@ti.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -17,7 +18,6 @@
 #include <linux/err.h>
 #include <linux/io.h>
 
-#include <plat/prcm.h>
 
 #include "soc.h"
 #include "iomap.h"
@@ -27,6 +27,9 @@
 #include "prm-regbits-44xx.h"
 #include "prcm44xx.h"
 #include "prminst44xx.h"
+#include "powerdomain.h"
+
+/* Static data */
 
 static const struct omap_prcm_irq omap4_prcm_irqs[] = {
        OMAP_PRCM_IRQ("wkup",   0,      0),
@@ -46,6 +49,33 @@ static struct omap_prcm_irq_setup omap4_prcm_irq_setup = {
        .restore_irqen          = &omap44xx_prm_restore_irqen,
 };
 
+/*
+ * omap44xx_prm_reset_src_map - map from bits in the PRM_RSTST
+ *   hardware register (which are specific to OMAP44xx SoCs) to reset
+ *   source ID bit shifts (which is an OMAP SoC-independent
+ *   enumeration)
+ */
+static struct prm_reset_src_map omap44xx_prm_reset_src_map[] = {
+       { OMAP4430_RST_GLOBAL_WARM_SW_SHIFT,
+         OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT },
+       { OMAP4430_RST_GLOBAL_COLD_SW_SHIFT,
+         OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT },
+       { OMAP4430_MPU_SECURITY_VIOL_RST_SHIFT,
+         OMAP_SECU_VIOL_RST_SRC_ID_SHIFT },
+       { OMAP4430_MPU_WDT_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
+       { OMAP4430_SECURE_WDT_RST_SHIFT, OMAP_SECU_WD_RST_SRC_ID_SHIFT },
+       { OMAP4430_EXTERNAL_WARM_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT },
+       { OMAP4430_VDD_MPU_VOLT_MGR_RST_SHIFT,
+         OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT },
+       { OMAP4430_VDD_IVA_VOLT_MGR_RST_SHIFT,
+         OMAP_VDD_IVA_VM_RST_SRC_ID_SHIFT },
+       { OMAP4430_VDD_CORE_VOLT_MGR_RST_SHIFT,
+         OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT },
+       { OMAP4430_ICEPICK_RST_SHIFT, OMAP_ICEPICK_RST_SRC_ID_SHIFT },
+       { OMAP4430_C2C_RST_SHIFT, OMAP_C2C_RST_SRC_ID_SHIFT },
+       { -1, -1 },
+};
+
 /* PRM low-level functions */
 
 /* Read a register in a CM/PRM instance in the PRM module */
@@ -291,12 +321,324 @@ static void __init omap44xx_prm_enable_io_wakeup(void)
                                    OMAP4_PRM_IO_PMCTRL_OFFSET);
 }
 
-static int __init omap4xxx_prcm_init(void)
+/**
+ * omap44xx_prm_read_reset_sources - return the last SoC reset source
+ *
+ * Return a u32 representing the last reset sources of the SoC.  The
+ * returned reset source bits are standardized across OMAP SoCs.
+ */
+static u32 omap44xx_prm_read_reset_sources(void)
+{
+       struct prm_reset_src_map *p;
+       u32 r = 0;
+       u32 v;
+
+       v = omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST,
+                                   OMAP4_RM_RSTST);
+
+       p = omap44xx_prm_reset_src_map;
+       while (p->reg_shift >= 0 && p->std_shift >= 0) {
+               if (v & (1 << p->reg_shift))
+                       r |= 1 << p->std_shift;
+               p++;
+       }
+
+       return r;
+}
+
+/* Powerdomain low-level functions */
+
+static int omap4_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
+{
+       omap4_prminst_rmw_inst_reg_bits(OMAP_POWERSTATE_MASK,
+                                       (pwrst << OMAP_POWERSTATE_SHIFT),
+                                       pwrdm->prcm_partition,
+                                       pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
+       return 0;
+}
+
+static int omap4_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
+{
+       u32 v;
+
+       v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
+                                       OMAP4_PM_PWSTCTRL);
+       v &= OMAP_POWERSTATE_MASK;
+       v >>= OMAP_POWERSTATE_SHIFT;
+
+       return v;
+}
+
+static int omap4_pwrdm_read_pwrst(struct powerdomain *pwrdm)
+{
+       u32 v;
+
+       v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
+                                       OMAP4_PM_PWSTST);
+       v &= OMAP_POWERSTATEST_MASK;
+       v >>= OMAP_POWERSTATEST_SHIFT;
+
+       return v;
+}
+
+static int omap4_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
+{
+       u32 v;
+
+       v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
+                                       OMAP4_PM_PWSTST);
+       v &= OMAP4430_LASTPOWERSTATEENTERED_MASK;
+       v >>= OMAP4430_LASTPOWERSTATEENTERED_SHIFT;
+
+       return v;
+}
+
+static int omap4_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
+{
+       omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOWPOWERSTATECHANGE_MASK,
+                                       (1 << OMAP4430_LOWPOWERSTATECHANGE_SHIFT),
+                                       pwrdm->prcm_partition,
+                                       pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
+       return 0;
+}
+
+static int omap4_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
+{
+       omap4_prminst_rmw_inst_reg_bits(OMAP4430_LASTPOWERSTATEENTERED_MASK,
+                                       OMAP4430_LASTPOWERSTATEENTERED_MASK,
+                                       pwrdm->prcm_partition,
+                                       pwrdm->prcm_offs, OMAP4_PM_PWSTST);
+       return 0;
+}
+
+static int omap4_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
+{
+       u32 v;
+
+       v = pwrst << __ffs(OMAP4430_LOGICRETSTATE_MASK);
+       omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOGICRETSTATE_MASK, v,
+                                       pwrdm->prcm_partition, pwrdm->prcm_offs,
+                                       OMAP4_PM_PWSTCTRL);
+
+       return 0;
+}
+
+static int omap4_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
+                                   u8 pwrst)
+{
+       u32 m;
+
+       m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
+
+       omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
+                                       pwrdm->prcm_partition, pwrdm->prcm_offs,
+                                       OMAP4_PM_PWSTCTRL);
+
+       return 0;
+}
+
+static int omap4_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
+                                    u8 pwrst)
+{
+       u32 m;
+
+       m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
+
+       omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
+                                       pwrdm->prcm_partition, pwrdm->prcm_offs,
+                                       OMAP4_PM_PWSTCTRL);
+
+       return 0;
+}
+
+static int omap4_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
+{
+       u32 v;
+
+       v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
+                                       OMAP4_PM_PWSTST);
+       v &= OMAP4430_LOGICSTATEST_MASK;
+       v >>= OMAP4430_LOGICSTATEST_SHIFT;
+
+       return v;
+}
+
+static int omap4_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
 {
-       if (cpu_is_omap44xx()) {
-               omap44xx_prm_enable_io_wakeup();
-               return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
+       u32 v;
+
+       v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
+                                       OMAP4_PM_PWSTCTRL);
+       v &= OMAP4430_LOGICRETSTATE_MASK;
+       v >>= OMAP4430_LOGICRETSTATE_SHIFT;
+
+       return v;
+}
+
+/**
+ * omap4_pwrdm_read_prev_logic_pwrst - read the previous logic powerstate
+ * @pwrdm: struct powerdomain * to read the state for
+ *
+ * Reads the previous logic powerstate for a powerdomain. This
+ * function must determine the previous logic powerstate by first
+ * checking the previous powerstate for the domain. If that was OFF,
+ * then logic has been lost. If previous state was RETENTION, the
+ * function reads the setting for the next retention logic state to
+ * see the actual value.  In every other case, the logic is
+ * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
+ * depending whether the logic was retained or not.
+ */
+static int omap4_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
+{
+       int state;
+
+       state = omap4_pwrdm_read_prev_pwrst(pwrdm);
+
+       if (state == PWRDM_POWER_OFF)
+               return PWRDM_POWER_OFF;
+
+       if (state != PWRDM_POWER_RET)
+               return PWRDM_POWER_RET;
+
+       return omap4_pwrdm_read_logic_retst(pwrdm);
+}
+
+static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
+{
+       u32 m, v;
+
+       m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
+
+       v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
+                                       OMAP4_PM_PWSTST);
+       v &= m;
+       v >>= __ffs(m);
+
+       return v;
+}
+
+static int omap4_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
+{
+       u32 m, v;
+
+       m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
+
+       v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
+                                       OMAP4_PM_PWSTCTRL);
+       v &= m;
+       v >>= __ffs(m);
+
+       return v;
+}
+
+/**
+ * omap4_pwrdm_read_prev_mem_pwrst - reads the previous memory powerstate
+ * @pwrdm: struct powerdomain * to read mem powerstate for
+ * @bank: memory bank index
+ *
+ * Reads the previous memory powerstate for a powerdomain. This
+ * function must determine the previous memory powerstate by first
+ * checking the previous powerstate for the domain. If that was OFF,
+ * then logic has been lost. If previous state was RETENTION, the
+ * function reads the setting for the next memory retention state to
+ * see the actual value.  In every other case, the logic is
+ * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
+ * depending whether logic was retained or not.
+ */
+static int omap4_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
+{
+       int state;
+
+       state = omap4_pwrdm_read_prev_pwrst(pwrdm);
+
+       if (state == PWRDM_POWER_OFF)
+               return PWRDM_POWER_OFF;
+
+       if (state != PWRDM_POWER_RET)
+               return PWRDM_POWER_RET;
+
+       return omap4_pwrdm_read_mem_retst(pwrdm, bank);
+}
+
+static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm)
+{
+       u32 c = 0;
+
+       /*
+        * REVISIT: pwrdm_wait_transition() may be better implemented
+        * via a callback and a periodic timer check -- how long do we expect
+        * powerdomain transitions to take?
+        */
+
+       /* XXX Is this udelay() value meaningful? */
+       while ((omap4_prminst_read_inst_reg(pwrdm->prcm_partition,
+                                           pwrdm->prcm_offs,
+                                           OMAP4_PM_PWSTST) &
+               OMAP_INTRANSITION_MASK) &&
+              (c++ < PWRDM_TRANSITION_BAILOUT))
+               udelay(1);
+
+       if (c > PWRDM_TRANSITION_BAILOUT) {
+               pr_err("powerdomain: %s: waited too long to complete transition\n",
+                      pwrdm->name);
+               return -EAGAIN;
        }
+
+       pr_debug("powerdomain: completed transition in %d loops\n", c);
+
        return 0;
 }
-subsys_initcall(omap4xxx_prcm_init);
+
+struct pwrdm_ops omap4_pwrdm_operations = {
+       .pwrdm_set_next_pwrst   = omap4_pwrdm_set_next_pwrst,
+       .pwrdm_read_next_pwrst  = omap4_pwrdm_read_next_pwrst,
+       .pwrdm_read_pwrst       = omap4_pwrdm_read_pwrst,
+       .pwrdm_read_prev_pwrst  = omap4_pwrdm_read_prev_pwrst,
+       .pwrdm_set_lowpwrstchange       = omap4_pwrdm_set_lowpwrstchange,
+       .pwrdm_clear_all_prev_pwrst     = omap4_pwrdm_clear_all_prev_pwrst,
+       .pwrdm_set_logic_retst  = omap4_pwrdm_set_logic_retst,
+       .pwrdm_read_logic_pwrst = omap4_pwrdm_read_logic_pwrst,
+       .pwrdm_read_prev_logic_pwrst    = omap4_pwrdm_read_prev_logic_pwrst,
+       .pwrdm_read_logic_retst = omap4_pwrdm_read_logic_retst,
+       .pwrdm_read_mem_pwrst   = omap4_pwrdm_read_mem_pwrst,
+       .pwrdm_read_mem_retst   = omap4_pwrdm_read_mem_retst,
+       .pwrdm_read_prev_mem_pwrst      = omap4_pwrdm_read_prev_mem_pwrst,
+       .pwrdm_set_mem_onst     = omap4_pwrdm_set_mem_onst,
+       .pwrdm_set_mem_retst    = omap4_pwrdm_set_mem_retst,
+       .pwrdm_wait_transition  = omap4_pwrdm_wait_transition,
+};
+
+/*
+ * XXX document
+ */
+static struct prm_ll_data omap44xx_prm_ll_data = {
+       .read_reset_sources = &omap44xx_prm_read_reset_sources,
+};
+
+static int __init omap44xx_prm_init(void)
+{
+       int ret;
+
+       if (!cpu_is_omap44xx())
+               return 0;
+
+       ret = prm_register(&omap44xx_prm_ll_data);
+       if (ret)
+               return ret;
+
+       omap44xx_prm_enable_io_wakeup();
+
+       return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
+}
+subsys_initcall(omap44xx_prm_init);
+
+static void __exit omap44xx_prm_exit(void)
+{
+       if (!cpu_is_omap44xx())
+               return;
+
+       /* Should never happen */
+       WARN(prm_unregister(&omap44xx_prm_ll_data),
+            "%s: prm_ll_data function pointer mismatch\n", __func__);
+}
+__exitcall(omap44xx_prm_exit);
index ee72ae6bd8c961350be2ebb343a027f6d1f4fddf..c8e1accdc90ebe71a7c8850bc6756a2d2312f18f 100644 (file)
@@ -771,6 +771,8 @@ extern void omap44xx_prm_ocp_barrier(void);
 extern void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask);
 extern void omap44xx_prm_restore_irqen(u32 *saved_mask);
 
+extern u32 omap44xx_prm_get_reset_sources(void);
+
 # endif
 
 #endif
index 6b4d332be2f63d46d8bc3d1cd25ce08a8af4f7b4..f596e1e91ffd62ce524791d5e5bf3313830c08cf 100644 (file)
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 
-#include <plat/common.h>
-#include <plat/prcm.h>
-
 #include "prm2xxx_3xxx.h"
+#include "prm2xxx.h"
+#include "prm3xxx.h"
 #include "prm44xx.h"
+#include "common.h"
 
 /*
  * OMAP_PRCM_MAX_NR_PENDING_REG: maximum number of PRM_IRQ*_MPU regs
@@ -53,6 +53,16 @@ static struct irq_chip_generic **prcm_irq_chips;
  */
 static struct omap_prcm_irq_setup *prcm_irq_setup;
 
+/* prm_base: base virtual address of the PRM IP block */
+void __iomem *prm_base;
+
+/*
+ * prm_ll_data: function pointers to SoC-specific implementations of
+ * common PRM functions
+ */
+static struct prm_ll_data null_prm_ll_data;
+static struct prm_ll_data *prm_ll_data = &null_prm_ll_data;
+
 /* Private functions */
 
 /*
@@ -319,64 +329,82 @@ err:
        return -ENOMEM;
 }
 
-/*
- * Stubbed functions so that common files continue to build when
- * custom builds are used
- * XXX These are temporary and should be removed at the earliest possible
- * opportunity
+/**
+ * omap2_set_globals_prm - set the PRM base address (for early use)
+ * @prm: PRM base virtual address
+ *
+ * XXX Will be replaced when the PRM/CM drivers are completed.
  */
-u32 __weak omap2_prm_read_mod_reg(s16 module, u16 idx)
+void __init omap2_set_globals_prm(void __iomem *prm)
 {
-       WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
-       return 0;
+       prm_base = prm;
 }
 
-void __weak omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx)
+/**
+ * prm_read_reset_sources - return the sources of the SoC's last reset
+ *
+ * Return a u32 bitmask representing the reset sources that caused the
+ * SoC to reset.  The low-level per-SoC functions called by this
+ * function remap the SoC-specific reset source bits into an
+ * OMAP-common set of reset source bits, defined in
+ * arch/arm/mach-omap2/prm.h.  Returns the standardized reset source
+ * u32 bitmask from the hardware upon success, or returns (1 <<
+ * OMAP_UNKNOWN_RST_SRC_ID_SHIFT) if no low-level read_reset_sources()
+ * function was registered.
+ */
+u32 prm_read_reset_sources(void)
 {
-       WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
-}
+       u32 ret = 1 << OMAP_UNKNOWN_RST_SRC_ID_SHIFT;
 
-u32 __weak omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits,
-               s16 module, s16 idx)
-{
-       WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
-       return 0;
-}
+       if (prm_ll_data->read_reset_sources)
+               ret = prm_ll_data->read_reset_sources();
+       else
+               WARN_ONCE(1, "prm: %s: no mapping function defined for reset sources\n", __func__);
 
-u32 __weak omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
-{
-       WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
-       return 0;
+       return ret;
 }
 
-u32 __weak omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
+/**
+ * prm_register - register per-SoC low-level data with the PRM
+ * @pld: low-level per-SoC OMAP PRM data & function pointers to register
+ *
+ * Register per-SoC low-level OMAP PRM data and function pointers with
+ * the OMAP PRM common interface.  The caller must keep the data
+ * pointed to by @pld valid until it calls prm_unregister() and
+ * it returns successfully.  Returns 0 upon success, -EINVAL if @pld
+ * is NULL, or -EEXIST if prm_register() has already been called
+ * without an intervening prm_unregister().
+ */
+int prm_register(struct prm_ll_data *pld)
 {
-       WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
-       return 0;
-}
+       if (!pld)
+               return -EINVAL;
 
-u32 __weak omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
-{
-       WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
-       return 0;
-}
+       if (prm_ll_data != &null_prm_ll_data)
+               return -EEXIST;
 
-int __weak omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift)
-{
-       WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
-       return 0;
-}
+       prm_ll_data = pld;
 
-int __weak omap2_prm_assert_hardreset(s16 prm_mod, u8 shift)
-{
-       WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
        return 0;
 }
 
-int __weak omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift,
-                                               u8 st_shift)
+/**
+ * prm_unregister - unregister per-SoC low-level data & function pointers
+ * @pld: low-level per-SoC OMAP PRM data & function pointers to unregister
+ *
+ * Unregister per-SoC low-level OMAP PRM data and function pointers
+ * that were previously registered with prm_register().  The
+ * caller may not destroy any of the data pointed to by @pld until
+ * this function returns successfully.  Returns 0 upon success, or
+ * -EINVAL if @pld is NULL or if @pld does not match the struct
+ * prm_ll_data * previously registered by prm_register().
+ */
+int prm_unregister(struct prm_ll_data *pld)
 {
-       WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
+       if (!pld || prm_ll_data != pld)
+               return -EINVAL;
+
+       prm_ll_data = &null_prm_ll_data;
+
        return 0;
 }
-
index 46f2efb3659660bfd83dad39161a66035fd32163..a2ede2d65481580e7399cc36bf964e57eee0fea5 100644 (file)
@@ -30,4 +30,6 @@ extern int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst,
 extern int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst,
                                            u16 rstctrl_offs);
 
+extern void omap_prm_base_init(void);
+
 #endif
index 8bfaf342a028a166084c1a2cffd1b694410d0763..1ee58c281a3107cd1b964d769b7d0fd84520c3fa 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM
 #define __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM
 
-#include <plat/sdrc.h>
+#include "sdrc.h"
 
 /* Hynix H8MBX00U0MER-0EM */
 static struct omap_sdrc_params h8mbx00u0mer0em_sdrc_params[] = {
index a391b4939f74f0ce910087d53bd1bb40a2c0ac91..85cccc004c06921bdaaa7a2bbbcaf487b3f84f37 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF
 #define ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF
 
-#include <plat/sdrc.h>
+#include "sdrc.h"
 
 /* Micron MT46H32M32LF-6 */
 /* XXX Using ARE = 0x1 (no autorefresh burst) -- can this be changed? */
index 845c4fd2b125238fd9516297c152a004300bc1e6..0fa7ffa9b5ed27f138258b8177450b6aada64db1 100644 (file)
 #include <linux/io.h>
 
 #include "common.h"
-#include <plat/clock.h>
-#include <plat/sdrc.h>
-
 #include "sdram-nokia.h"
+#include "sdrc.h"
 
 /* In picoseconds, except for tREF (ns), tXP, tCKE, tWTR (clks) */
 struct sdram_timings {
index cd4352917022d68d4bef930be0f47cc12af0e803..003f7bf4e2e337c0abd2c815eda62516a6809783 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM
 #define __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM
 
-#include <plat/sdrc.h>
+#include "sdrc.h"
 
 /* Numonyx  M65KXXXXAM */
 static struct omap_sdrc_params m65kxxxxam_sdrc_params[] = {
index 0e518a72831fa52eb19d17a55fbd787fd2ab35cf..8dc3de5ebb5b1d891eb063804faff8f9f912d45f 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6
 #define ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6
 
-#include <plat/sdrc.h>
+#include "sdrc.h"
 
 /* Qimonda HYB18M512160AF-6 */
 static struct omap_sdrc_params hyb18m512160af6_sdrc_params[] = {
index e3d345f464094c0709382b9ab160ef70384f581d..dae7e4804a488ae90b73038d84dddac3c77ee573 100644 (file)
 #include <linux/io.h>
 
 #include "common.h"
-#include <plat/clock.h>
-#include <plat/sram.h>
-
-#include <plat/sdrc.h>
+#include "clock.h"
 #include "sdrc.h"
 
 static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1;
@@ -115,12 +112,10 @@ int omap2_sdrc_get_params(unsigned long r,
 }
 
 
-void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals)
+void __init omap2_set_globals_sdrc(void __iomem *sdrc, void __iomem *sms)
 {
-       if (omap2_globals->sdrc)
-               omap2_sdrc_base = omap2_globals->sdrc;
-       if (omap2_globals->sms)
-               omap2_sms_base = omap2_globals->sms;
+       omap2_sdrc_base = sdrc;
+       omap2_sms_base = sms;
 }
 
 /**
@@ -160,19 +155,3 @@ void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
        sdrc_write_reg(l, SDRC_POWER);
        omap2_sms_save_context();
 }
-
-void omap2_sms_write_rot_control(u32 val, unsigned ctx)
-{
-       sms_write_reg(val, SMS_ROT_CONTROL(ctx));
-}
-
-void omap2_sms_write_rot_size(u32 val, unsigned ctx)
-{
-       sms_write_reg(val, SMS_ROT_SIZE(ctx));
-}
-
-void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx)
-{
-       sms_write_reg(val, SMS_ROT_PHYSICAL_BA(ctx));
-}
-
index b3f83799e6cf0701d4388aa7785049a6241fad8d..446aa13511fde8ba8d9f084e7cf65ff08bdf86c9 100644 (file)
@@ -2,12 +2,14 @@
 #define __ARCH_ARM_MACH_OMAP2_SDRC_H
 
 /*
- * OMAP2 SDRC register definitions
+ * OMAP2/3 SDRC/SMS macros and prototypes
  *
- * Copyright (C) 2007 Texas Instruments, Inc.
- * Copyright (C) 2007 Nokia Corporation
+ * Copyright (C) 2007-2008, 2012 Texas Instruments, Inc.
+ * Copyright (C) 2007-2008 Nokia Corporation
  *
- * Written by Paul Walmsley
+ * Paul Walmsley
+ * Tony Lindgren
+ * Richard Woodruff
  *
  * 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
@@ -15,8 +17,6 @@
  */
 #undef DEBUG
 
-#include <plat/sdrc.h>
-
 #ifndef __ASSEMBLER__
 
 #include <linux/io.h>
@@ -50,6 +50,60 @@ static inline u32 sms_read_reg(u16 reg)
 {
        return __raw_readl(OMAP_SMS_REGADDR(reg));
 }
+
+extern void omap2_set_globals_sdrc(void __iomem *sdrc, void __iomem *sms);
+
+
+/**
+ * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate
+ * @rate: SDRC clock rate (in Hz)
+ * @actim_ctrla: Value to program to SDRC_ACTIM_CTRLA for this rate
+ * @actim_ctrlb: Value to program to SDRC_ACTIM_CTRLB for this rate
+ * @rfr_ctrl: Value to program to SDRC_RFR_CTRL for this rate
+ * @mr: Value to program to SDRC_MR for this rate
+ *
+ * This structure holds a pre-computed set of register values for the
+ * SDRC for a given SDRC clock rate and SDRAM chip.  These are
+ * intended to be pre-computed and specified in an array in the board-*.c
+ * files.  The structure is keyed off the 'rate' field.
+ */
+struct omap_sdrc_params {
+       unsigned long rate;
+       u32 actim_ctrla;
+       u32 actim_ctrlb;
+       u32 rfr_ctrl;
+       u32 mr;
+};
+
+#ifdef CONFIG_SOC_HAS_OMAP2_SDRC
+void omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+                           struct omap_sdrc_params *sdrc_cs1);
+#else
+static inline void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+                                         struct omap_sdrc_params *sdrc_cs1) {};
+#endif
+
+int omap2_sdrc_get_params(unsigned long r,
+                         struct omap_sdrc_params **sdrc_cs0,
+                         struct omap_sdrc_params **sdrc_cs1);
+void omap2_sms_save_context(void);
+void omap2_sms_restore_context(void);
+
+struct memory_timings {
+       u32 m_type;             /* ddr = 1, sdr = 0 */
+       u32 dll_mode;           /* use lock mode = 1, unlock mode = 0 */
+       u32 slow_dll_ctrl;      /* unlock mode, dll value for slow speed */
+       u32 fast_dll_ctrl;      /* unlock mode, dll value for fast speed */
+       u32 base_cs;            /* base chip select to use for calculations */
+};
+
+extern void omap2xxx_sdrc_init_params(u32 force_lock_to_unlock_mode);
+struct omap_sdrc_params *rx51_get_sdram_timings(void);
+
+u32 omap2xxx_sdrc_dll_is_unlocked(void);
+u32 omap2xxx_sdrc_reprogram(u32 level, u32 force);
+
+
 #else
 #define OMAP242X_SDRC_REGADDR(reg)                                     \
                        OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg))
@@ -57,6 +111,7 @@ static inline u32 sms_read_reg(u16 reg)
                        OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg))
 #define OMAP34XX_SDRC_REGADDR(reg)                                     \
                        OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg))
+
 #endif /* __ASSEMBLER__ */
 
 /* Minimum frequency that the SDRC DLL can lock at */
@@ -74,4 +129,85 @@ static inline u32 sms_read_reg(u16 reg)
  */
 #define SDRC_MPURATE_LOOPS             96
 
+/* SDRC register offsets - read/write with sdrc_{read,write}_reg() */
+
+#define SDRC_SYSCONFIG         0x010
+#define SDRC_CS_CFG            0x040
+#define SDRC_SHARING           0x044
+#define SDRC_ERR_TYPE          0x04C
+#define SDRC_DLLA_CTRL         0x060
+#define SDRC_DLLA_STATUS       0x064
+#define SDRC_DLLB_CTRL         0x068
+#define SDRC_DLLB_STATUS       0x06C
+#define SDRC_POWER             0x070
+#define SDRC_MCFG_0            0x080
+#define SDRC_MR_0              0x084
+#define SDRC_EMR2_0            0x08c
+#define SDRC_ACTIM_CTRL_A_0    0x09c
+#define SDRC_ACTIM_CTRL_B_0    0x0a0
+#define SDRC_RFR_CTRL_0                0x0a4
+#define SDRC_MANUAL_0          0x0a8
+#define SDRC_MCFG_1            0x0B0
+#define SDRC_MR_1              0x0B4
+#define SDRC_EMR2_1            0x0BC
+#define SDRC_ACTIM_CTRL_A_1    0x0C4
+#define SDRC_ACTIM_CTRL_B_1    0x0C8
+#define SDRC_RFR_CTRL_1                0x0D4
+#define SDRC_MANUAL_1          0x0D8
+
+#define SDRC_POWER_AUTOCOUNT_SHIFT     8
+#define SDRC_POWER_AUTOCOUNT_MASK      (0xffff << SDRC_POWER_AUTOCOUNT_SHIFT)
+#define SDRC_POWER_CLKCTRL_SHIFT       4
+#define SDRC_POWER_CLKCTRL_MASK                (0x3 << SDRC_POWER_CLKCTRL_SHIFT)
+#define SDRC_SELF_REFRESH_ON_AUTOCOUNT (0x2 << SDRC_POWER_CLKCTRL_SHIFT)
+
+/*
+ * These values represent the number of memory clock cycles between
+ * autorefresh initiation.  They assume 1 refresh per 64 ms (JEDEC), 8192
+ * rows per device, and include a subtraction of a 50 cycle window in the
+ * event that the autorefresh command is delayed due to other SDRC activity.
+ * The '| 1' sets the ARE field to send one autorefresh when the autorefresh
+ * counter reaches 0.
+ *
+ * These represent optimal values for common parts, it won't work for all.
+ * As long as you scale down, most parameters are still work, they just
+ * become sub-optimal. The RFR value goes in the opposite direction. If you
+ * don't adjust it down as your clock period increases the refresh interval
+ * will not be met. Setting all parameters for complete worst case may work,
+ * but may cut memory performance by 2x. Due to errata the DLLs need to be
+ * unlocked and their value needs run time calibration.        A dynamic call is
+ * need for that as no single right value exists acorss production samples.
+ *
+ * Only the FULL speed values are given. Current code is such that rate
+ * changes must be made at DPLLoutx2. The actual value adjustment for low
+ * frequency operation will be handled by omap_set_performance()
+ *
+ * By having the boot loader boot up in the fastest L4 speed available likely
+ * will result in something which you can switch between.
+ */
+#define SDRC_RFR_CTRL_165MHz   (0x00044c00 | 1)
+#define SDRC_RFR_CTRL_133MHz   (0x0003de00 | 1)
+#define SDRC_RFR_CTRL_100MHz   (0x0002da01 | 1)
+#define SDRC_RFR_CTRL_110MHz   (0x0002da01 | 1) /* Need to calc */
+#define SDRC_RFR_CTRL_BYPASS   (0x00005000 | 1) /* Need to calc */
+
+
+/*
+ * SMS register access
+ */
+
+#define OMAP242X_SMS_REGADDR(reg)                                      \
+               (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE + reg)
+#define OMAP243X_SMS_REGADDR(reg)                                      \
+               (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE + reg)
+#define OMAP343X_SMS_REGADDR(reg)                                      \
+               (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE + reg)
+
+/* SMS register offsets - read/write with sms_{read,write}_reg() */
+
+#define SMS_SYSCONFIG                  0x010
+/* REVISIT: fill in other SMS registers here */
+
+
+
 #endif
index 73e55e4853294cdd4c1fb1f443cd24b700378356..90729171464300a908f522730e3572a3d64e5683 100644 (file)
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/clock.h>
-#include <plat/sram.h>
-#include <plat/sdrc.h>
-
 #include "soc.h"
 #include "iomap.h"
 #include "common.h"
-#include "prm2xxx_3xxx.h"
+#include "prm2xxx.h"
 #include "clock.h"
 #include "sdrc.h"
+#include "sram.h"
 
 /* Memory timing, DLL mode flags */
 #define M_DDR          1
index a507cd6cf4f12259ab6a0bbad75fdc2e38bbe3a8..aa30a3c2088303f4964d029ab6ca2faa5e096240 100644 (file)
 #include <linux/console.h>
 
 #include <plat/omap-serial.h>
-#include "common.h"
-#include <plat/dma.h>
-#include <plat/omap_hwmod.h>
-#include <plat/omap_device.h>
-#include <plat/omap-pm.h>
-#include <plat/serial.h>
+#include <plat-omap/dma-omap.h>
 
+#include "common.h"
+#include "omap_hwmod.h"
+#include "omap_device.h"
+#include "omap-pm.h"
+#include "soc.h"
 #include "prm2xxx_3xxx.h"
 #include "pm.h"
 #include "cm2xxx_3xxx.h"
 #include "prm-regbits-34xx.h"
 #include "control.h"
 #include "mux.h"
+#include "serial.h"
 
 /*
  * NOTE: By default the serial auto_suspend timeout is disabled as it causes
diff --git a/arch/arm/mach-omap2/serial.h b/arch/arm/mach-omap2/serial.h
new file mode 100644 (file)
index 0000000..c4014f0
--- /dev/null
@@ -0,0 +1 @@
+#include <mach/serial.h>
index 506987979c1cd4e882f846968e550aa1b5ecfcc2..d1dedc8195ed2569508e0d522301bdf535aefda8 100644 (file)
 
 #include <asm/assembler.h>
 
-#include <plat/sram.h>
-
 #include "omap34xx.h"
 #include "iomap.h"
-#include "cm2xxx_3xxx.h"
-#include "prm2xxx_3xxx.h"
+#include "cm3xxx.h"
+#include "prm3xxx.h"
 #include "sdrc.h"
+#include "sram.h"
 #include "control.h"
 
 /*
index fc9b96daf851cc84810399fc87626322e156db8e..070096496e205ca4b5a76fe293799840833b65c9 100644 (file)
@@ -1,7 +1,473 @@
-#include <plat/cpu.h>
+/*
+ * OMAP cpu type detection
+ *
+ * Copyright (C) 2004, 2008 Nokia Corporation
+ *
+ * Copyright (C) 2009-11 Texas Instruments.
+ *
+ * Written by Tony Lindgren <tony.lindgren@nokia.com>
+ *
+ * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
 #include "omap24xx.h"
 #include "omap34xx.h"
 #include "omap44xx.h"
 #include "ti81xx.h"
 #include "am33xx.h"
 #include "omap54xx.h"
+
+#ifndef __ASSEMBLY__
+
+#include <linux/bitops.h>
+
+/*
+ * Test if multicore OMAP support is needed
+ */
+#undef MULTI_OMAP2
+#undef OMAP_NAME
+
+#ifdef CONFIG_SOC_OMAP2420
+# ifdef OMAP_NAME
+#  undef  MULTI_OMAP2
+#  define MULTI_OMAP2
+# else
+#  define OMAP_NAME omap2420
+# endif
+#endif
+#ifdef CONFIG_SOC_OMAP2430
+# ifdef OMAP_NAME
+#  undef  MULTI_OMAP2
+#  define MULTI_OMAP2
+# else
+#  define OMAP_NAME omap2430
+# endif
+#endif
+#ifdef CONFIG_ARCH_OMAP3
+# ifdef OMAP_NAME
+#  undef  MULTI_OMAP2
+#  define MULTI_OMAP2
+# else
+#  define OMAP_NAME omap3
+# endif
+#endif
+#ifdef CONFIG_ARCH_OMAP4
+# ifdef OMAP_NAME
+#  undef  MULTI_OMAP2
+#  define MULTI_OMAP2
+# else
+#  define OMAP_NAME omap4
+# endif
+#endif
+
+#ifdef CONFIG_SOC_OMAP5
+# ifdef OMAP_NAME
+#  undef  MULTI_OMAP2
+#  define MULTI_OMAP2
+# else
+#  define OMAP_NAME omap5
+# endif
+#endif
+
+#ifdef CONFIG_SOC_AM33XX
+# ifdef OMAP_NAME
+#  undef  MULTI_OMAP2
+#  define MULTI_OMAP2
+# else
+#  define OMAP_NAME am33xx
+# endif
+#endif
+
+/*
+ * Omap device type i.e. EMU/HS/TST/GP/BAD
+ */
+#define OMAP2_DEVICE_TYPE_TEST         0
+#define OMAP2_DEVICE_TYPE_EMU          1
+#define OMAP2_DEVICE_TYPE_SEC          2
+#define OMAP2_DEVICE_TYPE_GP           3
+#define OMAP2_DEVICE_TYPE_BAD          4
+
+int omap_type(void);
+
+/*
+ * omap_rev bits:
+ * CPU id bits (0730, 1510, 1710, 2422...)     [31:16]
+ * CPU revision        (See _REV_ defined in cpu.h)    [15:08]
+ * CPU class bits (15xx, 16xx, 24xx, 34xx...)  [07:00]
+ */
+unsigned int omap_rev(void);
+
+/*
+ * Get the CPU revision for OMAP devices
+ */
+#define GET_OMAP_REVISION()    ((omap_rev() >> 8) & 0xff)
+
+/*
+ * Macros to group OMAP into cpu classes.
+ * These can be used in most places.
+ * cpu_is_omap24xx():  True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
+ * cpu_is_omap242x():  True for OMAP2420, OMAP2422, OMAP2423
+ * cpu_is_omap243x():  True for OMAP2430
+ * cpu_is_omap343x():  True for OMAP3430
+ * cpu_is_omap443x():  True for OMAP4430
+ * cpu_is_omap446x():  True for OMAP4460
+ * cpu_is_omap447x():  True for OMAP4470
+ * soc_is_omap543x():  True for OMAP5430, OMAP5432
+ */
+#define GET_OMAP_CLASS (omap_rev() & 0xff)
+
+#define IS_OMAP_CLASS(class, id)                       \
+static inline int is_omap ##class (void)               \
+{                                                      \
+       return (GET_OMAP_CLASS == (id)) ? 1 : 0;        \
+}
+
+#define GET_AM_CLASS   ((omap_rev() >> 24) & 0xff)
+
+#define IS_AM_CLASS(class, id)                         \
+static inline int is_am ##class (void)                 \
+{                                                      \
+       return (GET_AM_CLASS == (id)) ? 1 : 0;          \
+}
+
+#define GET_TI_CLASS   ((omap_rev() >> 24) & 0xff)
+
+#define IS_TI_CLASS(class, id)                 \
+static inline int is_ti ##class (void)         \
+{                                                      \
+       return (GET_TI_CLASS == (id)) ? 1 : 0;  \
+}
+
+#define GET_OMAP_SUBCLASS      ((omap_rev() >> 20) & 0x0fff)
+
+#define IS_OMAP_SUBCLASS(subclass, id)                 \
+static inline int is_omap ##subclass (void)            \
+{                                                      \
+       return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0;     \
+}
+
+#define IS_TI_SUBCLASS(subclass, id)                   \
+static inline int is_ti ##subclass (void)              \
+{                                                      \
+       return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0;     \
+}
+
+#define IS_AM_SUBCLASS(subclass, id)                   \
+static inline int is_am ##subclass (void)              \
+{                                                      \
+       return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0;     \
+}
+
+IS_OMAP_CLASS(24xx, 0x24)
+IS_OMAP_CLASS(34xx, 0x34)
+IS_OMAP_CLASS(44xx, 0x44)
+IS_AM_CLASS(35xx, 0x35)
+IS_OMAP_CLASS(54xx, 0x54)
+IS_AM_CLASS(33xx, 0x33)
+
+IS_TI_CLASS(81xx, 0x81)
+
+IS_OMAP_SUBCLASS(242x, 0x242)
+IS_OMAP_SUBCLASS(243x, 0x243)
+IS_OMAP_SUBCLASS(343x, 0x343)
+IS_OMAP_SUBCLASS(363x, 0x363)
+IS_OMAP_SUBCLASS(443x, 0x443)
+IS_OMAP_SUBCLASS(446x, 0x446)
+IS_OMAP_SUBCLASS(447x, 0x447)
+IS_OMAP_SUBCLASS(543x, 0x543)
+
+IS_TI_SUBCLASS(816x, 0x816)
+IS_TI_SUBCLASS(814x, 0x814)
+IS_AM_SUBCLASS(335x, 0x335)
+
+#define cpu_is_omap24xx()              0
+#define cpu_is_omap242x()              0
+#define cpu_is_omap243x()              0
+#define cpu_is_omap34xx()              0
+#define cpu_is_omap343x()              0
+#define cpu_is_ti81xx()                        0
+#define cpu_is_ti816x()                        0
+#define cpu_is_ti814x()                        0
+#define soc_is_am35xx()                        0
+#define soc_is_am33xx()                        0
+#define soc_is_am335x()                        0
+#define cpu_is_omap44xx()              0
+#define cpu_is_omap443x()              0
+#define cpu_is_omap446x()              0
+#define cpu_is_omap447x()              0
+#define soc_is_omap54xx()              0
+#define soc_is_omap543x()              0
+
+#if defined(MULTI_OMAP2)
+# if defined(CONFIG_ARCH_OMAP2)
+#  undef  cpu_is_omap24xx
+#  define cpu_is_omap24xx()            is_omap24xx()
+# endif
+# if defined (CONFIG_SOC_OMAP2420)
+#  undef  cpu_is_omap242x
+#  define cpu_is_omap242x()            is_omap242x()
+# endif
+# if defined (CONFIG_SOC_OMAP2430)
+#  undef  cpu_is_omap243x
+#  define cpu_is_omap243x()            is_omap243x()
+# endif
+# if defined(CONFIG_ARCH_OMAP3)
+#  undef  cpu_is_omap34xx
+#  undef  cpu_is_omap343x
+#  define cpu_is_omap34xx()            is_omap34xx()
+#  define cpu_is_omap343x()            is_omap343x()
+# endif
+#else
+# if defined(CONFIG_ARCH_OMAP2)
+#  undef  cpu_is_omap24xx
+#  define cpu_is_omap24xx()            1
+# endif
+# if defined(CONFIG_SOC_OMAP2420)
+#  undef  cpu_is_omap242x
+#  define cpu_is_omap242x()            1
+# endif
+# if defined(CONFIG_SOC_OMAP2430)
+#  undef  cpu_is_omap243x
+#  define cpu_is_omap243x()            1
+# endif
+# if defined(CONFIG_ARCH_OMAP3)
+#  undef  cpu_is_omap34xx
+#  define cpu_is_omap34xx()            1
+# endif
+# if defined(CONFIG_SOC_OMAP3430)
+#  undef  cpu_is_omap343x
+#  define cpu_is_omap343x()            1
+# endif
+#endif
+
+/*
+ * Macros to detect individual cpu types.
+ * These are only rarely needed.
+ * cpu_is_omap2420():  True for OMAP2420
+ * cpu_is_omap2422():  True for OMAP2422
+ * cpu_is_omap2423():  True for OMAP2423
+ * cpu_is_omap2430():  True for OMAP2430
+ * cpu_is_omap3430():  True for OMAP3430
+ */
+#define GET_OMAP_TYPE  ((omap_rev() >> 16) & 0xffff)
+
+#define IS_OMAP_TYPE(type, id)                         \
+static inline int is_omap ##type (void)                        \
+{                                                      \
+       return (GET_OMAP_TYPE == (id)) ? 1 : 0;         \
+}
+
+IS_OMAP_TYPE(2420, 0x2420)
+IS_OMAP_TYPE(2422, 0x2422)
+IS_OMAP_TYPE(2423, 0x2423)
+IS_OMAP_TYPE(2430, 0x2430)
+IS_OMAP_TYPE(3430, 0x3430)
+
+#define cpu_is_omap2420()              0
+#define cpu_is_omap2422()              0
+#define cpu_is_omap2423()              0
+#define cpu_is_omap2430()              0
+#define cpu_is_omap3430()              0
+#define cpu_is_omap3630()              0
+#define soc_is_omap5430()              0
+
+/* These are needed for the common code */
+#ifdef CONFIG_ARCH_OMAP2PLUS
+#define cpu_is_omap7xx()               0
+#define cpu_is_omap15xx()              0
+#define cpu_is_omap16xx()              0
+#define cpu_is_omap1510()              0
+#define cpu_is_omap1610()              0
+#define cpu_is_omap1611()              0
+#define cpu_is_omap1621()              0
+#define cpu_is_omap1710()              0
+#define cpu_class_is_omap1()           0
+#define cpu_class_is_omap2()           1
+#endif
+
+#if defined(CONFIG_ARCH_OMAP2)
+# undef  cpu_is_omap2420
+# undef  cpu_is_omap2422
+# undef  cpu_is_omap2423
+# undef  cpu_is_omap2430
+# define cpu_is_omap2420()             is_omap2420()
+# define cpu_is_omap2422()             is_omap2422()
+# define cpu_is_omap2423()             is_omap2423()
+# define cpu_is_omap2430()             is_omap2430()
+#endif
+
+#if defined(CONFIG_ARCH_OMAP3)
+# undef cpu_is_omap3430
+# undef cpu_is_ti81xx
+# undef cpu_is_ti816x
+# undef cpu_is_ti814x
+# undef soc_is_am35xx
+# define cpu_is_omap3430()             is_omap3430()
+# undef cpu_is_omap3630
+# define cpu_is_omap3630()             is_omap363x()
+# define cpu_is_ti81xx()               is_ti81xx()
+# define cpu_is_ti816x()               is_ti816x()
+# define cpu_is_ti814x()               is_ti814x()
+# define soc_is_am35xx()               is_am35xx()
+#endif
+
+# if defined(CONFIG_SOC_AM33XX)
+# undef soc_is_am33xx
+# undef soc_is_am335x
+# define soc_is_am33xx()               is_am33xx()
+# define soc_is_am335x()               is_am335x()
+#endif
+
+# if defined(CONFIG_ARCH_OMAP4)
+# undef cpu_is_omap44xx
+# undef cpu_is_omap443x
+# undef cpu_is_omap446x
+# undef cpu_is_omap447x
+# define cpu_is_omap44xx()             is_omap44xx()
+# define cpu_is_omap443x()             is_omap443x()
+# define cpu_is_omap446x()             is_omap446x()
+# define cpu_is_omap447x()             is_omap447x()
+# endif
+
+# if defined(CONFIG_SOC_OMAP5)
+# undef soc_is_omap54xx
+# undef soc_is_omap543x
+# define soc_is_omap54xx()             is_omap54xx()
+# define soc_is_omap543x()             is_omap543x()
+#endif
+
+/* Various silicon revisions for omap2 */
+#define OMAP242X_CLASS         0x24200024
+#define OMAP2420_REV_ES1_0     OMAP242X_CLASS
+#define OMAP2420_REV_ES2_0     (OMAP242X_CLASS | (0x1 << 8))
+
+#define OMAP243X_CLASS         0x24300024
+#define OMAP2430_REV_ES1_0     OMAP243X_CLASS
+
+#define OMAP343X_CLASS         0x34300034
+#define OMAP3430_REV_ES1_0     OMAP343X_CLASS
+#define OMAP3430_REV_ES2_0     (OMAP343X_CLASS | (0x1 << 8))
+#define OMAP3430_REV_ES2_1     (OMAP343X_CLASS | (0x2 << 8))
+#define OMAP3430_REV_ES3_0     (OMAP343X_CLASS | (0x3 << 8))
+#define OMAP3430_REV_ES3_1     (OMAP343X_CLASS | (0x4 << 8))
+#define OMAP3430_REV_ES3_1_2   (OMAP343X_CLASS | (0x5 << 8))
+
+#define OMAP363X_CLASS         0x36300034
+#define OMAP3630_REV_ES1_0     OMAP363X_CLASS
+#define OMAP3630_REV_ES1_1     (OMAP363X_CLASS | (0x1 << 8))
+#define OMAP3630_REV_ES1_2     (OMAP363X_CLASS | (0x2 << 8))
+
+#define TI816X_CLASS           0x81600034
+#define TI8168_REV_ES1_0       TI816X_CLASS
+#define TI8168_REV_ES1_1       (TI816X_CLASS | (0x1 << 8))
+
+#define TI814X_CLASS           0x81400034
+#define TI8148_REV_ES1_0       TI814X_CLASS
+#define TI8148_REV_ES2_0       (TI814X_CLASS | (0x1 << 8))
+#define TI8148_REV_ES2_1       (TI814X_CLASS | (0x2 << 8))
+
+#define AM35XX_CLASS           0x35170034
+#define AM35XX_REV_ES1_0       AM35XX_CLASS
+#define AM35XX_REV_ES1_1       (AM35XX_CLASS | (0x1 << 8))
+
+#define AM335X_CLASS           0x33500033
+#define AM335X_REV_ES1_0       AM335X_CLASS
+
+#define OMAP443X_CLASS         0x44300044
+#define OMAP4430_REV_ES1_0     (OMAP443X_CLASS | (0x10 << 8))
+#define OMAP4430_REV_ES2_0     (OMAP443X_CLASS | (0x20 << 8))
+#define OMAP4430_REV_ES2_1     (OMAP443X_CLASS | (0x21 << 8))
+#define OMAP4430_REV_ES2_2     (OMAP443X_CLASS | (0x22 << 8))
+#define OMAP4430_REV_ES2_3     (OMAP443X_CLASS | (0x23 << 8))
+
+#define OMAP446X_CLASS         0x44600044
+#define OMAP4460_REV_ES1_0     (OMAP446X_CLASS | (0x10 << 8))
+#define OMAP4460_REV_ES1_1     (OMAP446X_CLASS | (0x11 << 8))
+
+#define OMAP447X_CLASS         0x44700044
+#define OMAP4470_REV_ES1_0     (OMAP447X_CLASS | (0x10 << 8))
+
+#define OMAP54XX_CLASS         0x54000054
+#define OMAP5430_REV_ES1_0     (OMAP54XX_CLASS | (0x30 << 16) | (0x10 << 8))
+#define OMAP5432_REV_ES1_0     (OMAP54XX_CLASS | (0x32 << 16) | (0x10 << 8))
+
+void omap2xxx_check_revision(void);
+void omap3xxx_check_revision(void);
+void omap4xxx_check_revision(void);
+void omap5xxx_check_revision(void);
+void omap3xxx_check_features(void);
+void ti81xx_check_features(void);
+void omap4xxx_check_features(void);
+
+/*
+ * Runtime detection of OMAP3 features
+ *
+ * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip
+ *    family have OS-level control over the I/O chain clock.  This is
+ *    to avoid a window during which wakeups could potentially be lost
+ *    during powerdomain transitions.  If this bit is set, it
+ *    indicates that the chip does support OS-level control of this
+ *    feature.
+ */
+extern u32 omap_features;
+
+#define OMAP3_HAS_L2CACHE              BIT(0)
+#define OMAP3_HAS_IVA                  BIT(1)
+#define OMAP3_HAS_SGX                  BIT(2)
+#define OMAP3_HAS_NEON                 BIT(3)
+#define OMAP3_HAS_ISP                  BIT(4)
+#define OMAP3_HAS_192MHZ_CLK           BIT(5)
+#define OMAP3_HAS_IO_WAKEUP            BIT(6)
+#define OMAP3_HAS_SDRC                 BIT(7)
+#define OMAP3_HAS_IO_CHAIN_CTRL                BIT(8)
+#define OMAP4_HAS_MPU_1GHZ             BIT(9)
+#define OMAP4_HAS_MPU_1_2GHZ           BIT(10)
+#define OMAP4_HAS_MPU_1_5GHZ           BIT(11)
+
+
+#define OMAP3_HAS_FEATURE(feat,flag)                   \
+static inline unsigned int omap3_has_ ##feat(void)     \
+{                                                      \
+       return omap_features & OMAP3_HAS_ ##flag;       \
+}                                                      \
+
+OMAP3_HAS_FEATURE(l2cache, L2CACHE)
+OMAP3_HAS_FEATURE(sgx, SGX)
+OMAP3_HAS_FEATURE(iva, IVA)
+OMAP3_HAS_FEATURE(neon, NEON)
+OMAP3_HAS_FEATURE(isp, ISP)
+OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
+OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP)
+OMAP3_HAS_FEATURE(sdrc, SDRC)
+OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL)
+
+/*
+ * Runtime detection of OMAP4 features
+ */
+#define OMAP4_HAS_FEATURE(feat, flag)                  \
+static inline unsigned int omap4_has_ ##feat(void)     \
+{                                                      \
+       return omap_features & OMAP4_HAS_ ##flag;       \
+}                                                      \
+
+OMAP4_HAS_FEATURE(mpu_1ghz, MPU_1GHZ)
+OMAP4_HAS_FEATURE(mpu_1_2ghz, MPU_1_2GHZ)
+OMAP4_HAS_FEATURE(mpu_1_5ghz, MPU_1_5GHZ)
+
+#endif /* __ASSEMBLY__ */
+
index f8217a5a4a26db510350dbeb9daf9f140fd2204d..b0e77a40704773a190b4510e496edf93cb1d61e3 100644 (file)
@@ -23,8 +23,8 @@
 #include <linux/slab.h>
 #include <linux/io.h>
 
-#include <plat/omap_device.h>
-
+#include "soc.h"
+#include "omap_device.h"
 #include "voltage.h"
 #include "control.h"
 #include "pm.h"
diff --git a/arch/arm/mach-omap2/sram.c b/arch/arm/mach-omap2/sram.c
new file mode 100644 (file)
index 0000000..0ff0f06
--- /dev/null
@@ -0,0 +1,305 @@
+/*
+ *
+ * OMAP SRAM detection and management
+ *
+ * Copyright (C) 2005 Nokia Corporation
+ * Written by Tony Lindgren <tony@atomide.com>
+ *
+ * Copyright (C) 2009-2012 Texas Instruments
+ * Added OMAP4/5 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/io.h>
+
+#include <asm/fncpy.h>
+#include <asm/tlb.h>
+#include <asm/cacheflush.h>
+
+#include <asm/mach/map.h>
+
+#include "soc.h"
+#include "iomap.h"
+#include "prm2xxx_3xxx.h"
+#include "sdrc.h"
+#include "sram.h"
+
+#define OMAP2_SRAM_PUB_PA      (OMAP2_SRAM_PA + 0xf800)
+#define OMAP3_SRAM_PUB_PA       (OMAP3_SRAM_PA + 0x8000)
+#ifdef CONFIG_OMAP4_ERRATA_I688
+#define OMAP4_SRAM_PUB_PA      OMAP4_SRAM_PA
+#else
+#define OMAP4_SRAM_PUB_PA      (OMAP4_SRAM_PA + 0x4000)
+#endif
+#define OMAP5_SRAM_PA          0x40300000
+
+#define SRAM_BOOTLOADER_SZ     0x00
+
+#define OMAP24XX_VA_REQINFOPERM0       OMAP2_L3_IO_ADDRESS(0x68005048)
+#define OMAP24XX_VA_READPERM0          OMAP2_L3_IO_ADDRESS(0x68005050)
+#define OMAP24XX_VA_WRITEPERM0         OMAP2_L3_IO_ADDRESS(0x68005058)
+
+#define OMAP34XX_VA_REQINFOPERM0       OMAP2_L3_IO_ADDRESS(0x68012848)
+#define OMAP34XX_VA_READPERM0          OMAP2_L3_IO_ADDRESS(0x68012850)
+#define OMAP34XX_VA_WRITEPERM0         OMAP2_L3_IO_ADDRESS(0x68012858)
+#define OMAP34XX_VA_ADDR_MATCH2                OMAP2_L3_IO_ADDRESS(0x68012880)
+#define OMAP34XX_VA_SMS_RG_ATT0                OMAP2_L3_IO_ADDRESS(0x6C000048)
+
+#define GP_DEVICE              0x300
+
+#define ROUND_DOWN(value,boundary)     ((value) & (~((boundary)-1)))
+
+static unsigned long omap_sram_start;
+static unsigned long omap_sram_skip;
+static unsigned long omap_sram_size;
+
+/*
+ * Depending on the target RAMFS firewall setup, the public usable amount of
+ * SRAM varies.  The default accessible size for all device types is 2k. A GP
+ * device allows ARM11 but not other initiators for full size. This
+ * functionality seems ok until some nice security API happens.
+ */
+static int is_sram_locked(void)
+{
+       if (OMAP2_DEVICE_TYPE_GP == omap_type()) {
+               /* RAMFW: R/W access to all initiators for all qualifier sets */
+               if (cpu_is_omap242x()) {
+                       __raw_writel(0xFF, OMAP24XX_VA_REQINFOPERM0); /* all q-vects */
+                       __raw_writel(0xCFDE, OMAP24XX_VA_READPERM0);  /* all i-read */
+                       __raw_writel(0xCFDE, OMAP24XX_VA_WRITEPERM0); /* all i-write */
+               }
+               if (cpu_is_omap34xx()) {
+                       __raw_writel(0xFFFF, OMAP34XX_VA_REQINFOPERM0); /* all q-vects */
+                       __raw_writel(0xFFFF, OMAP34XX_VA_READPERM0);  /* all i-read */
+                       __raw_writel(0xFFFF, OMAP34XX_VA_WRITEPERM0); /* all i-write */
+                       __raw_writel(0x0, OMAP34XX_VA_ADDR_MATCH2);
+                       __raw_writel(0xFFFFFFFF, OMAP34XX_VA_SMS_RG_ATT0);
+               }
+               return 0;
+       } else
+               return 1; /* assume locked with no PPA or security driver */
+}
+
+/*
+ * The amount of SRAM depends on the core type.
+ * Note that we cannot try to test for SRAM here because writes
+ * to secure SRAM will hang the system. Also the SRAM is not
+ * yet mapped at this point.
+ */
+static void __init omap_detect_sram(void)
+{
+       omap_sram_skip = SRAM_BOOTLOADER_SZ;
+       if (is_sram_locked()) {
+               if (cpu_is_omap34xx()) {
+                       omap_sram_start = OMAP3_SRAM_PUB_PA;
+                       if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||
+                           (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {
+                               omap_sram_size = 0x7000; /* 28K */
+                               omap_sram_skip += SZ_16K;
+                       } else {
+                               omap_sram_size = 0x8000; /* 32K */
+                       }
+               } else if (cpu_is_omap44xx()) {
+                       omap_sram_start = OMAP4_SRAM_PUB_PA;
+                       omap_sram_size = 0xa000; /* 40K */
+               } else if (soc_is_omap54xx()) {
+                       omap_sram_start = OMAP5_SRAM_PA;
+                       omap_sram_size = SZ_128K; /* 128KB */
+               } else {
+                       omap_sram_start = OMAP2_SRAM_PUB_PA;
+                       omap_sram_size = 0x800; /* 2K */
+               }
+       } else {
+               if (soc_is_am33xx()) {
+                       omap_sram_start = AM33XX_SRAM_PA;
+                       omap_sram_size = 0x10000; /* 64K */
+               } else if (cpu_is_omap34xx()) {
+                       omap_sram_start = OMAP3_SRAM_PA;
+                       omap_sram_size = 0x10000; /* 64K */
+               } else if (cpu_is_omap44xx()) {
+                       omap_sram_start = OMAP4_SRAM_PA;
+                       omap_sram_size = 0xe000; /* 56K */
+               } else if (soc_is_omap54xx()) {
+                       omap_sram_start = OMAP5_SRAM_PA;
+                       omap_sram_size = SZ_128K; /* 128KB */
+               } else {
+                       omap_sram_start = OMAP2_SRAM_PA;
+                       if (cpu_is_omap242x())
+                               omap_sram_size = 0xa0000; /* 640K */
+                       else if (cpu_is_omap243x())
+                               omap_sram_size = 0x10000; /* 64K */
+               }
+       }
+}
+
+/*
+ * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early.
+ */
+static void __init omap2_map_sram(void)
+{
+       int cached = 1;
+
+#ifdef CONFIG_OMAP4_ERRATA_I688
+       if (cpu_is_omap44xx()) {
+               omap_sram_start += PAGE_SIZE;
+               omap_sram_size -= SZ_16K;
+       }
+#endif
+       if (cpu_is_omap34xx()) {
+               /*
+                * SRAM must be marked as non-cached on OMAP3 since the
+                * CORE DPLL M2 divider change code (in SRAM) runs with the
+                * SDRAM controller disabled, and if it is marked cached,
+                * the ARM may attempt to write cache lines back to SDRAM
+                * which will cause the system to hang.
+                */
+               cached = 0;
+       }
+
+       omap_map_sram(omap_sram_start, omap_sram_size,
+                       omap_sram_skip, cached);
+}
+
+static void (*_omap2_sram_ddr_init)(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
+                             u32 base_cs, u32 force_unlock);
+
+void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
+                  u32 base_cs, u32 force_unlock)
+{
+       BUG_ON(!_omap2_sram_ddr_init);
+       _omap2_sram_ddr_init(slow_dll_ctrl, fast_dll_ctrl,
+                            base_cs, force_unlock);
+}
+
+static void (*_omap2_sram_reprogram_sdrc)(u32 perf_level, u32 dll_val,
+                                         u32 mem_type);
+
+void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val, u32 mem_type)
+{
+       BUG_ON(!_omap2_sram_reprogram_sdrc);
+       _omap2_sram_reprogram_sdrc(perf_level, dll_val, mem_type);
+}
+
+static u32 (*_omap2_set_prcm)(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
+
+u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass)
+{
+       BUG_ON(!_omap2_set_prcm);
+       return _omap2_set_prcm(dpll_ctrl_val, sdrc_rfr_val, bypass);
+}
+
+#ifdef CONFIG_SOC_OMAP2420
+static int __init omap242x_sram_init(void)
+{
+       _omap2_sram_ddr_init = omap_sram_push(omap242x_sram_ddr_init,
+                                       omap242x_sram_ddr_init_sz);
+
+       _omap2_sram_reprogram_sdrc = omap_sram_push(omap242x_sram_reprogram_sdrc,
+                                           omap242x_sram_reprogram_sdrc_sz);
+
+       _omap2_set_prcm = omap_sram_push(omap242x_sram_set_prcm,
+                                        omap242x_sram_set_prcm_sz);
+
+       return 0;
+}
+#else
+static inline int omap242x_sram_init(void)
+{
+       return 0;
+}
+#endif
+
+#ifdef CONFIG_SOC_OMAP2430
+static int __init omap243x_sram_init(void)
+{
+       _omap2_sram_ddr_init = omap_sram_push(omap243x_sram_ddr_init,
+                                       omap243x_sram_ddr_init_sz);
+
+       _omap2_sram_reprogram_sdrc = omap_sram_push(omap243x_sram_reprogram_sdrc,
+                                           omap243x_sram_reprogram_sdrc_sz);
+
+       _omap2_set_prcm = omap_sram_push(omap243x_sram_set_prcm,
+                                        omap243x_sram_set_prcm_sz);
+
+       return 0;
+}
+#else
+static inline int omap243x_sram_init(void)
+{
+       return 0;
+}
+#endif
+
+#ifdef CONFIG_ARCH_OMAP3
+
+static u32 (*_omap3_sram_configure_core_dpll)(
+                       u32 m2, u32 unlock_dll, u32 f, u32 inc,
+                       u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+                       u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+                       u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+                       u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
+u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc,
+                       u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+                       u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+                       u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+                       u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1)
+{
+       BUG_ON(!_omap3_sram_configure_core_dpll);
+       return _omap3_sram_configure_core_dpll(
+                       m2, unlock_dll, f, inc,
+                       sdrc_rfr_ctrl_0, sdrc_actim_ctrl_a_0,
+                       sdrc_actim_ctrl_b_0, sdrc_mr_0,
+                       sdrc_rfr_ctrl_1, sdrc_actim_ctrl_a_1,
+                       sdrc_actim_ctrl_b_1, sdrc_mr_1);
+}
+
+void omap3_sram_restore_context(void)
+{
+       omap_sram_reset();
+
+       _omap3_sram_configure_core_dpll =
+               omap_sram_push(omap3_sram_configure_core_dpll,
+                              omap3_sram_configure_core_dpll_sz);
+       omap_push_sram_idle();
+}
+
+static inline int omap34xx_sram_init(void)
+{
+       omap3_sram_restore_context();
+       return 0;
+}
+#else
+static inline int omap34xx_sram_init(void)
+{
+       return 0;
+}
+#endif /* CONFIG_ARCH_OMAP3 */
+
+static inline int am33xx_sram_init(void)
+{
+       return 0;
+}
+
+int __init omap_sram_init(void)
+{
+       omap_detect_sram();
+       omap2_map_sram();
+
+       if (cpu_is_omap242x())
+               omap242x_sram_init();
+       else if (cpu_is_omap2430())
+               omap243x_sram_init();
+       else if (soc_is_am33xx())
+               am33xx_sram_init();
+       else if (cpu_is_omap34xx())
+               omap34xx_sram_init();
+
+       return 0;
+}
diff --git a/arch/arm/mach-omap2/sram.h b/arch/arm/mach-omap2/sram.h
new file mode 100644 (file)
index 0000000..ca7277c
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Interface for functions that need to be run in internal SRAM
+ *
+ * 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 __ASSEMBLY__
+#include <plat/sram.h>
+
+extern void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
+                               u32 base_cs, u32 force_unlock);
+extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
+                                     u32 mem_type);
+extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
+
+extern u32 omap3_configure_core_dpll(
+                       u32 m2, u32 unlock_dll, u32 f, u32 inc,
+                       u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+                       u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+                       u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+                       u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+extern void omap3_sram_restore_context(void);
+
+/* Do not use these */
+extern void omap24xx_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
+extern unsigned long omap24xx_sram_reprogram_clock_sz;
+
+extern void omap242x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
+                                               u32 base_cs, u32 force_unlock);
+extern unsigned long omap242x_sram_ddr_init_sz;
+
+extern u32 omap242x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val,
+                                               int bypass);
+extern unsigned long omap242x_sram_set_prcm_sz;
+
+extern void omap242x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
+                                               u32 mem_type);
+extern unsigned long omap242x_sram_reprogram_sdrc_sz;
+
+
+extern void omap243x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
+                                               u32 base_cs, u32 force_unlock);
+extern unsigned long omap243x_sram_ddr_init_sz;
+
+extern u32 omap243x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val,
+                                               int bypass);
+extern unsigned long omap243x_sram_set_prcm_sz;
+
+extern void omap243x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
+                                               u32 mem_type);
+extern unsigned long omap243x_sram_reprogram_sdrc_sz;
+
+extern u32 omap3_sram_configure_core_dpll(
+                       u32 m2, u32 unlock_dll, u32 f, u32 inc,
+                       u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+                       u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+                       u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+                       u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+extern unsigned long omap3_sram_configure_core_dpll_sz;
+
+#ifdef CONFIG_PM
+extern void omap_push_sram_idle(void);
+#else
+static inline void omap_push_sram_idle(void) {}
+#endif /* CONFIG_PM */
+
+#endif /* __ASSEMBLY__ */
+
+/*
+ * OMAP2+: define the SRAM PA addresses.
+ * Used by the SRAM management code and the idle sleep code.
+ */
+#define OMAP2_SRAM_PA          0x40200000
+#define OMAP3_SRAM_PA           0x40200000
+#ifdef CONFIG_OMAP4_ERRATA_I688
+#define OMAP4_SRAM_PA          0x40304000
+#define OMAP4_SRAM_VA          0xfe404000
+#else
+#define OMAP4_SRAM_PA          0x40300000
+#endif
+#define AM33XX_SRAM_PA         0x40300000
index 8f7326cd435b9bfb0d7b07aab70bfcd36bef8a5b..680a7c56cc3ec2dc454ad73e0c93ebadf360d58a 100644 (file)
@@ -34,8 +34,8 @@
 
 #include "soc.h"
 #include "iomap.h"
-#include "prm2xxx_3xxx.h"
-#include "cm2xxx_3xxx.h"
+#include "prm2xxx.h"
+#include "cm2xxx.h"
 #include "sdrc.h"
 
        .text
index b140d6578529dceb0dd4efc33e9ee2a3e4014d0b..a1e9edd673f4625cf08a2b7b7dc0c9aff6dc2212 100644 (file)
@@ -34,8 +34,8 @@
 
 #include "soc.h"
 #include "iomap.h"
-#include "prm2xxx_3xxx.h"
-#include "cm2xxx_3xxx.h"
+#include "prm2xxx.h"
+#include "cm2xxx.h"
 #include "sdrc.h"
 
        .text
index 2d0ceaa23fb8e8f7f1803dc4480a590805769f7e..1446331b576ae4555e091287cab4f83c114102f7 100644 (file)
@@ -32,7 +32,7 @@
 #include "soc.h"
 #include "iomap.h"
 #include "sdrc.h"
-#include "cm2xxx_3xxx.h"
+#include "cm3xxx.h"
 
 /*
  * This file needs be built unconditionally as ARM to interoperate correctly
index 8f9843f78422af3085dcd07132086ad831487312..a1e6caf0dba650b23abc5046d9cd229f933da2e8 100644 (file)
 #define TI81XX_CTRL_BASE       TI81XX_SCM_BASE
 #define TI81XX_PRCM_BASE       0x48180000
 
+/*
+ * Adjust TAP register base such that omap3_check_revision accesses the correct
+ * TI81XX register for checking device ID (it adds 0x204 to tap base while
+ * TI81XX DEVICE ID register is at offset 0x600 from control base).
+ */
+#define TI81XX_TAP_BASE                (TI81XX_CTRL_BASE + \
+                                TI81XX_CONTROL_DEVICE_ID - 0x204)
+
+
 #define TI81XX_ARM_INTC_BASE   0x48200000
 
 #endif /* __ASM_ARCH_TI81XX_H */
index 69e46631a7cdc45142af9909d52c40b8e84286a3..684d2fc3d4858a47c758efd83b3f2b253254d9ab 100644 (file)
 #include <linux/clockchips.h>
 #include <linux/slab.h>
 #include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
 
 #include <asm/mach/time.h>
 #include <asm/smp_twd.h>
 #include <asm/sched_clock.h>
 
 #include <asm/arch_timer.h>
-#include <plat/omap_hwmod.h>
-#include <plat/omap_device.h>
+#include "omap_hwmod.h"
+#include "omap_device.h"
+#include <plat/counter-32k.h>
 #include <plat/dmtimer.h>
-#include <plat/omap-pm.h>
+#include "omap-pm.h"
 
 #include "soc.h"
 #include "common.h"
 #define OMAP3_CLKEV_SOURCE     OMAP3_32K_SOURCE
 #define OMAP4_CLKEV_SOURCE     OMAP4_32K_SOURCE
 #define OMAP3_SECURE_TIMER     12
+#define TIMER_PROP_SECURE      "ti,timer-secure"
 #else
 #define OMAP2_CLKEV_SOURCE     OMAP2_MPU_SOURCE
 #define OMAP3_CLKEV_SOURCE     OMAP3_MPU_SOURCE
 #define OMAP4_CLKEV_SOURCE     OMAP4_MPU_SOURCE
 #define OMAP3_SECURE_TIMER     1
+#define TIMER_PROP_SECURE      "ti,timer-alwon"
 #endif
 
 #define REALTIME_COUNTER_BASE                          0x48243200
@@ -144,36 +149,141 @@ static struct clock_event_device clockevent_gpt = {
        .set_mode       = omap2_gp_timer_set_mode,
 };
 
+static struct property device_disabled = {
+       .name = "status",
+       .length = sizeof("disabled"),
+       .value = "disabled",
+};
+
+static struct of_device_id omap_timer_match[] __initdata = {
+       { .compatible = "ti,omap2-timer", },
+       { }
+};
+
+static struct of_device_id omap_counter_match[] __initdata = {
+       { .compatible = "ti,omap-counter32k", },
+       { }
+};
+
+/**
+ * omap_get_timer_dt - get a timer using device-tree
+ * @match      - device-tree match structure for matching a device type
+ * @property   - optional timer property to match
+ *
+ * Helper function to get a timer during early boot using device-tree for use
+ * as kernel system timer. Optionally, the property argument can be used to
+ * select a timer with a specific property. Once a timer is found then mark
+ * the timer node in device-tree as disabled, to prevent the kernel from
+ * registering this timer as a platform device and so no one else can use it.
+ */
+static struct device_node * __init omap_get_timer_dt(struct of_device_id *match,
+                                                    const char *property)
+{
+       struct device_node *np;
+
+       for_each_matching_node(np, match) {
+               if (!of_device_is_available(np)) {
+                       of_node_put(np);
+                       continue;
+               }
+
+               if (property && !of_get_property(np, property, NULL)) {
+                       of_node_put(np);
+                       continue;
+               }
+
+               prom_add_property(np, &device_disabled);
+               return np;
+       }
+
+       return NULL;
+}
+
+/**
+ * omap_dmtimer_init - initialisation function when device tree is used
+ *
+ * For secure OMAP3 devices, timers with device type "timer-secure" cannot
+ * be used by the kernel as they are reserved. Therefore, to prevent the
+ * kernel registering these devices remove them dynamically from the device
+ * tree on boot.
+ */
+void __init omap_dmtimer_init(void)
+{
+       struct device_node *np;
+
+       if (!cpu_is_omap34xx())
+               return;
+
+       /* If we are a secure device, remove any secure timer nodes */
+       if ((omap_type() != OMAP2_DEVICE_TYPE_GP)) {
+               np = omap_get_timer_dt(omap_timer_match, "ti,timer-secure");
+               if (np)
+                       of_node_put(np);
+       }
+}
+
 static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
                                                int gptimer_id,
-                                               const char *fck_source)
+                                               const char *fck_source,
+                                               const char *property)
 {
        char name[10]; /* 10 = sizeof("gptXX_Xck0") */
+       const char *oh_name;
+       struct device_node *np;
        struct omap_hwmod *oh;
        struct resource irq_rsrc, mem_rsrc;
        size_t size;
        int res = 0;
        int r;
 
-       sprintf(name, "timer%d", gptimer_id);
-       omap_hwmod_setup_one(name);
-       oh = omap_hwmod_lookup(name);
+       if (of_have_populated_dt()) {
+               np = omap_get_timer_dt(omap_timer_match, NULL);
+               if (!np)
+                       return -ENODEV;
+
+               of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
+               if (!oh_name)
+                       return -ENODEV;
+
+               timer->irq = irq_of_parse_and_map(np, 0);
+               if (!timer->irq)
+                       return -ENXIO;
+
+               timer->io_base = of_iomap(np, 0);
+
+               of_node_put(np);
+       } else {
+               if (omap_dm_timer_reserve_systimer(gptimer_id))
+                       return -ENODEV;
+
+               sprintf(name, "timer%d", gptimer_id);
+               oh_name = name;
+       }
+
+       omap_hwmod_setup_one(oh_name);
+       oh = omap_hwmod_lookup(oh_name);
+
        if (!oh)
                return -ENODEV;
 
-       r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL, &irq_rsrc);
-       if (r)
-               return -ENXIO;
-       timer->irq = irq_rsrc.start;
-
-       r = omap_hwmod_get_resource_byname(oh, IORESOURCE_MEM, NULL, &mem_rsrc);
-       if (r)
-               return -ENXIO;
-       timer->phys_base = mem_rsrc.start;
-       size = mem_rsrc.end - mem_rsrc.start;
+       if (!of_have_populated_dt()) {
+               r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL,
+                                                  &irq_rsrc);
+               if (r)
+                       return -ENXIO;
+               timer->irq = irq_rsrc.start;
+
+               r = omap_hwmod_get_resource_byname(oh, IORESOURCE_MEM, NULL,
+                                                  &mem_rsrc);
+               if (r)
+                       return -ENXIO;
+               timer->phys_base = mem_rsrc.start;
+               size = mem_rsrc.end - mem_rsrc.start;
+
+               /* Static mapping, never released */
+               timer->io_base = ioremap(timer->phys_base, size);
+       }
 
-       /* Static mapping, never released */
-       timer->io_base = ioremap(timer->phys_base, size);
        if (!timer->io_base)
                return -ENXIO;
 
@@ -184,9 +294,7 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 
        omap_hwmod_enable(oh);
 
-       if (omap_dm_timer_reserve_systimer(gptimer_id))
-               return -ENODEV;
-
+       /* FIXME: Need to remove hard-coded test on timer ID */
        if (gptimer_id != 12) {
                struct clk *src;
 
@@ -196,8 +304,8 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
                } else {
                        res = __omap_dm_timer_set_source(timer->fclk, src);
                        if (IS_ERR_VALUE(res))
-                               pr_warning("%s: timer%i cannot set source\n",
-                                               __func__, gptimer_id);
+                               pr_warn("%s: %s cannot set source\n",
+                                       __func__, oh->name);
                        clk_put(src);
                }
        }
@@ -213,11 +321,12 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 }
 
 static void __init omap2_gp_clockevent_init(int gptimer_id,
-                                               const char *fck_source)
+                                               const char *fck_source,
+                                               const char *property)
 {
        int res;
 
-       res = omap_dm_timer_init_one(&clkev, gptimer_id, fck_source);
+       res = omap_dm_timer_init_one(&clkev, gptimer_id, fck_source, property);
        BUG_ON(res);
 
        omap2_gp_timer_irq.dev_id = &clkev;
@@ -274,10 +383,25 @@ static u32 notrace dmtimer_read_sched_clock(void)
 static int __init omap2_sync32k_clocksource_init(void)
 {
        int ret;
+       struct device_node *np = NULL;
        struct omap_hwmod *oh;
        void __iomem *vbase;
        const char *oh_name = "counter_32k";
 
+       /*
+        * If device-tree is present, then search the DT blob
+        * to see if the 32kHz counter is supported.
+        */
+       if (of_have_populated_dt()) {
+               np = omap_get_timer_dt(omap_counter_match, NULL);
+               if (!np)
+                       return -ENODEV;
+
+               of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
+               if (!oh_name)
+                       return -ENODEV;
+       }
+
        /*
         * First check hwmod data is available for sync32k counter
         */
@@ -287,7 +411,13 @@ static int __init omap2_sync32k_clocksource_init(void)
 
        omap_hwmod_setup_one(oh_name);
 
-       vbase = omap_hwmod_get_mpu_rt_va(oh);
+       if (np) {
+               vbase = of_iomap(np, 0);
+               of_node_put(np);
+       } else {
+               vbase = omap_hwmod_get_mpu_rt_va(oh);
+       }
+
        if (!vbase) {
                pr_warn("%s: failed to get counter_32k resource\n", __func__);
                return -ENXIO;
@@ -321,7 +451,7 @@ static void __init omap2_gptimer_clocksource_init(int gptimer_id,
 {
        int res;
 
-       res = omap_dm_timer_init_one(&clksrc, gptimer_id, fck_source);
+       res = omap_dm_timer_init_one(&clksrc, gptimer_id, fck_source, NULL);
        BUG_ON(res);
 
        __omap_dm_timer_load_start(&clksrc,
@@ -433,11 +563,12 @@ static inline void __init realtime_counter_init(void)
 {}
 #endif
 
-#define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src,                 \
+#define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop,     \
                                clksrc_nr, clksrc_src)                  \
 static void __init omap##name##_timer_init(void)                       \
 {                                                                      \
-       omap2_gp_clockevent_init((clkev_nr), clkev_src);                \
+       omap_dmtimer_init();                                            \
+       omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop);    \
        omap2_clocksource_init((clksrc_nr), clksrc_src);                \
 }
 
@@ -447,20 +578,23 @@ struct sys_timer omap##name##_timer = {                                   \
 };
 
 #ifdef CONFIG_ARCH_OMAP2
-OMAP_SYS_TIMER_INIT(2, 1, OMAP2_CLKEV_SOURCE, 2, OMAP2_MPU_SOURCE)
+OMAP_SYS_TIMER_INIT(2, 1, OMAP2_CLKEV_SOURCE, "ti,timer-alwon",
+                   2, OMAP2_MPU_SOURCE)
 OMAP_SYS_TIMER(2)
 #endif
 
 #ifdef CONFIG_ARCH_OMAP3
-OMAP_SYS_TIMER_INIT(3, 1, OMAP3_CLKEV_SOURCE, 2, OMAP3_MPU_SOURCE)
+OMAP_SYS_TIMER_INIT(3, 1, OMAP3_CLKEV_SOURCE, "ti,timer-alwon",
+                   2, OMAP3_MPU_SOURCE)
 OMAP_SYS_TIMER(3)
 OMAP_SYS_TIMER_INIT(3_secure, OMAP3_SECURE_TIMER, OMAP3_CLKEV_SOURCE,
-                       2, OMAP3_MPU_SOURCE)
+                       TIMER_PROP_SECURE, 2, OMAP3_MPU_SOURCE)
 OMAP_SYS_TIMER(3_secure)
 #endif
 
 #ifdef CONFIG_SOC_AM33XX
-OMAP_SYS_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, 2, OMAP4_MPU_SOURCE)
+OMAP_SYS_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, "ti,timer-alwon",
+                   2, OMAP4_MPU_SOURCE)
 OMAP_SYS_TIMER(3_am33xx)
 #endif
 
@@ -472,7 +606,7 @@ static DEFINE_TWD_LOCAL_TIMER(twd_local_timer,
 
 static void __init omap4_timer_init(void)
 {
-       omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE);
+       omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE, "ti,timer-alwon");
        omap2_clocksource_init(2, OMAP4_MPU_SOURCE);
 #ifdef CONFIG_LOCAL_TIMERS
        /* Local timers are not supprted on OMAP4430 ES1.0 */
@@ -498,7 +632,7 @@ static void __init omap5_timer_init(void)
 {
        int err;
 
-       omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE);
+       omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE, "ti,timer-alwon");
        omap2_clocksource_init(2, OMAP4_MPU_SOURCE);
        realtime_counter_init();
 
@@ -559,6 +693,8 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
        if (timer_dev_attr)
                pdata->timer_capability = timer_dev_attr->timer_capability;
 
+       pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
+
        pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
                                 NULL, 0, 0);
 
@@ -583,6 +719,10 @@ static int __init omap2_dm_timer_init(void)
 {
        int ret;
 
+       /* If dtb is there, the devices will be created dynamically */
+       if (of_have_populated_dt())
+               return -ENODEV;
+
        ret = omap_hwmod_for_each_by_class("timer", omap_timer_init, NULL);
        if (unlikely(ret)) {
                pr_err("%s: device registration failed.\n", __func__);
index 635e109f5ad352e97e04dfad00c11e8728c72c98..827f54a1dd1d6fdb0deff2549bcd0ef65aea12d2 100644 (file)
@@ -26,9 +26,6 @@
 #include <linux/regulator/machine.h>
 #include <linux/regulator/fixed.h>
 
-#include <plat/i2c.h>
-#include <plat/usb.h>
-
 #include "soc.h"
 #include "twl-common.h"
 #include "pm.h"
index 3c434498e12e6faf034e1411d1b09b4b75a81c50..d1dbe125b34fa343e5aab112f060429096045fbf 100644 (file)
 
 #include <asm/io.h>
 
-#include <plat/usb.h>
-#include <plat/omap_device.h>
-
+#include "soc.h"
+#include "omap_device.h"
 #include "mux.h"
+#include "usb.h"
 
 #ifdef CONFIG_MFD_OMAP_USB_HOST
 
index 51da21cb78f1eba2237dc9b2ea7870ff91d538e3..7b33b375fe77d0f816268b0ce0e8f2f189203d3f 100644 (file)
 #include <linux/io.h>
 #include <linux/usb/musb.h>
 
-#include <plat/usb.h>
-#include <plat/omap_device.h>
-
-#include "am35xx.h"
-
+#include "omap_device.h"
+#include "soc.h"
 #include "mux.h"
+#include "usb.h"
 
 static struct musb_hdrc_config musb_config = {
        .multipoint     = 1,
index 805bea6edf1711adf0de68e8f68318bdd4c44b80..a8795ff19e6deb6f415ee01b584fb0047e40e27b 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
 #include <linux/export.h>
+#include <linux/platform_data/usb-omap.h>
 
 #include <linux/usb/musb.h>
 
-#include <plat/gpmc.h>
+#include "gpmc.h"
 
 #include "mux.h"
 
diff --git a/arch/arm/mach-omap2/usb.h b/arch/arm/mach-omap2/usb.h
new file mode 100644 (file)
index 0000000..9b986ea
--- /dev/null
@@ -0,0 +1,82 @@
+#include <linux/platform_data/usb-omap.h>
+
+/* AM35x */
+/* USB 2.0 PHY Control */
+#define CONF2_PHY_GPIOMODE     (1 << 23)
+#define CONF2_OTGMODE          (3 << 14)
+#define CONF2_NO_OVERRIDE      (0 << 14)
+#define CONF2_FORCE_HOST       (1 << 14)
+#define CONF2_FORCE_DEVICE     (2 << 14)
+#define CONF2_FORCE_HOST_VBUS_LOW (3 << 14)
+#define CONF2_SESENDEN         (1 << 13)
+#define CONF2_VBDTCTEN         (1 << 12)
+#define CONF2_REFFREQ_24MHZ    (2 << 8)
+#define CONF2_REFFREQ_26MHZ    (7 << 8)
+#define CONF2_REFFREQ_13MHZ    (6 << 8)
+#define CONF2_REFFREQ          (0xf << 8)
+#define CONF2_PHYCLKGD         (1 << 7)
+#define CONF2_VBUSSENSE                (1 << 6)
+#define CONF2_PHY_PLLON                (1 << 5)
+#define CONF2_RESET            (1 << 4)
+#define CONF2_PHYPWRDN         (1 << 3)
+#define CONF2_OTGPWRDN         (1 << 2)
+#define CONF2_DATPOL           (1 << 1)
+
+/* TI81XX specific definitions */
+#define USBCTRL0       0x620
+#define USBSTAT0       0x624
+
+/* TI816X PHY controls bits */
+#define TI816X_USBPHY0_NORMAL_MODE     (1 << 0)
+#define TI816X_USBPHY_REFCLK_OSC       (1 << 8)
+
+/* TI814X PHY controls bits */
+#define USBPHY_CM_PWRDN                (1 << 0)
+#define USBPHY_OTG_PWRDN       (1 << 1)
+#define USBPHY_CHGDET_DIS      (1 << 2)
+#define USBPHY_CHGDET_RSTRT    (1 << 3)
+#define USBPHY_SRCONDM         (1 << 4)
+#define USBPHY_SINKONDP                (1 << 5)
+#define USBPHY_CHGISINK_EN     (1 << 6)
+#define USBPHY_CHGVSRC_EN      (1 << 7)
+#define USBPHY_DMPULLUP                (1 << 8)
+#define USBPHY_DPPULLUP                (1 << 9)
+#define USBPHY_CDET_EXTCTL     (1 << 10)
+#define USBPHY_GPIO_MODE       (1 << 12)
+#define USBPHY_DPOPBUFCTL      (1 << 13)
+#define USBPHY_DMOPBUFCTL      (1 << 14)
+#define USBPHY_DPINPUT         (1 << 15)
+#define USBPHY_DMINPUT         (1 << 16)
+#define USBPHY_DPGPIO_PD       (1 << 17)
+#define USBPHY_DMGPIO_PD       (1 << 18)
+#define USBPHY_OTGVDET_EN      (1 << 19)
+#define USBPHY_OTGSESSEND_EN   (1 << 20)
+#define USBPHY_DATA_POLARITY   (1 << 23)
+
+struct usbhs_omap_board_data {
+       enum usbhs_omap_port_mode       port_mode[OMAP3_HS_USB_PORTS];
+
+       /* have to be valid if phy_reset is true and portx is in phy mode */
+       int     reset_gpio_port[OMAP3_HS_USB_PORTS];
+
+       /* Set this to true for ES2.x silicon */
+       unsigned                        es2_compatibility:1;
+
+       unsigned                        phy_reset:1;
+
+       /*
+        * Regulators for USB PHYs.
+        * Each PHY can have a separate regulator.
+        */
+       struct regulator                *regulator[OMAP3_HS_USB_PORTS];
+};
+
+extern void usb_musb_init(struct omap_musb_board_data *board_data);
+extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
+
+extern void am35x_musb_reset(void);
+extern void am35x_musb_phy_power(u8 on);
+extern void am35x_musb_clear_irq(void);
+extern void am35x_set_mode(u8 musb_mode);
+extern void ti81xx_musb_phy_power(u8 on);
+
index b2f1c67043a2b61b3b391ddedf6b6b6da75e8177..7c2b4ed38f0261d7b6776103f2f531feb7991f44 100644 (file)
@@ -1,6 +1,8 @@
 /*
  * OMAP2+ MPU WD_TIMER-specific code
  *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
 #include <linux/io.h>
 #include <linux/err.h>
 
-#include <plat/omap_hwmod.h>
+#include <linux/platform_data/omap-wd-timer.h>
 
+#include "omap_hwmod.h"
+#include "omap_device.h"
 #include "wd_timer.h"
 #include "common.h"
+#include "prm.h"
+#include "soc.h"
 
 /*
  * In order to avoid any assumptions from bootloader regarding WDT
@@ -26,9 +32,6 @@
 #define OMAP_WDT_WPS           0x34
 #define OMAP_WDT_SPR           0x48
 
-/* Maximum microseconds to wait for OMAP module to softreset */
-#define MAX_MODULE_SOFTRESET_WAIT      10000
-
 int omap2_wd_timer_disable(struct omap_hwmod *oh)
 {
        void __iomem *base;
@@ -99,3 +102,32 @@ int omap2_wd_timer_reset(struct omap_hwmod *oh)
        return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT :
                omap2_wd_timer_disable(oh);
 }
+
+static int __init omap_init_wdt(void)
+{
+       int id = -1;
+       struct platform_device *pdev;
+       struct omap_hwmod *oh;
+       char *oh_name = "wd_timer2";
+       char *dev_name = "omap_wdt";
+       struct omap_wd_timer_platform_data pdata;
+
+       if (!cpu_class_is_omap2() || of_have_populated_dt())
+               return 0;
+
+       oh = omap_hwmod_lookup(oh_name);
+       if (!oh) {
+               pr_err("Could not look up wd_timer%d hwmod\n", id);
+               return -EINVAL;
+       }
+
+       pdata.read_reset_sources = prm_read_reset_sources;
+
+       pdev = omap_device_build(dev_name, id, oh, &pdata,
+                                sizeof(struct omap_wd_timer_platform_data),
+                                NULL, 0, 0);
+       WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
+            dev_name, oh->name);
+       return 0;
+}
+subsys_initcall(omap_init_wdt);
index f6bbba73b535873aafd10168a7d6ebaf725cacfa..a78f81034a9fd44ad201f7e5806372a57e618c18 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef __ARCH_ARM_MACH_OMAP2_WD_TIMER_H
 #define __ARCH_ARM_MACH_OMAP2_WD_TIMER_H
 
-#include <plat/omap_hwmod.h>
+#include "omap_hwmod.h"
 
 extern int omap2_wd_timer_disable(struct omap_hwmod *oh);
 extern int omap2_wd_timer_reset(struct omap_hwmod *oh);
index 8c979770d8728b83ac75330e597135a3d78a57b7..564f57d5d8a74464ef3898b0086e2d8d8305d0f8 100644 (file)
@@ -162,18 +162,6 @@ static struct bu21013_platform_device tsc_plat_device = {
        .y_flip = true,
 };
 
-static struct bu21013_platform_device tsc_plat2_device = {
-       .cs_en = bu21013_gpio_board_init,
-       .cs_dis = bu21013_gpio_board_exit,
-       .irq_read_val = bu21013_read_pin_val,
-       .irq = NOMADIK_GPIO_TO_IRQ(TOUCH_GPIO_PIN),
-       .touch_x_max = TOUCH_XMAX,
-       .touch_y_max = TOUCH_YMAX,
-       .ext_clk = false,
-       .x_flip = false,
-       .y_flip = true,
-};
-
 static struct i2c_board_info __initdata u8500_i2c3_devices_stuib[] = {
        {
                I2C_BOARD_INFO("bu21013_tp", 0x5C),
@@ -181,21 +169,17 @@ static struct i2c_board_info __initdata u8500_i2c3_devices_stuib[] = {
        },
        {
                I2C_BOARD_INFO("bu21013_tp", 0x5D),
-               .platform_data = &tsc_plat2_device,
+               .platform_data = &tsc_plat_device,
        },
 
 };
 
 void __init mop500_stuib_init(void)
 {
-       if (machine_is_hrefv60()) {
+       if (machine_is_hrefv60())
                tsc_plat_device.cs_pin = HREFV60_TOUCH_RST_GPIO;
-               tsc_plat2_device.cs_pin = HREFV60_TOUCH_RST_GPIO;
-       } else {
+       else
                tsc_plat_device.cs_pin = GPIO_BU21013_CS;
-               tsc_plat2_device.cs_pin = GPIO_BU21013_CS;
-
-       }
 
        mop500_uib_i2c_add(0, mop500_i2c0_devices_stuib,
                        ARRAY_SIZE(mop500_i2c0_devices_stuib));
index 416d436111f29bbc64c267f104ab2838cf3db0ac..daa4237ac0dcfe7be72d403e496cc6724bfb1e24 100644 (file)
@@ -33,8 +33,6 @@
 #include <linux/smsc911x.h>
 #include <linux/gpio_keys.h>
 #include <linux/delay.h>
-#include <linux/of.h>
-#include <linux/of_platform.h>
 #include <linux/leds.h>
 #include <linux/pinctrl/consumer.h>
 
@@ -464,7 +462,7 @@ static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
 };
 #endif
 
-static struct pl022_ssp_controller ssp0_plat = {
+struct pl022_ssp_controller ssp0_plat = {
        .bus_id = 0,
 #ifdef CONFIG_STE_DMA40
        .enable_dma = 1,
@@ -541,7 +539,7 @@ static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
 };
 #endif
 
-static struct amba_pl011_data uart0_plat = {
+struct amba_pl011_data uart0_plat = {
 #ifdef CONFIG_STE_DMA40
        .dma_filter = stedma40_filter,
        .dma_rx_param = &uart0_dma_cfg_rx,
@@ -549,7 +547,7 @@ static struct amba_pl011_data uart0_plat = {
 #endif
 };
 
-static struct amba_pl011_data uart1_plat = {
+struct amba_pl011_data uart1_plat = {
 #ifdef CONFIG_STE_DMA40
        .dma_filter = stedma40_filter,
        .dma_rx_param = &uart1_dma_cfg_rx,
@@ -557,7 +555,7 @@ static struct amba_pl011_data uart1_plat = {
 #endif
 };
 
-static struct amba_pl011_data uart2_plat = {
+struct amba_pl011_data uart2_plat = {
 #ifdef CONFIG_STE_DMA40
        .dma_filter = stedma40_filter,
        .dma_rx_param = &uart2_dma_cfg_rx,
@@ -618,8 +616,6 @@ static void __init mop500_init_machine(void)
 
        /* This board has full regulator constraints */
        regulator_has_full_constraints();
-
-       mop500_uib_init();
 }
 
 static void __init snowball_init_machine(void)
@@ -684,8 +680,6 @@ static void __init hrefv60_init_machine(void)
 
        /* This board has full regulator constraints */
        regulator_has_full_constraints();
-
-       mop500_uib_init();
 }
 
 MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
@@ -721,135 +715,5 @@ MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
        .timer          = &ux500_timer,
        .handle_irq     = gic_handle_irq,
        .init_machine   = snowball_init_machine,
-       .init_late      = ux500_init_late,
-MACHINE_END
-
-#ifdef CONFIG_MACH_UX500_DT
-
-struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
-       /* Requires call-back bindings. */
-       OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata),
-       /* Requires DMA and call-back bindings. */
-       OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
-       OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat),
-       OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
-       /* Requires DMA bindings. */
-       OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0",  &ssp0_plat),
-       OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0",  &mop500_sdi0_data),
-       OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1",  &mop500_sdi1_data),
-       OF_DEV_AUXDATA("arm,pl18x", 0x80005000, "sdi2",  &mop500_sdi2_data),
-       OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4",  &mop500_sdi4_data),
-       /* Requires clock name bindings. */
-       OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL),
-       OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL),
-       OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e000, "gpio.2", NULL),
-       OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e080, "gpio.3", NULL),
-       OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e100, "gpio.4", NULL),
-       OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e180, "gpio.5", NULL),
-       OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL),
-       OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL),
-       OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL),
-       OF_DEV_AUXDATA("st,nomadik-i2c", 0x80004000, "nmk-i2c.0", NULL),
-       OF_DEV_AUXDATA("st,nomadik-i2c", 0x80122000, "nmk-i2c.1", NULL),
-       OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL),
-       OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL),
-       OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL),
-       /* Requires device name bindings. */
-       OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL),
-       /* Requires clock name and DMA bindings. */
-       OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000,
-               "ux500-msp-i2s.0", &msp0_platform_data),
-       OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000,
-               "ux500-msp-i2s.1", &msp1_platform_data),
-       OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80117000,
-               "ux500-msp-i2s.2", &msp2_platform_data),
-       OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80125000,
-               "ux500-msp-i2s.3", &msp3_platform_data),
-       {},
-};
-
-static const struct of_device_id u8500_local_bus_nodes[] = {
-       /* only create devices below soc node */
-       { .compatible = "stericsson,db8500", },
-       { .compatible = "stericsson,db8500-prcmu", },
-       { .compatible = "simple-bus"},
-       { },
-};
-
-static void __init u8500_init_machine(void)
-{
-       struct device *parent = NULL;
-       int i2c0_devs;
-       int i;
-
-       /* Pinmaps must be in place before devices register */
-       if (of_machine_is_compatible("st-ericsson,mop500"))
-               mop500_pinmaps_init();
-       else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
-               snowball_pinmaps_init();
-       else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
-               hrefv60_pinmaps_init();
-
-       parent = u8500_of_init_devices();
-
-       for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
-               mop500_platform_devs[i]->dev.parent = parent;
-
-       /* automatically probe child nodes of db8500 device */
-       of_platform_populate(NULL, u8500_local_bus_nodes, u8500_auxdata_lookup, parent);
-
-       if (of_machine_is_compatible("st-ericsson,mop500")) {
-               mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
-
-               platform_add_devices(mop500_platform_devs,
-                               ARRAY_SIZE(mop500_platform_devs));
-
-               mop500_sdi_init(parent);
-               mop500_audio_init(parent);
-               i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
-               i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
-               i2c_register_board_info(2, mop500_i2c2_devices,
-                                       ARRAY_SIZE(mop500_i2c2_devices));
-
-               mop500_uib_init();
-
-       } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
-               mop500_of_audio_init(parent);
-       } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) {
-               /*
-                * The HREFv60 board removed a GPIO expander and routed
-                * all these GPIO pins to the internal GPIO controller
-                * instead.
-                */
-               mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
-               platform_add_devices(mop500_platform_devs,
-                               ARRAY_SIZE(mop500_platform_devs));
-
-               mop500_uib_init();
-       }
-
-       /* This board has full regulator constraints */
-       regulator_has_full_constraints();
-}
-
-static const char * u8500_dt_board_compat[] = {
-       "calaosystems,snowball-a9500",
-       "st-ericsson,hrefv60+",
-       "st-ericsson,u8500",
-       "st-ericsson,mop500",
-       NULL,
-};
-
-
-DT_MACHINE_START(U8500_DT, "ST-Ericsson U8500 platform (Device Tree Support)")
-       .smp            = smp_ops(ux500_smp_ops),
-       .map_io         = u8500_map_io,
-       .init_irq       = ux500_init_irq,
-       /* we re-use nomadik timer here */
-       .timer          = &ux500_timer,
-       .handle_irq     = gic_handle_irq,
-       .init_machine   = u8500_init_machine,
-       .init_late      = ux500_init_late,
-       .dt_compat      = u8500_dt_board_compat,
+       .init_late      = NULL,
 MACHINE_END
-#endif
index aca39a68712a6a09f77f8cdf12c842346071d839..d77208232cbc87c08e7c927c208e6c99cd47edb2 100644 (file)
@@ -89,6 +89,10 @@ 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 arm_pmu_platdata db8500_pmu_platdata;
+extern struct amba_pl011_data uart0_plat;
+extern struct amba_pl011_data uart1_plat;
+extern struct amba_pl011_data uart2_plat;
+extern struct pl022_ssp_controller ssp0_plat;
 
 extern void mop500_sdi_init(struct device *parent);
 extern void snowball_sdi_init(struct device *parent);
@@ -106,8 +110,4 @@ void mop500_of_audio_init(struct device *parent);
 int __init mop500_uib_init(void);
 void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info,
                unsigned n);
-
-/* TODO: Once all pieces are DT:ed, remove completely. */
-struct device * __init u8500_of_init_devices(void);
-
 #endif
index bcdfe6b1d4534e72dc952cfa989a98ac57d84b70..4a0c40abf2ab6feb6d6df6d7795d3555d1bc4654 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/mfd/abx500/ab8500.h>
+#include <linux/mfd/dbx500-prcmu.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/regulator/machine.h>
 
 #include <asm/pmu.h>
 #include <asm/mach/map.h>
+#include <asm/mach/arch.h>
+#include <asm/hardware/gic.h>
 #include <plat/gpio-nomadik.h>
 #include <mach/hardware.h>
 #include <mach/setup.h>
@@ -29,6 +35,7 @@
 
 #include "devices-db8500.h"
 #include "ste-dma40-db8500.h"
+#include "board-mop500.h"
 
 /* minimum static i/o mapping required to boot U8500 platforms */
 static struct map_desc u8500_uart_io_desc[] __initdata = {
@@ -227,12 +234,12 @@ struct device * __init u8500_init_devices(struct ab8500_platform_data *ab8500)
        return parent;
 }
 
+#ifdef CONFIG_MACH_UX500_DT
+
 /* TODO: Once all pieces are DT:ed, remove completely. */
-struct device * __init u8500_of_init_devices(void)
+static struct device * __init u8500_of_init_devices(void)
 {
-       struct device *parent;
-
-       parent = db8500_soc_device_init();
+       struct device *parent = db8500_soc_device_init();
 
        db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg);
 
@@ -251,3 +258,96 @@ struct device * __init u8500_of_init_devices(void)
 
        return parent;
 }
+
+static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
+       /* Requires call-back bindings. */
+       OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata),
+       /* Requires DMA and call-back bindings. */
+       OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
+       OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat),
+       OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
+       /* Requires DMA bindings. */
+       OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0",  &ssp0_plat),
+       OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0",  &mop500_sdi0_data),
+       OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1",  &mop500_sdi1_data),
+       OF_DEV_AUXDATA("arm,pl18x", 0x80005000, "sdi2",  &mop500_sdi2_data),
+       OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4",  &mop500_sdi4_data),
+       /* Requires clock name bindings. */
+       OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL),
+       OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL),
+       OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e000, "gpio.2", NULL),
+       OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e080, "gpio.3", NULL),
+       OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e100, "gpio.4", NULL),
+       OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e180, "gpio.5", NULL),
+       OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL),
+       OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL),
+       OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL),
+       OF_DEV_AUXDATA("st,nomadik-i2c", 0x80004000, "nmk-i2c.0", NULL),
+       OF_DEV_AUXDATA("st,nomadik-i2c", 0x80122000, "nmk-i2c.1", NULL),
+       OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL),
+       OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL),
+       OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL),
+       /* Requires device name bindings. */
+       OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL),
+       /* Requires clock name and DMA bindings. */
+       OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000,
+               "ux500-msp-i2s.0", &msp0_platform_data),
+       OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000,
+               "ux500-msp-i2s.1", &msp1_platform_data),
+       OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80117000,
+               "ux500-msp-i2s.2", &msp2_platform_data),
+       OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80125000,
+               "ux500-msp-i2s.3", &msp3_platform_data),
+       {},
+};
+
+static const struct of_device_id u8500_local_bus_nodes[] = {
+       /* only create devices below soc node */
+       { .compatible = "stericsson,db8500", },
+       { .compatible = "stericsson,db8500-prcmu", },
+       { .compatible = "simple-bus"},
+       { },
+};
+
+static void __init u8500_init_machine(void)
+{
+       struct device *parent = NULL;
+
+       /* Pinmaps must be in place before devices register */
+       if (of_machine_is_compatible("st-ericsson,mop500"))
+               mop500_pinmaps_init();
+       else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
+               snowball_pinmaps_init();
+       else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
+               hrefv60_pinmaps_init();
+       else if (of_machine_is_compatible("st-ericsson,ccu9540")) {}
+               /* TODO: Add pinmaps for ccu9540 board. */
+
+       /* TODO: Export SoC, USB, cpu-freq and DMA40 */
+       parent = u8500_of_init_devices();
+
+       /* automatically probe child nodes of db8500 device */
+       of_platform_populate(NULL, u8500_local_bus_nodes, u8500_auxdata_lookup, parent);
+}
+
+static const char * stericsson_dt_platform_compat[] = {
+       "st-ericsson,u8500",
+       "st-ericsson,u8540",
+       "st-ericsson,u9500",
+       "st-ericsson,u9540",
+       NULL,
+};
+
+DT_MACHINE_START(U8500_DT, "ST-Ericsson Ux5x0 platform (Device Tree Support)")
+       .smp            = smp_ops(ux500_smp_ops),
+       .map_io         = u8500_map_io,
+       .init_irq       = ux500_init_irq,
+       /* we re-use nomadik timer here */
+       .timer          = &ux500_timer,
+       .handle_irq     = gic_handle_irq,
+       .init_machine   = u8500_init_machine,
+       .init_late      = NULL,
+       .dt_compat      = stericsson_dt_platform_compat,
+MACHINE_END
+
+#endif
index 1f3fbc2bb7768a4389e8c7796affdfb65f521d1b..721e7b4275f3bc6496ff4ccb29fc419b572719f7 100644 (file)
@@ -26,6 +26,8 @@
 #include <mach/setup.h>
 #include <mach/devices.h>
 
+#include "board-mop500.h"
+
 void __iomem *_PRCMU_BASE;
 
 /*
@@ -82,6 +84,7 @@ void __init ux500_init_irq(void)
 
 void __init ux500_init_late(void)
 {
+       mop500_uib_init();
 }
 
 static const char * __init ux500_get_machine(void)
index 023f443784ec0b1fd438e7a9637702ef1e58fbaf..b820edaf31843fb309fc29f882ce9d4e80c04c62 100644 (file)
@@ -745,7 +745,7 @@ do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs,
 static int
 do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
 {
-       union offset_union offset;
+       union offset_union uninitialized_var(offset);
        unsigned long instr = 0, instrptr;
        int (*handler)(unsigned long addr, unsigned long instr, struct pt_regs *regs);
        unsigned int type;
diff --git a/arch/arm/plat-mxc/Kconfig b/arch/arm/plat-mxc/Kconfig
deleted file mode 100644 (file)
index 88e1e2e..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-if ARCH_MXC
-
-source "arch/arm/plat-mxc/devices/Kconfig"
-
-menu "Freescale MXC Implementations"
-
-choice
-       prompt "Freescale CPU family:"
-       default ARCH_IMX_V6_V7
-
-config ARCH_IMX_V4_V5
-       bool "i.MX1, i.MX21, i.MX25, i.MX27"
-       select ARM_PATCH_PHYS_VIRT
-       select AUTO_ZRELADDR if !ZBOOT_ROM
-       help
-         This enables support for systems based on the Freescale i.MX ARMv4
-         and ARMv5 SoCs
-
-config ARCH_IMX_V6_V7
-       bool "i.MX3, i.MX5, i.MX6"
-       select ARM_PATCH_PHYS_VIRT
-       select AUTO_ZRELADDR if !ZBOOT_ROM
-       select MIGHT_HAVE_CACHE_L2X0
-       help
-         This enables support for systems based on the Freescale i.MX3, i.MX5
-         and i.MX6 family.
-
-endchoice
-
-source "arch/arm/mach-imx/Kconfig"
-
-endmenu
-
-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 even IRQF_DISABLED flag is not set.
-         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
-
-config MXC_AVIC
-       bool
-
-config MXC_DEBUG_BOARD
-       bool "Enable MXC debug board(for 3-stack)"
-       help
-         The debug board is an integral part of the MXC 3-stack(PDK)
-         platforms, it can be attached or removed from the peripheral
-         board. On debug board, several debug devices(ethernet, UART,
-         buttons, LEDs and JTAG) are implemented. Between the MCU and
-         these devices, a CPLD is added as a bridge which performs
-         data/address de-multiplexing and decode, signal level shift,
-         interrupt control and various board functions.
-
-config HAVE_EPIT
-       bool
-
-config MXC_USE_EPIT
-       bool "Use EPIT instead of GPT"
-       depends on HAVE_EPIT
-       help
-         Use EPIT as the system timer on systems that have it. Normally you
-         don't have a reason to do so as the EPIT has the same features and
-         uses the same clocks as the GPT. Anyway, on some systems the GPT
-         may be in use for other purposes.
-
-config MXC_ULPI
-       bool
-
-config ARCH_HAS_RNGA
-       bool
-
-config IMX_HAVE_IOMUX_V1
-       bool
-
-config ARCH_MXC_IOMUX_V3
-       bool
-
-config IRAM_ALLOC
-       bool
-       select GENERIC_ALLOCATOR
-
-endif
diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile
deleted file mode 100644 (file)
index 149237e..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Makefile for the linux kernel.
-#
-
-# Common support
-obj-y := time.o devices.o cpu.o system.o irq-common.o
-
-obj-$(CONFIG_MXC_TZIC) += tzic.o
-obj-$(CONFIG_MXC_AVIC) += avic.o
-
-obj-$(CONFIG_IMX_HAVE_IOMUX_V1) += iomux-v1.o
-obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o
-obj-$(CONFIG_IRAM_ALLOC) += iram_alloc.o
-obj-$(CONFIG_MXC_ULPI) += ulpi.o
-obj-$(CONFIG_MXC_USE_EPIT) += epit.o
-obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
-obj-$(CONFIG_CPU_FREQ_IMX)    += cpufreq.o
-obj-$(CONFIG_CPU_IDLE) += cpuidle.o
-ifdef CONFIG_SND_IMX_SOC
-obj-y += ssi-fiq.o
-obj-y += ssi-fiq-ksym.o
-endif
-
-obj-y += devices/
diff --git a/arch/arm/plat-mxc/include/mach/irqs.h b/arch/arm/plat-mxc/include/mach/irqs.h
deleted file mode 100644 (file)
index d73f5e8..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- *  Copyright 2004-2007 Freescale Semiconductor, 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 version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef __ASM_ARCH_MXC_IRQS_H__
-#define __ASM_ARCH_MXC_IRQS_H__
-
-extern int imx_irq_set_priority(unsigned char irq, unsigned char prio);
-
-/* all normal IRQs can be FIQs */
-#define FIQ_START      0
-/* switch between IRQ and FIQ */
-extern int mxc_set_irq_fiq(unsigned int irq, unsigned int type);
-
-#endif /* __ASM_ARCH_MXC_IRQS_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/timex.h b/arch/arm/plat-mxc/include/mach/timex.h
deleted file mode 100644 (file)
index 10343d1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- *  Copyright (C) 1999 ARM Limited
- * Copyright 2004-2007 Freescale Semiconductor, 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; 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.
- */
-
-#ifndef __ASM_ARCH_MXC_TIMEX_H__
-#define __ASM_ARCH_MXC_TIMEX_H__
-
-/* Bogus value */
-#define CLOCK_TICK_RATE        12345678
-
-#endif                         /* __ASM_ARCH_MXC_TIMEX_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/uncompress.h b/arch/arm/plat-mxc/include/mach/uncompress.h
deleted file mode 100644 (file)
index 477971b..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- *  arch/arm/plat-mxc/include/mach/uncompress.h
- *
- *  Copyright (C) 1999 ARM Limited
- *  Copyright (C) Shane Nay (shane@minirl.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.
- */
-#ifndef __ASM_ARCH_MXC_UNCOMPRESS_H__
-#define __ASM_ARCH_MXC_UNCOMPRESS_H__
-
-#define __MXC_BOOT_UNCOMPRESS
-
-#include <asm/mach-types.h>
-
-unsigned long uart_base;
-
-#define UART(x) (*(volatile unsigned long *)(uart_base + (x)))
-
-#define USR2 0x98
-#define USR2_TXFE (1<<14)
-#define TXR  0x40
-#define UCR1 0x80
-#define UCR1_UARTEN 1
-
-/*
- * The following code assumes the serial port has already been
- * initialized by the bootloader.  We search for the first enabled
- * port in the most probable order.  If you didn't setup a port in
- * your bootloader then nothing will appear (which might be desired).
- *
- * This does not append a newline
- */
-
-static void putc(int ch)
-{
-       if (!uart_base)
-               return;
-       if (!(UART(UCR1) & UCR1_UARTEN))
-               return;
-
-       while (!(UART(USR2) & USR2_TXFE))
-               barrier();
-
-       UART(TXR) = ch;
-}
-
-static inline void flush(void)
-{
-}
-
-#define MX1_UART1_BASE_ADDR    0x00206000
-#define MX25_UART1_BASE_ADDR   0x43f90000
-#define MX2X_UART1_BASE_ADDR   0x1000a000
-#define MX3X_UART1_BASE_ADDR   0x43F90000
-#define MX3X_UART2_BASE_ADDR   0x43F94000
-#define MX3X_UART5_BASE_ADDR   0x43FB4000
-#define MX51_UART1_BASE_ADDR   0x73fbc000
-#define MX50_UART1_BASE_ADDR   0x53fbc000
-#define MX53_UART1_BASE_ADDR   0x53fbc000
-
-static __inline__ void __arch_decomp_setup(unsigned long arch_id)
-{
-       switch (arch_id) {
-       case MACH_TYPE_MX1ADS:
-       case MACH_TYPE_SCB9328:
-               uart_base = MX1_UART1_BASE_ADDR;
-               break;
-       case MACH_TYPE_MX25_3DS:
-               uart_base = MX25_UART1_BASE_ADDR;
-               break;
-       case MACH_TYPE_IMX27LITE:
-       case MACH_TYPE_MX27_3DS:
-       case MACH_TYPE_MX27ADS:
-       case MACH_TYPE_PCM038:
-       case MACH_TYPE_MX21ADS:
-       case MACH_TYPE_PCA100:
-       case MACH_TYPE_MXT_TD60:
-       case MACH_TYPE_IMX27IPCAM:
-               uart_base = MX2X_UART1_BASE_ADDR;
-               break;
-       case MACH_TYPE_MX31LITE:
-       case MACH_TYPE_ARMADILLO5X0:
-       case MACH_TYPE_MX31MOBOARD:
-       case MACH_TYPE_QONG:
-       case MACH_TYPE_MX31_3DS:
-       case MACH_TYPE_PCM037:
-       case MACH_TYPE_MX31ADS:
-       case MACH_TYPE_MX35_3DS:
-       case MACH_TYPE_PCM043:
-       case MACH_TYPE_LILLY1131:
-       case MACH_TYPE_VPR200:
-       case MACH_TYPE_EUKREA_CPUIMX35SD:
-               uart_base = MX3X_UART1_BASE_ADDR;
-               break;
-       case MACH_TYPE_MAGX_ZN5:
-               uart_base = MX3X_UART2_BASE_ADDR;
-               break;
-       case MACH_TYPE_BUG:
-               uart_base = MX3X_UART5_BASE_ADDR;
-               break;
-       case MACH_TYPE_MX51_BABBAGE:
-       case MACH_TYPE_EUKREA_CPUIMX51SD:
-       case MACH_TYPE_MX51_3DS:
-               uart_base = MX51_UART1_BASE_ADDR;
-               break;
-       case MACH_TYPE_MX50_RDP:
-               uart_base = MX50_UART1_BASE_ADDR;
-               break;
-       case MACH_TYPE_MX53_EVK:
-       case MACH_TYPE_MX53_LOCO:
-       case MACH_TYPE_MX53_SMD:
-       case MACH_TYPE_MX53_ARD:
-               uart_base = MX53_UART1_BASE_ADDR;
-               break;
-       default:
-               break;
-       }
-}
-
-#define arch_decomp_setup()    __arch_decomp_setup(arch_id)
-#define arch_decomp_wdog()
-
-#endif                         /* __ASM_ARCH_MXC_UNCOMPRESS_H__ */
index dacaee009a4efd21bdbcfd11ad0a820828316ef8..8d885848600ad9d8e9fea7db1095531d4bd9a2a1 100644 (file)
@@ -3,13 +3,12 @@
 #
 
 # Common support
-obj-y := common.o sram.o clock.o dma.o fb.o counter_32k.o
+obj-y := sram.o dma.o fb.o counter_32k.o
 obj-m :=
 obj-n :=
 obj-  :=
 
 # omap_device support (OMAP2+ only at the moment)
-obj-$(CONFIG_ARCH_OMAP2PLUS) += omap_device.o
 
 obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
 obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o
@@ -20,4 +19,3 @@ obj-y += $(i2c-omap-m) $(i2c-omap-y)
 # OMAP mailbox framework
 obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o
 
-obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
deleted file mode 100644 (file)
index 9d7ac20..0000000
+++ /dev/null
@@ -1,544 +0,0 @@
-/*
- *  linux/arch/arm/plat-omap/clock.c
- *
- *  Copyright (C) 2004 - 2008 Nokia corporation
- *  Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
- *
- *  Modified for omap shared clock framework by Tony Lindgren <tony@atomide.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/list.h>
-#include <linux/errno.h>
-#include <linux/export.h>
-#include <linux/err.h>
-#include <linux/string.h>
-#include <linux/clk.h>
-#include <linux/mutex.h>
-#include <linux/cpufreq.h>
-#include <linux/io.h>
-
-#include <plat/clock.h>
-
-static LIST_HEAD(clocks);
-static DEFINE_MUTEX(clocks_mutex);
-static DEFINE_SPINLOCK(clockfw_lock);
-
-static struct clk_functions *arch_clock;
-
-/*
- * Standard clock functions defined in include/linux/clk.h
- */
-
-int clk_enable(struct clk *clk)
-{
-       unsigned long flags;
-       int ret;
-
-       if (clk == NULL || IS_ERR(clk))
-               return -EINVAL;
-
-       if (!arch_clock || !arch_clock->clk_enable)
-               return -EINVAL;
-
-       spin_lock_irqsave(&clockfw_lock, flags);
-       ret = arch_clock->clk_enable(clk);
-       spin_unlock_irqrestore(&clockfw_lock, flags);
-
-       return ret;
-}
-EXPORT_SYMBOL(clk_enable);
-
-void clk_disable(struct clk *clk)
-{
-       unsigned long flags;
-
-       if (clk == NULL || IS_ERR(clk))
-               return;
-
-       if (!arch_clock || !arch_clock->clk_disable)
-               return;
-
-       spin_lock_irqsave(&clockfw_lock, flags);
-       if (clk->usecount == 0) {
-               pr_err("Trying disable clock %s with 0 usecount\n",
-                      clk->name);
-               WARN_ON(1);
-               goto out;
-       }
-
-       arch_clock->clk_disable(clk);
-
-out:
-       spin_unlock_irqrestore(&clockfw_lock, flags);
-}
-EXPORT_SYMBOL(clk_disable);
-
-unsigned long clk_get_rate(struct clk *clk)
-{
-       unsigned long flags;
-       unsigned long ret;
-
-       if (clk == NULL || IS_ERR(clk))
-               return 0;
-
-       spin_lock_irqsave(&clockfw_lock, flags);
-       ret = clk->rate;
-       spin_unlock_irqrestore(&clockfw_lock, flags);
-
-       return ret;
-}
-EXPORT_SYMBOL(clk_get_rate);
-
-/*
- * Optional clock functions defined in include/linux/clk.h
- */
-
-long clk_round_rate(struct clk *clk, unsigned long rate)
-{
-       unsigned long flags;
-       long ret;
-
-       if (clk == NULL || IS_ERR(clk))
-               return 0;
-
-       if (!arch_clock || !arch_clock->clk_round_rate)
-               return 0;
-
-       spin_lock_irqsave(&clockfw_lock, flags);
-       ret = arch_clock->clk_round_rate(clk, rate);
-       spin_unlock_irqrestore(&clockfw_lock, flags);
-
-       return ret;
-}
-EXPORT_SYMBOL(clk_round_rate);
-
-int clk_set_rate(struct clk *clk, unsigned long rate)
-{
-       unsigned long flags;
-       int ret = -EINVAL;
-
-       if (clk == NULL || IS_ERR(clk))
-               return ret;
-
-       if (!arch_clock || !arch_clock->clk_set_rate)
-               return ret;
-
-       spin_lock_irqsave(&clockfw_lock, flags);
-       ret = arch_clock->clk_set_rate(clk, rate);
-       if (ret == 0)
-               propagate_rate(clk);
-       spin_unlock_irqrestore(&clockfw_lock, flags);
-
-       return ret;
-}
-EXPORT_SYMBOL(clk_set_rate);
-
-int clk_set_parent(struct clk *clk, struct clk *parent)
-{
-       unsigned long flags;
-       int ret = -EINVAL;
-
-       if (clk == NULL || IS_ERR(clk) || parent == NULL || IS_ERR(parent))
-               return ret;
-
-       if (!arch_clock || !arch_clock->clk_set_parent)
-               return ret;
-
-       spin_lock_irqsave(&clockfw_lock, flags);
-       if (clk->usecount == 0) {
-               ret = arch_clock->clk_set_parent(clk, parent);
-               if (ret == 0)
-                       propagate_rate(clk);
-       } else
-               ret = -EBUSY;
-       spin_unlock_irqrestore(&clockfw_lock, flags);
-
-       return ret;
-}
-EXPORT_SYMBOL(clk_set_parent);
-
-struct clk *clk_get_parent(struct clk *clk)
-{
-       return clk->parent;
-}
-EXPORT_SYMBOL(clk_get_parent);
-
-/*
- * OMAP specific clock functions shared between omap1 and omap2
- */
-
-int __initdata mpurate;
-
-/*
- * By default we use the rate set by the bootloader.
- * You can override this with mpurate= cmdline option.
- */
-static int __init omap_clk_setup(char *str)
-{
-       get_option(&str, &mpurate);
-
-       if (!mpurate)
-               return 1;
-
-       if (mpurate < 1000)
-               mpurate *= 1000000;
-
-       return 1;
-}
-__setup("mpurate=", omap_clk_setup);
-
-/* Used for clocks that always have same value as the parent clock */
-unsigned long followparent_recalc(struct clk *clk)
-{
-       return clk->parent->rate;
-}
-
-/*
- * Used for clocks that have the same value as the parent clock,
- * divided by some factor
- */
-unsigned long omap_fixed_divisor_recalc(struct clk *clk)
-{
-       WARN_ON(!clk->fixed_div);
-
-       return clk->parent->rate / clk->fixed_div;
-}
-
-void clk_reparent(struct clk *child, struct clk *parent)
-{
-       list_del_init(&child->sibling);
-       if (parent)
-               list_add(&child->sibling, &parent->children);
-       child->parent = parent;
-
-       /* now do the debugfs renaming to reattach the child
-          to the proper parent */
-}
-
-/* Propagate rate to children */
-void propagate_rate(struct clk *tclk)
-{
-       struct clk *clkp;
-
-       list_for_each_entry(clkp, &tclk->children, sibling) {
-               if (clkp->recalc)
-                       clkp->rate = clkp->recalc(clkp);
-               propagate_rate(clkp);
-       }
-}
-
-static LIST_HEAD(root_clks);
-
-/**
- * recalculate_root_clocks - recalculate and propagate all root clocks
- *
- * Recalculates all root clocks (clocks with no parent), which if the
- * clock's .recalc is set correctly, should also propagate their rates.
- * Called at init.
- */
-void recalculate_root_clocks(void)
-{
-       struct clk *clkp;
-
-       list_for_each_entry(clkp, &root_clks, sibling) {
-               if (clkp->recalc)
-                       clkp->rate = clkp->recalc(clkp);
-               propagate_rate(clkp);
-       }
-}
-
-/**
- * clk_preinit - initialize any fields in the struct clk before clk init
- * @clk: struct clk * to initialize
- *
- * Initialize any struct clk fields needed before normal clk initialization
- * can run.  No return value.
- */
-void clk_preinit(struct clk *clk)
-{
-       INIT_LIST_HEAD(&clk->children);
-}
-
-int clk_register(struct clk *clk)
-{
-       if (clk == NULL || IS_ERR(clk))
-               return -EINVAL;
-
-       /*
-        * trap out already registered clocks
-        */
-       if (clk->node.next || clk->node.prev)
-               return 0;
-
-       mutex_lock(&clocks_mutex);
-       if (clk->parent)
-               list_add(&clk->sibling, &clk->parent->children);
-       else
-               list_add(&clk->sibling, &root_clks);
-
-       list_add(&clk->node, &clocks);
-       if (clk->init)
-               clk->init(clk);
-       mutex_unlock(&clocks_mutex);
-
-       return 0;
-}
-EXPORT_SYMBOL(clk_register);
-
-void clk_unregister(struct clk *clk)
-{
-       if (clk == NULL || IS_ERR(clk))
-               return;
-
-       mutex_lock(&clocks_mutex);
-       list_del(&clk->sibling);
-       list_del(&clk->node);
-       mutex_unlock(&clocks_mutex);
-}
-EXPORT_SYMBOL(clk_unregister);
-
-void clk_enable_init_clocks(void)
-{
-       struct clk *clkp;
-
-       list_for_each_entry(clkp, &clocks, node) {
-               if (clkp->flags & ENABLE_ON_INIT)
-                       clk_enable(clkp);
-       }
-}
-
-int omap_clk_enable_autoidle_all(void)
-{
-       struct clk *c;
-       unsigned long flags;
-
-       spin_lock_irqsave(&clockfw_lock, flags);
-
-       list_for_each_entry(c, &clocks, node)
-               if (c->ops->allow_idle)
-                       c->ops->allow_idle(c);
-
-       spin_unlock_irqrestore(&clockfw_lock, flags);
-
-       return 0;
-}
-
-int omap_clk_disable_autoidle_all(void)
-{
-       struct clk *c;
-       unsigned long flags;
-
-       spin_lock_irqsave(&clockfw_lock, flags);
-
-       list_for_each_entry(c, &clocks, node)
-               if (c->ops->deny_idle)
-                       c->ops->deny_idle(c);
-
-       spin_unlock_irqrestore(&clockfw_lock, flags);
-
-       return 0;
-}
-
-/*
- * Low level helpers
- */
-static int clkll_enable_null(struct clk *clk)
-{
-       return 0;
-}
-
-static void clkll_disable_null(struct clk *clk)
-{
-}
-
-const struct clkops clkops_null = {
-       .enable         = clkll_enable_null,
-       .disable        = clkll_disable_null,
-};
-
-/*
- * Dummy clock
- *
- * Used for clock aliases that are needed on some OMAPs, but not others
- */
-struct clk dummy_ck = {
-       .name   = "dummy",
-       .ops    = &clkops_null,
-};
-
-/*
- *
- */
-
-#ifdef CONFIG_OMAP_RESET_CLOCKS
-/*
- * Disable any unused clocks left on by the bootloader
- */
-static int __init clk_disable_unused(void)
-{
-       struct clk *ck;
-       unsigned long flags;
-
-       if (!arch_clock || !arch_clock->clk_disable_unused)
-               return 0;
-
-       pr_info("clock: disabling unused clocks to save power\n");
-
-       spin_lock_irqsave(&clockfw_lock, flags);
-       list_for_each_entry(ck, &clocks, node) {
-               if (ck->ops == &clkops_null)
-                       continue;
-
-               if (ck->usecount > 0 || !ck->enable_reg)
-                       continue;
-
-               arch_clock->clk_disable_unused(ck);
-       }
-       spin_unlock_irqrestore(&clockfw_lock, flags);
-
-       return 0;
-}
-late_initcall(clk_disable_unused);
-late_initcall(omap_clk_enable_autoidle_all);
-#endif
-
-int __init clk_init(struct clk_functions * custom_clocks)
-{
-       if (!custom_clocks) {
-               pr_err("No custom clock functions registered\n");
-               BUG();
-       }
-
-       arch_clock = custom_clocks;
-
-       return 0;
-}
-
-#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
-/*
- *     debugfs support to trace clock tree hierarchy and attributes
- */
-
-#include <linux/debugfs.h>
-#include <linux/seq_file.h>
-
-static struct dentry *clk_debugfs_root;
-
-static int clk_dbg_show_summary(struct seq_file *s, void *unused)
-{
-       struct clk *c;
-       struct clk *pa;
-
-       mutex_lock(&clocks_mutex);
-       seq_printf(s, "%-30s %-30s %-10s %s\n",
-               "clock-name", "parent-name", "rate", "use-count");
-
-       list_for_each_entry(c, &clocks, node) {
-               pa = c->parent;
-               seq_printf(s, "%-30s %-30s %-10lu %d\n",
-                       c->name, pa ? pa->name : "none", c->rate, c->usecount);
-       }
-       mutex_unlock(&clocks_mutex);
-
-       return 0;
-}
-
-static int clk_dbg_open(struct inode *inode, struct file *file)
-{
-       return single_open(file, clk_dbg_show_summary, inode->i_private);
-}
-
-static const struct file_operations debug_clock_fops = {
-       .open           = clk_dbg_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
-};
-
-static int clk_debugfs_register_one(struct clk *c)
-{
-       int err;
-       struct dentry *d;
-       struct clk *pa = c->parent;
-
-       d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root);
-       if (!d)
-               return -ENOMEM;
-       c->dent = d;
-
-       d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usecount);
-       if (!d) {
-               err = -ENOMEM;
-               goto err_out;
-       }
-       d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
-       if (!d) {
-               err = -ENOMEM;
-               goto err_out;
-       }
-       d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
-       if (!d) {
-               err = -ENOMEM;
-               goto err_out;
-       }
-       return 0;
-
-err_out:
-       debugfs_remove_recursive(c->dent);
-       return err;
-}
-
-static int clk_debugfs_register(struct clk *c)
-{
-       int err;
-       struct clk *pa = c->parent;
-
-       if (pa && !pa->dent) {
-               err = clk_debugfs_register(pa);
-               if (err)
-                       return err;
-       }
-
-       if (!c->dent) {
-               err = clk_debugfs_register_one(c);
-               if (err)
-                       return err;
-       }
-       return 0;
-}
-
-static int __init clk_debugfs_init(void)
-{
-       struct clk *c;
-       struct dentry *d;
-       int err;
-
-       d = debugfs_create_dir("clock", NULL);
-       if (!d)
-               return -ENOMEM;
-       clk_debugfs_root = d;
-
-       list_for_each_entry(c, &clocks, node) {
-               err = clk_debugfs_register(c);
-               if (err)
-                       goto err_out;
-       }
-
-       d = debugfs_create_file("summary", S_IRUGO,
-               d, NULL, &debug_clock_fops);
-       if (!d)
-               return -ENOMEM;
-
-       return 0;
-err_out:
-       debugfs_remove_recursive(clk_debugfs_root);
-       return err;
-}
-late_initcall(clk_debugfs_init);
-
-#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
deleted file mode 100644 (file)
index 111315a..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * linux/arch/arm/plat-omap/common.c
- *
- * Code common to all OMAP machines.
- * The file is created by Tony Lindgren <tony@atomide.com>
- *
- * Copyright (C) 2009 Texas Instruments
- * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/io.h>
-#include <linux/dma-mapping.h>
-
-#include <plat/common.h>
-#include <plat/vram.h>
-#include <linux/platform_data/dsp-omap.h>
-#include <plat/dma.h>
-
-#include <plat/omap-secure.h>
-
-void __init omap_reserve(void)
-{
-       omap_vram_reserve_sdram_memblock();
-       omap_dsp_reserve_sdram_memblock();
-       omap_secure_ram_reserve_memblock();
-       omap_barrier_reserve_memblock();
-}
-
-void __init omap_init_consistent_dma_size(void)
-{
-#ifdef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
-       init_consistent_dma_size(CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE << 20);
-#endif
-}
-
-/*
- * Stub function for OMAP2 so that common files
- * continue to build when custom builds are used
- */
-int __weak omap_secure_ram_reserve_memblock(void)
-{
-       return 0;
-}
index 87ba8dd0d7910c2072e2b22fa5f4a4f58f79fbc9..f3771cdb98385917f95526e1fa0b69f443620f13 100644 (file)
@@ -22,9 +22,6 @@
 #include <asm/mach/time.h>
 #include <asm/sched_clock.h>
 
-#include <plat/common.h>
-#include <plat/clock.h>
-
 /* OMAP2_32KSYNCNT_CR_OFF: offset of 32ksync counter register */
 #define OMAP2_32KSYNCNT_REV_OFF                0x0
 #define OMAP2_32KSYNCNT_REV_SCHEME     (0x3 << 30)
index 5a4678edd65a9a8eb31a766fd566ee86a968e8f9..a609e2161817d403ebee91844848f073efd42f3e 100644 (file)
@@ -15,8 +15,7 @@
 #include <linux/io.h>
 #include <linux/smc91x.h>
 
-#include <mach/hardware.h>
-#include "../mach-omap2/debug-devices.h"
+#include <plat/debug-devices.h>
 
 /* Many OMAP development platforms reuse the same "debug board"; these
  * platforms include H2, H3, H4, and Perseus2.
index ea29bbe8e5cfd5168a864e9fa53783376dcfefab..c43ea21f33b4352b07bdfedc206737d3abd71b27 100644 (file)
 #include <linux/platform_data/gpio-omap.h>
 #include <linux/slab.h>
 
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 
-#include <plat/fpga.h>
-
 /* Many OMAP development platforms reuse the same "debug board"; these
  * platforms include H2, H3, H4, and Perseus2.  There are 16 LEDs on the
  * debug board (all green), accessed through FPGA registers.
  */
 
+/* NOTE:  most boards don't have a static mapping for the FPGA ... */
+struct h2p2_dbg_fpga {
+       /* offset 0x00 */
+       u16             smc91x[8];
+       /* offset 0x10 */
+       u16             fpga_rev;
+       u16             board_rev;
+       u16             gpio_outputs;
+       u16             leds;
+       /* offset 0x18 */
+       u16             misc_inputs;
+       u16             lan_status;
+       u16             lan_reset;
+       u16             reserved0;
+       /* offset 0x20 */
+       u16             ps2_data;
+       u16             ps2_ctrl;
+       /* plus also 4 rs232 ports ... */
+};
+
 static struct h2p2_dbg_fpga __iomem *fpga;
 
 static u16 fpga_led_state;
index c76ed8bff8389c752f389ac0c26253ff39dc4802..c288b76f8e6cf1e0b372fe8f98b036a137cf0591 100644 (file)
@@ -36,9 +36,7 @@
 #include <linux/slab.h>
 #include <linux/delay.h>
 
-#include <plat/cpu.h>
-#include <plat/dma.h>
-#include <plat/tc.h>
+#include <plat-omap/dma-omap.h>
 
 /*
  * MAX_LOGICAL_DMA_CH_COUNT: the maximum number of logical DMA
@@ -175,12 +173,13 @@ static inline void set_gdma_dev(int req, int dev)
 #define omap_writel(val, reg)  do {} while (0)
 #endif
 
+#ifdef CONFIG_ARCH_OMAP1
 void omap_set_dma_priority(int lch, int dst_port, int priority)
 {
        unsigned long reg;
        u32 l;
 
-       if (cpu_class_is_omap1()) {
+       if (dma_omap1()) {
                switch (dst_port) {
                case OMAP_DMA_PORT_OCP_T1:      /* FFFECC00 */
                        reg = OMAP_TC_OCPT1_PRIOR;
@@ -203,18 +202,22 @@ void omap_set_dma_priority(int lch, int dst_port, int priority)
                l |= (priority & 0xf) << 8;
                omap_writel(l, reg);
        }
+}
+#endif
 
-       if (cpu_class_is_omap2()) {
-               u32 ccr;
+#ifdef CONFIG_ARCH_OMAP2PLUS
+void omap_set_dma_priority(int lch, int dst_port, int priority)
+{
+       u32 ccr;
 
-               ccr = p->dma_read(CCR, lch);
-               if (priority)
-                       ccr |= (1 << 6);
-               else
-                       ccr &= ~(1 << 6);
-               p->dma_write(ccr, CCR, lch);
-       }
+       ccr = p->dma_read(CCR, lch);
+       if (priority)
+               ccr |= (1 << 6);
+       else
+               ccr &= ~(1 << 6);
+       p->dma_write(ccr, CCR, lch);
 }
+#endif
 EXPORT_SYMBOL(omap_set_dma_priority);
 
 void omap_set_dma_transfer_params(int lch, int data_type, int elem_count,
@@ -228,7 +231,7 @@ void omap_set_dma_transfer_params(int lch, int data_type, int elem_count,
        l |= data_type;
        p->dma_write(l, CSDP, lch);
 
-       if (cpu_class_is_omap1()) {
+       if (dma_omap1()) {
                u16 ccr;
 
                ccr = p->dma_read(CCR, lch);
@@ -244,7 +247,7 @@ void omap_set_dma_transfer_params(int lch, int data_type, int elem_count,
                p->dma_write(ccr, CCR2, lch);
        }
 
-       if (cpu_class_is_omap2() && dma_trigger) {
+       if (dma_omap2plus() && dma_trigger) {
                u32 val;
 
                val = p->dma_read(CCR, lch);
@@ -284,7 +287,7 @@ void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color)
 {
        BUG_ON(omap_dma_in_1510_mode());
 
-       if (cpu_class_is_omap1()) {
+       if (dma_omap1()) {
                u16 w;
 
                w = p->dma_read(CCR2, lch);
@@ -314,7 +317,7 @@ void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color)
                p->dma_write(w, LCH_CTRL, lch);
        }
 
-       if (cpu_class_is_omap2()) {
+       if (dma_omap2plus()) {
                u32 val;
 
                val = p->dma_read(CCR, lch);
@@ -342,7 +345,7 @@ EXPORT_SYMBOL(omap_set_dma_color_mode);
 
 void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode)
 {
-       if (cpu_class_is_omap2()) {
+       if (dma_omap2plus()) {
                u32 csdp;
 
                csdp = p->dma_read(CSDP, lch);
@@ -355,7 +358,7 @@ EXPORT_SYMBOL(omap_set_dma_write_mode);
 
 void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode)
 {
-       if (cpu_class_is_omap1() && !cpu_is_omap15xx()) {
+       if (dma_omap1() && !dma_omap15xx()) {
                u32 l;
 
                l = p->dma_read(LCH_CTRL, lch);
@@ -373,7 +376,7 @@ void omap_set_dma_src_params(int lch, int src_port, int src_amode,
 {
        u32 l;
 
-       if (cpu_class_is_omap1()) {
+       if (dma_omap1()) {
                u16 w;
 
                w = p->dma_read(CSDP, lch);
@@ -415,7 +418,7 @@ EXPORT_SYMBOL(omap_set_dma_params);
 
 void omap_set_dma_src_index(int lch, int eidx, int fidx)
 {
-       if (cpu_class_is_omap2())
+       if (dma_omap2plus())
                return;
 
        p->dma_write(eidx, CSEI, lch);
@@ -447,13 +450,13 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
        case OMAP_DMA_DATA_BURST_DIS:
                break;
        case OMAP_DMA_DATA_BURST_4:
-               if (cpu_class_is_omap2())
+               if (dma_omap2plus())
                        burst = 0x1;
                else
                        burst = 0x2;
                break;
        case OMAP_DMA_DATA_BURST_8:
-               if (cpu_class_is_omap2()) {
+               if (dma_omap2plus()) {
                        burst = 0x2;
                        break;
                }
@@ -463,7 +466,7 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
                 * fall through
                 */
        case OMAP_DMA_DATA_BURST_16:
-               if (cpu_class_is_omap2()) {
+               if (dma_omap2plus()) {
                        burst = 0x3;
                        break;
                }
@@ -487,7 +490,7 @@ void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode,
 {
        u32 l;
 
-       if (cpu_class_is_omap1()) {
+       if (dma_omap1()) {
                l = p->dma_read(CSDP, lch);
                l &= ~(0x1f << 9);
                l |= dest_port << 9;
@@ -508,7 +511,7 @@ EXPORT_SYMBOL(omap_set_dma_dest_params);
 
 void omap_set_dma_dest_index(int lch, int eidx, int fidx)
 {
-       if (cpu_class_is_omap2())
+       if (dma_omap2plus())
                return;
 
        p->dma_write(eidx, CDEI, lch);
@@ -540,19 +543,19 @@ void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
        case OMAP_DMA_DATA_BURST_DIS:
                break;
        case OMAP_DMA_DATA_BURST_4:
-               if (cpu_class_is_omap2())
+               if (dma_omap2plus())
                        burst = 0x1;
                else
                        burst = 0x2;
                break;
        case OMAP_DMA_DATA_BURST_8:
-               if (cpu_class_is_omap2())
+               if (dma_omap2plus())
                        burst = 0x2;
                else
                        burst = 0x3;
                break;
        case OMAP_DMA_DATA_BURST_16:
-               if (cpu_class_is_omap2()) {
+               if (dma_omap2plus()) {
                        burst = 0x3;
                        break;
                }
@@ -573,7 +576,7 @@ EXPORT_SYMBOL(omap_set_dma_dest_burst_mode);
 static inline void omap_enable_channel_irq(int lch)
 {
        /* Clear CSR */
-       if (cpu_class_is_omap1())
+       if (dma_omap1())
                p->dma_read(CSR, lch);
        else
                p->dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR, lch);
@@ -587,7 +590,7 @@ static inline void omap_disable_channel_irq(int lch)
        /* disable channel interrupts */
        p->dma_write(0, CICR, lch);
        /* Clear CSR */
-       if (cpu_class_is_omap1())
+       if (dma_omap1())
                p->dma_read(CSR, lch);
        else
                p->dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR, lch);
@@ -611,7 +614,7 @@ static inline void enable_lnk(int lch)
 
        l = p->dma_read(CLNK_CTRL, lch);
 
-       if (cpu_class_is_omap1())
+       if (dma_omap1())
                l &= ~(1 << 14);
 
        /* Set the ENABLE_LNK bits */
@@ -619,7 +622,7 @@ static inline void enable_lnk(int lch)
                l = dma_chan[lch].next_lch | (1 << 15);
 
 #ifndef CONFIG_ARCH_OMAP1
-       if (cpu_class_is_omap2())
+       if (dma_omap2plus())
                if (dma_chan[lch].next_linked_ch != -1)
                        l = dma_chan[lch].next_linked_ch | (1 << 15);
 #endif
@@ -636,12 +639,12 @@ static inline void disable_lnk(int lch)
        /* Disable interrupts */
        omap_disable_channel_irq(lch);
 
-       if (cpu_class_is_omap1()) {
+       if (dma_omap1()) {
                /* Set the STOP_LNK bit */
                l |= 1 << 14;
        }
 
-       if (cpu_class_is_omap2()) {
+       if (dma_omap2plus()) {
                /* Clear the ENABLE_LNK bit */
                l &= ~(1 << 15);
        }
@@ -655,7 +658,7 @@ static inline void omap2_enable_irq_lch(int lch)
        u32 val;
        unsigned long flags;
 
-       if (!cpu_class_is_omap2())
+       if (dma_omap1())
                return;
 
        spin_lock_irqsave(&dma_chan_lock, flags);
@@ -673,7 +676,7 @@ static inline void omap2_disable_irq_lch(int lch)
        u32 val;
        unsigned long flags;
 
-       if (!cpu_class_is_omap2())
+       if (dma_omap1())
                return;
 
        spin_lock_irqsave(&dma_chan_lock, flags);
@@ -712,7 +715,7 @@ int omap_request_dma(int dev_id, const char *dev_name,
        if (p->clear_lch_regs)
                p->clear_lch_regs(free_ch);
 
-       if (cpu_class_is_omap2())
+       if (dma_omap2plus())
                omap_clear_dma(free_ch);
 
        spin_unlock_irqrestore(&dma_chan_lock, flags);
@@ -723,7 +726,7 @@ int omap_request_dma(int dev_id, const char *dev_name,
        chan->flags = 0;
 
 #ifndef CONFIG_ARCH_OMAP1
-       if (cpu_class_is_omap2()) {
+       if (dma_omap2plus()) {
                chan->chain_id = -1;
                chan->next_linked_ch = -1;
        }
@@ -731,13 +734,13 @@ int omap_request_dma(int dev_id, const char *dev_name,
 
        chan->enabled_irqs = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ;
 
-       if (cpu_class_is_omap1())
+       if (dma_omap1())
                chan->enabled_irqs |= OMAP1_DMA_TOUT_IRQ;
-       else if (cpu_class_is_omap2())
+       else if (dma_omap2plus())
                chan->enabled_irqs |= OMAP2_DMA_MISALIGNED_ERR_IRQ |
                        OMAP2_DMA_TRANS_ERR_IRQ;
 
-       if (cpu_is_omap16xx()) {
+       if (dma_omap16xx()) {
                /* If the sync device is set, configure it dynamically. */
                if (dev_id != 0) {
                        set_gdma_dev(free_ch + 1, dev_id);
@@ -748,11 +751,11 @@ int omap_request_dma(int dev_id, const char *dev_name,
                 * id.
                 */
                p->dma_write(dev_id | (1 << 10), CCR, free_ch);
-       } else if (cpu_is_omap7xx() || cpu_is_omap15xx()) {
+       } else if (dma_omap1()) {
                p->dma_write(dev_id, CCR, free_ch);
        }
 
-       if (cpu_class_is_omap2()) {
+       if (dma_omap2plus()) {
                omap_enable_channel_irq(free_ch);
                omap2_enable_irq_lch(free_ch);
        }
@@ -774,7 +777,7 @@ void omap_free_dma(int lch)
        }
 
        /* Disable interrupt for logical channel */
-       if (cpu_class_is_omap2())
+       if (dma_omap2plus())
                omap2_disable_irq_lch(lch);
 
        /* Disable all DMA interrupts for the channel. */
@@ -784,7 +787,7 @@ void omap_free_dma(int lch)
        p->dma_write(0, CCR, lch);
 
        /* Clear registers */
-       if (cpu_class_is_omap2())
+       if (dma_omap2plus())
                omap_clear_dma(lch);
 
        spin_lock_irqsave(&dma_chan_lock, flags);
@@ -810,7 +813,7 @@ omap_dma_set_global_params(int arb_rate, int max_fifo_depth, int tparams)
 {
        u32 reg;
 
-       if (!cpu_class_is_omap2()) {
+       if (dma_omap1()) {
                printk(KERN_ERR "FIXME: no %s on 15xx/16xx\n", __func__);
                return;
        }
@@ -849,7 +852,7 @@ omap_dma_set_prio_lch(int lch, unsigned char read_prio,
        }
        l = p->dma_read(CCR, lch);
        l &= ~((1 << 6) | (1 << 26));
-       if (cpu_class_is_omap2() && !cpu_is_omap242x())
+       if (d->dev_caps & IS_RW_PRIORITY)
                l |= ((read_prio & 0x1) << 6) | ((write_prio & 0x1) << 26);
        else
                l |= ((read_prio & 0x1) << 6);
@@ -882,7 +885,7 @@ void omap_start_dma(int lch)
         * The CPC/CDAC register needs to be initialized to zero
         * before starting dma transfer.
         */
-       if (cpu_is_omap15xx())
+       if (dma_omap15xx())
                p->dma_write(0, CPC, lch);
        else
                p->dma_write(0, CDAC, lch);
@@ -1045,7 +1048,7 @@ dma_addr_t omap_get_dma_src_pos(int lch)
 {
        dma_addr_t offset = 0;
 
-       if (cpu_is_omap15xx())
+       if (dma_omap15xx())
                offset = p->dma_read(CPC, lch);
        else
                offset = p->dma_read(CSAC, lch);
@@ -1053,7 +1056,7 @@ dma_addr_t omap_get_dma_src_pos(int lch)
        if (IS_DMA_ERRATA(DMA_ERRATA_3_3) && offset == 0)
                offset = p->dma_read(CSAC, lch);
 
-       if (!cpu_is_omap15xx()) {
+       if (!dma_omap15xx()) {
                /*
                 * CDAC == 0 indicates that the DMA transfer on the channel has
                 * not been started (no data has been transferred so far).
@@ -1065,7 +1068,7 @@ dma_addr_t omap_get_dma_src_pos(int lch)
                        offset = p->dma_read(CSSA, lch);
        }
 
-       if (cpu_class_is_omap1())
+       if (dma_omap1())
                offset |= (p->dma_read(CSSA, lch) & 0xFFFF0000);
 
        return offset;
@@ -1084,7 +1087,7 @@ dma_addr_t omap_get_dma_dst_pos(int lch)
 {
        dma_addr_t offset = 0;
 
-       if (cpu_is_omap15xx())
+       if (dma_omap15xx())
                offset = p->dma_read(CPC, lch);
        else
                offset = p->dma_read(CDAC, lch);
@@ -1093,7 +1096,7 @@ dma_addr_t omap_get_dma_dst_pos(int lch)
         * omap 3.2/3.3 erratum: sometimes 0 is returned if CSAC/CDAC is
         * read before the DMA controller finished disabling the channel.
         */
-       if (!cpu_is_omap15xx() && offset == 0) {
+       if (!dma_omap15xx() && offset == 0) {
                offset = p->dma_read(CDAC, lch);
                /*
                 * CDAC == 0 indicates that the DMA transfer on the channel has
@@ -1104,7 +1107,7 @@ dma_addr_t omap_get_dma_dst_pos(int lch)
                        offset = p->dma_read(CDSA, lch);
        }
 
-       if (cpu_class_is_omap1())
+       if (dma_omap1())
                offset |= (p->dma_read(CDSA, lch) & 0xFFFF0000);
 
        return offset;
@@ -1121,7 +1124,7 @@ int omap_dma_running(void)
 {
        int lch;
 
-       if (cpu_class_is_omap1())
+       if (dma_omap1())
                if (omap_lcd_dma_running())
                        return 1;
 
@@ -2024,7 +2027,7 @@ static int __devinit omap_system_dma_probe(struct platform_device *pdev)
        dma_chan                = d->chan;
        enable_1510_mode        = d->dev_caps & ENABLE_1510_MODE;
 
-       if (cpu_class_is_omap2()) {
+       if (dma_omap2plus()) {
                dma_linked_lch = kzalloc(sizeof(struct dma_link_info) *
                                                dma_lch_count, GFP_KERNEL);
                if (!dma_linked_lch) {
@@ -2036,7 +2039,7 @@ static int __devinit omap_system_dma_probe(struct platform_device *pdev)
        spin_lock_init(&dma_chan_lock);
        for (ch = 0; ch < dma_chan_count; ch++) {
                omap_clear_dma(ch);
-               if (cpu_class_is_omap2())
+               if (dma_omap2plus())
                        omap2_disable_irq_lch(ch);
 
                dma_chan[ch].dev_id = -1;
@@ -2045,7 +2048,7 @@ static int __devinit omap_system_dma_probe(struct platform_device *pdev)
                if (ch >= 6 && enable_1510_mode)
                        continue;
 
-               if (cpu_class_is_omap1()) {
+               if (dma_omap1()) {
                        /*
                         * request_irq() doesn't like dev_id (ie. ch) being
                         * zero, so we have to kludge around this.
@@ -2070,11 +2073,11 @@ static int __devinit omap_system_dma_probe(struct platform_device *pdev)
                }
        }
 
-       if (cpu_class_is_omap2() && !cpu_is_omap242x())
+       if (d->dev_caps & IS_RW_PRIORITY)
                omap_dma_set_global_params(DMA_DEFAULT_ARB_RATE,
                                DMA_DEFAULT_FIFO_DEPTH, 0);
 
-       if (cpu_class_is_omap2()) {
+       if (dma_omap2plus()) {
                strcpy(irq_name, "0");
                dma_irq = platform_get_irq_byname(pdev, irq_name);
                if (dma_irq < 0) {
@@ -2089,9 +2092,8 @@ static int __devinit omap_system_dma_probe(struct platform_device *pdev)
                }
        }
 
-       /* reserve dma channels 0 and 1 in high security devices */
-       if (cpu_is_omap34xx() &&
-               (omap_type() != OMAP2_DEVICE_TYPE_GP)) {
+       /* reserve dma channels 0 and 1 in high security devices on 34xx */
+       if (d->dev_caps & HS_CHANNELS_RESERVED) {
                pr_info("Reserving DMA channels 0 and 1 for HS ROM code\n");
                dma_chan[0].dev_id = 0;
                dma_chan[1].dev_id = 1;
@@ -2118,7 +2120,7 @@ static int __devexit omap_system_dma_remove(struct platform_device *pdev)
 {
        int dma_irq;
 
-       if (cpu_class_is_omap2()) {
+       if (dma_omap2plus()) {
                char irq_name[4];
                strcpy(irq_name, "0");
                dma_irq = platform_get_irq_byname(pdev, irq_name);
index 938b50a33439b092202de715e81267b18b5f73cb..9dca23e4d6b0596fa6c1476a894b4a373e891abc 100644 (file)
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/pm_runtime.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #include <plat/dmtimer.h>
-#include <plat/omap-pm.h>
-
-#include <mach/hardware.h>
 
 static u32 omap_reserved_systimers;
 static LIST_HEAD(omap_timer_list);
@@ -212,6 +211,13 @@ struct omap_dm_timer *omap_dm_timer_request_specific(int id)
        unsigned long flags;
        int ret = 0;
 
+       /* Requesting timer by ID is not supported when device tree is used */
+       if (of_have_populated_dt()) {
+               pr_warn("%s: Please use omap_dm_timer_request_by_cap()\n",
+                       __func__);
+               return NULL;
+       }
+
        spin_lock_irqsave(&dm_timer_lock, flags);
        list_for_each_entry(t, &omap_timer_list, node) {
                if (t->pdev->id == id && !t->reserved) {
@@ -237,6 +243,58 @@ struct omap_dm_timer *omap_dm_timer_request_specific(int id)
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_request_specific);
 
+/**
+ * omap_dm_timer_request_by_cap - Request a timer by capability
+ * @cap:       Bit mask of capabilities to match
+ *
+ * Find a timer based upon capabilities bit mask. Callers of this function
+ * should use the definitions found in the plat/dmtimer.h file under the
+ * comment "timer capabilities used in hwmod database". Returns pointer to
+ * timer handle on success and a NULL pointer on failure.
+ */
+struct omap_dm_timer *omap_dm_timer_request_by_cap(u32 cap)
+{
+       struct omap_dm_timer *timer = NULL, *t;
+       unsigned long flags;
+
+       if (!cap)
+               return NULL;
+
+       spin_lock_irqsave(&dm_timer_lock, flags);
+       list_for_each_entry(t, &omap_timer_list, node) {
+               if ((!t->reserved) && ((t->capability & cap) == cap)) {
+                       /*
+                        * If timer is not NULL, we have already found one timer
+                        * but it was not an exact match because it had more
+                        * capabilites that what was required. Therefore,
+                        * unreserve the last timer found and see if this one
+                        * is a better match.
+                        */
+                       if (timer)
+                               timer->reserved = 0;
+
+                       timer = t;
+                       timer->reserved = 1;
+
+                       /* Exit loop early if we find an exact match */
+                       if (t->capability == cap)
+                               break;
+               }
+       }
+       spin_unlock_irqrestore(&dm_timer_lock, flags);
+
+       if (timer && omap_dm_timer_prepare(timer)) {
+               timer->reserved = 0;
+               timer = NULL;
+       }
+
+       if (!timer)
+               pr_debug("%s: timer request failed!\n", __func__);
+
+       return timer;
+}
+EXPORT_SYMBOL_GPL(omap_dm_timer_request_by_cap);
+
 int omap_dm_timer_free(struct omap_dm_timer *timer)
 {
        if (unlikely(!timer))
@@ -271,7 +329,7 @@ int omap_dm_timer_get_irq(struct omap_dm_timer *timer)
 EXPORT_SYMBOL_GPL(omap_dm_timer_get_irq);
 
 #if defined(CONFIG_ARCH_OMAP1)
-
+#include <mach/hardware.h>
 /**
  * omap_dm_timer_modify_idlect_mask - Check if any running timers use ARMXOR
  * @inputmask: current value of idlect mask
@@ -348,7 +406,8 @@ int omap_dm_timer_start(struct omap_dm_timer *timer)
        omap_dm_timer_enable(timer);
 
        if (!(timer->capability & OMAP_TIMER_ALWON)) {
-               if (omap_pm_get_dev_context_loss_count(&timer->pdev->dev) !=
+               if (timer->get_context_loss_count &&
+                       timer->get_context_loss_count(&timer->pdev->dev) !=
                                timer->ctx_loss_count)
                        omap_timer_restore_context(timer);
        }
@@ -377,9 +436,11 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)
 
        __omap_dm_timer_stop(timer, timer->posted, rate);
 
-       if (!(timer->capability & OMAP_TIMER_ALWON))
-               timer->ctx_loss_count =
-                       omap_pm_get_dev_context_loss_count(&timer->pdev->dev);
+       if (!(timer->capability & OMAP_TIMER_ALWON)) {
+               if (timer->get_context_loss_count)
+                       timer->ctx_loss_count =
+                               timer->get_context_loss_count(&timer->pdev->dev);
+       }
 
        /*
         * Since the register values are computed and written within
@@ -414,7 +475,7 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
         * use the clock framework to set the parent clock. To be removed
         * once OMAP1 migrated to using clock framework for dmtimers
         */
-       if (pdata->set_timer_src)
+       if (pdata && pdata->set_timer_src)
                return pdata->set_timer_src(timer->pdev, source);
 
        fclk = clk_get(&timer->pdev->dev, "fck");
@@ -495,7 +556,8 @@ int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
        omap_dm_timer_enable(timer);
 
        if (!(timer->capability & OMAP_TIMER_ALWON)) {
-               if (omap_pm_get_dev_context_loss_count(&timer->pdev->dev) !=
+               if (timer->get_context_loss_count &&
+                       timer->get_context_loss_count(&timer->pdev->dev) !=
                                timer->ctx_loss_count)
                        omap_timer_restore_context(timer);
        }
@@ -695,7 +757,7 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        struct dmtimer_platform_data *pdata = pdev->dev.platform_data;
 
-       if (!pdata) {
+       if (!pdata && !dev->of_node) {
                dev_err(dev, "%s: no platform data.\n", __func__);
                return -ENODEV;
        }
@@ -724,11 +786,24 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
                return -ENOMEM;
        }
 
-       timer->id = pdev->id;
+       if (dev->of_node) {
+               if (of_find_property(dev->of_node, "ti,timer-alwon", NULL))
+                       timer->capability |= OMAP_TIMER_ALWON;
+               if (of_find_property(dev->of_node, "ti,timer-dsp", NULL))
+                       timer->capability |= OMAP_TIMER_HAS_DSP_IRQ;
+               if (of_find_property(dev->of_node, "ti,timer-pwm", NULL))
+                       timer->capability |= OMAP_TIMER_HAS_PWM;
+               if (of_find_property(dev->of_node, "ti,timer-secure", NULL))
+                       timer->capability |= OMAP_TIMER_SECURE;
+       } else {
+               timer->id = pdev->id;
+               timer->capability = pdata->timer_capability;
+               timer->reserved = omap_dm_timer_reserved_systimer(timer->id);
+               timer->get_context_loss_count = pdata->get_context_loss_count;
+       }
+
        timer->irq = irq->start;
-       timer->reserved = omap_dm_timer_reserved_systimer(timer->id);
        timer->pdev = pdev;
-       timer->capability = pdata->timer_capability;
 
        /* Skip pm_runtime_enable for OMAP1 */
        if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) {
@@ -768,7 +843,8 @@ static int __devexit omap_dm_timer_remove(struct platform_device *pdev)
 
        spin_lock_irqsave(&dm_timer_lock, flags);
        list_for_each_entry(timer, &omap_timer_list, node)
-               if (timer->pdev->id == pdev->id) {
+               if (!strcmp(dev_name(&timer->pdev->dev),
+                           dev_name(&pdev->dev))) {
                        list_del(&timer->node);
                        ret = 0;
                        break;
@@ -778,11 +854,18 @@ static int __devexit omap_dm_timer_remove(struct platform_device *pdev)
        return ret;
 }
 
+static const struct of_device_id omap_timer_match[] = {
+       { .compatible = "ti,omap2-timer", },
+       {},
+};
+MODULE_DEVICE_TABLE(of, omap_timer_match);
+
 static struct platform_driver omap_dm_timer_driver = {
        .probe  = omap_dm_timer_probe,
        .remove = __devexit_p(omap_dm_timer_remove),
        .driver = {
                .name   = "omap_timer",
+               .of_match_table = of_match_ptr(omap_timer_match),
        },
 };
 
index bcbb9d5dc293e4066264dc6aba714af8aa6594f4..3a77b30f53d4550707a4744642b2fad1e128df38 100644 (file)
 #include <linux/io.h>
 #include <linux/omapfb.h>
 
-#include <mach/hardware.h>
 #include <asm/mach/map.h>
 
+#include <plat/cpu.h>
+
+#ifdef CONFIG_OMAP2_VRFB
+
+/*
+ * The first memory resource is the register region for VRFB,
+ * the rest are VRFB virtual memory areas for each VRFB context.
+ */
+
+static const struct resource omap2_vrfb_resources[] = {
+       DEFINE_RES_MEM_NAMED(0x68008000u, 0x40, "vrfb-regs"),
+       DEFINE_RES_MEM_NAMED(0x70000000u, 0x4000000, "vrfb-area-0"),
+       DEFINE_RES_MEM_NAMED(0x74000000u, 0x4000000, "vrfb-area-1"),
+       DEFINE_RES_MEM_NAMED(0x78000000u, 0x4000000, "vrfb-area-2"),
+       DEFINE_RES_MEM_NAMED(0x7c000000u, 0x4000000, "vrfb-area-3"),
+};
+
+static const struct resource omap3_vrfb_resources[] = {
+       DEFINE_RES_MEM_NAMED(0x6C000180u, 0xc0, "vrfb-regs"),
+       DEFINE_RES_MEM_NAMED(0x70000000u, 0x4000000, "vrfb-area-0"),
+       DEFINE_RES_MEM_NAMED(0x74000000u, 0x4000000, "vrfb-area-1"),
+       DEFINE_RES_MEM_NAMED(0x78000000u, 0x4000000, "vrfb-area-2"),
+       DEFINE_RES_MEM_NAMED(0x7c000000u, 0x4000000, "vrfb-area-3"),
+       DEFINE_RES_MEM_NAMED(0xe0000000u, 0x4000000, "vrfb-area-4"),
+       DEFINE_RES_MEM_NAMED(0xe4000000u, 0x4000000, "vrfb-area-5"),
+       DEFINE_RES_MEM_NAMED(0xe8000000u, 0x4000000, "vrfb-area-6"),
+       DEFINE_RES_MEM_NAMED(0xec000000u, 0x4000000, "vrfb-area-7"),
+       DEFINE_RES_MEM_NAMED(0xf0000000u, 0x4000000, "vrfb-area-8"),
+       DEFINE_RES_MEM_NAMED(0xf4000000u, 0x4000000, "vrfb-area-9"),
+       DEFINE_RES_MEM_NAMED(0xf8000000u, 0x4000000, "vrfb-area-10"),
+       DEFINE_RES_MEM_NAMED(0xfc000000u, 0x4000000, "vrfb-area-11"),
+};
+
+static int __init omap_init_vrfb(void)
+{
+       struct platform_device *pdev;
+       const struct resource *res;
+       unsigned int num_res;
+
+       if (cpu_is_omap24xx()) {
+               res = omap2_vrfb_resources;
+               num_res = ARRAY_SIZE(omap2_vrfb_resources);
+       } else if (cpu_is_omap34xx()) {
+               res = omap3_vrfb_resources;
+               num_res = ARRAY_SIZE(omap3_vrfb_resources);
+       } else {
+               return 0;
+       }
+
+       pdev = platform_device_register_resndata(NULL, "omapvrfb", -1,
+                       res, num_res, NULL, 0);
+
+       if (IS_ERR(pdev))
+               return PTR_ERR(pdev);
+       else
+               return 0;
+}
+
+arch_initcall(omap_init_vrfb);
+#endif
+
 #if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)
 
 static bool omapfb_lcd_configured;
index a5683a84c6ee0e313cb8f9daeeb7c72106952a4e..f9df624d108cf45fdd10577258ff6e4cff6b2ad1 100644 (file)
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/i2c.h>
+#include <linux/i2c-omap.h>
 #include <linux/slab.h>
 #include <linux/err.h>
 #include <linux/clk.h>
 
-#include <mach/irqs.h>
 #include <plat/i2c.h>
-#include <plat/omap_device.h>
 
-#define OMAP_I2C_SIZE          0x3f
-#define OMAP1_I2C_BASE         0xfffb3800
-#define OMAP1_INT_I2C          (32 + 4)
-
-static const char name[] = "omap_i2c";
-
-#define I2C_RESOURCE_BUILDER(base, irq)                        \
-       {                                               \
-               .start  = (base),                       \
-               .end    = (base) + OMAP_I2C_SIZE,       \
-               .flags  = IORESOURCE_MEM,               \
-       },                                              \
-       {                                               \
-               .start  = (irq),                        \
-               .flags  = IORESOURCE_IRQ,               \
-       },
-
-static struct resource i2c_resources[][2] = {
-       { I2C_RESOURCE_BUILDER(0, 0) },
-};
-
-#define I2C_DEV_BUILDER(bus_id, res, data)             \
-       {                                               \
-               .id     = (bus_id),                     \
-               .name   = name,                         \
-               .num_resources  = ARRAY_SIZE(res),      \
-               .resource       = (res),                \
-               .dev            = {                     \
-                       .platform_data  = (data),       \
-               },                                      \
-       }
-
-#define MAX_OMAP_I2C_HWMOD_NAME_LEN    16
 #define OMAP_I2C_MAX_CONTROLLERS 4
 static struct omap_i2c_bus_platform_data i2c_pdata[OMAP_I2C_MAX_CONTROLLERS];
-static struct platform_device omap_i2c_devices[] = {
-       I2C_DEV_BUILDER(1, i2c_resources[0], &i2c_pdata[0]),
-};
 
 #define OMAP_I2C_CMDLINE_SETUP (BIT(31))
 
-static int __init omap_i2c_nr_ports(void)
-{
-       int ports = 0;
-
-       if (cpu_class_is_omap1())
-               ports = 1;
-       else if (cpu_is_omap24xx())
-               ports = 2;
-       else if (cpu_is_omap34xx())
-               ports = 3;
-       else if (cpu_is_omap44xx())
-               ports = 4;
-
-       return ports;
-}
-
-static inline int omap1_i2c_add_bus(int bus_id)
-{
-       struct platform_device *pdev;
-       struct omap_i2c_bus_platform_data *pdata;
-       struct resource *res;
-
-       omap1_i2c_mux_pins(bus_id);
-
-       pdev = &omap_i2c_devices[bus_id - 1];
-       res = pdev->resource;
-       res[0].start = OMAP1_I2C_BASE;
-       res[0].end = res[0].start + OMAP_I2C_SIZE;
-       res[1].start = OMAP1_INT_I2C;
-       pdata = &i2c_pdata[bus_id - 1];
-
-       /* all OMAP1 have IP version 1 register set */
-       pdata->rev = OMAP_I2C_IP_VERSION_1;
-
-       /* all OMAP1 I2C are implemented like this */
-       pdata->flags = OMAP_I2C_FLAG_NO_FIFO |
-                      OMAP_I2C_FLAG_SIMPLE_CLOCK |
-                      OMAP_I2C_FLAG_16BIT_DATA_REG |
-                      OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK;
-
-       /* how the cpu bus is wired up differs for 7xx only */
-
-       if (cpu_is_omap7xx())
-               pdata->flags |= OMAP_I2C_FLAG_BUS_SHIFT_1;
-       else
-               pdata->flags |= OMAP_I2C_FLAG_BUS_SHIFT_2;
-
-       return platform_device_register(pdev);
-}
-
-
-#ifdef CONFIG_ARCH_OMAP2PLUS
-static inline int omap2_i2c_add_bus(int bus_id)
-{
-       int l;
-       struct omap_hwmod *oh;
-       struct platform_device *pdev;
-       char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN];
-       struct omap_i2c_bus_platform_data *pdata;
-       struct omap_i2c_dev_attr *dev_attr;
-
-       omap2_i2c_mux_pins(bus_id);
-
-       l = snprintf(oh_name, MAX_OMAP_I2C_HWMOD_NAME_LEN, "i2c%d", bus_id);
-       WARN(l >= MAX_OMAP_I2C_HWMOD_NAME_LEN,
-               "String buffer overflow in I2C%d device setup\n", bus_id);
-       oh = omap_hwmod_lookup(oh_name);
-       if (!oh) {
-                       pr_err("Could not look up %s\n", oh_name);
-                       return -EEXIST;
-       }
-
-       pdata = &i2c_pdata[bus_id - 1];
-       /*
-        * pass the hwmod class's CPU-specific knowledge of I2C IP revision in
-        * use, and functionality implementation flags, up to the OMAP I2C
-        * driver via platform data
-        */
-       pdata->rev = oh->class->rev;
-
-       dev_attr = (struct omap_i2c_dev_attr *)oh->dev_attr;
-       pdata->flags = dev_attr->flags;
-
-       pdev = omap_device_build(name, bus_id, oh, pdata,
-                       sizeof(struct omap_i2c_bus_platform_data),
-                       NULL, 0, 0);
-       WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
-
-       return PTR_RET(pdev);
-}
-#else
-static inline int omap2_i2c_add_bus(int bus_id)
-{
-       return 0;
-}
-#endif
-
-static int __init omap_i2c_add_bus(int bus_id)
-{
-       if (cpu_class_is_omap1())
-               return omap1_i2c_add_bus(bus_id);
-       else
-               return omap2_i2c_add_bus(bus_id);
-}
-
 /**
  * omap_i2c_bus_setup - Process command line options for the I2C bus speed
  * @str: String of options
@@ -193,12 +51,11 @@ static int __init omap_i2c_add_bus(int bus_id)
  */
 static int __init omap_i2c_bus_setup(char *str)
 {
-       int ports;
        int ints[3];
 
-       ports = omap_i2c_nr_ports();
        get_options(str, 3, ints);
-       if (ints[0] < 2 || ints[1] < 1 || ints[1] > ports)
+       if (ints[0] < 2 || ints[1] < 1 ||
+                       ints[1] > OMAP_I2C_MAX_CONTROLLERS)
                return 0;
        i2c_pdata[ints[1] - 1].clkrate = ints[2];
        i2c_pdata[ints[1] - 1].clkrate |= OMAP_I2C_CMDLINE_SETUP;
@@ -218,7 +75,7 @@ static int __init omap_register_i2c_bus_cmdline(void)
        for (i = 0; i < ARRAY_SIZE(i2c_pdata); i++)
                if (i2c_pdata[i].clkrate & OMAP_I2C_CMDLINE_SETUP) {
                        i2c_pdata[i].clkrate &= ~OMAP_I2C_CMDLINE_SETUP;
-                       err = omap_i2c_add_bus(i + 1);
+                       err = omap_i2c_add_bus(&i2c_pdata[i], i + 1);
                        if (err)
                                goto out;
                }
@@ -243,7 +100,7 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
 {
        int err;
 
-       BUG_ON(bus_id < 1 || bus_id > omap_i2c_nr_ports());
+       BUG_ON(bus_id < 1 || bus_id > OMAP_I2C_MAX_CONTROLLERS);
 
        if (info) {
                err = i2c_register_board_info(bus_id, info, len);
@@ -256,5 +113,5 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
 
        i2c_pdata[bus_id - 1].clkrate &= ~OMAP_I2C_CMDLINE_SETUP;
 
-       return omap_i2c_add_bus(bus_id);
+       return omap_i2c_add_bus(&i2c_pdata[bus_id - 1], bus_id);
 }
similarity index 60%
rename from arch/arm/plat-omap/include/plat/dma.h
rename to arch/arm/plat-omap/include/plat-omap/dma-omap.h
index 0a87b052f8f7e6f6db561dc7347a0f28f13b9a24..6f506ba9e45301a510156f9fa8d35373748b2c59 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  arch/arm/plat-omap/include/mach/dma.h
+ *  OMAP DMA handling defines and function
  *
  *  Copyright (C) 2003 Nokia Corporation
  *  Author: Juha Yrjölä <juha.yrjola@nokia.com>
 
 #include <linux/platform_device.h>
 
-/*
- * TODO: These dma channel defines should go away once all
- * the omap drivers hwmod adapted.
- */
-
-/* Move omap4 specific defines to dma-44xx.h */
-#include "dma-44xx.h"
-
 #define INT_DMA_LCD                    25
 
-/* DMA channels for omap1 */
-#define OMAP_DMA_NO_DEVICE             0
-#define OMAP_DMA_MCSI1_TX              1
-#define OMAP_DMA_MCSI1_RX              2
-#define OMAP_DMA_I2C_RX                        3
-#define OMAP_DMA_I2C_TX                        4
-#define OMAP_DMA_EXT_NDMA_REQ          5
-#define OMAP_DMA_EXT_NDMA_REQ2         6
-#define OMAP_DMA_UWIRE_TX              7
-#define OMAP_DMA_MCBSP1_TX             8
-#define OMAP_DMA_MCBSP1_RX             9
-#define OMAP_DMA_MCBSP3_TX             10
-#define OMAP_DMA_MCBSP3_RX             11
-#define OMAP_DMA_UART1_TX              12
-#define OMAP_DMA_UART1_RX              13
-#define OMAP_DMA_UART2_TX              14
-#define OMAP_DMA_UART2_RX              15
-#define OMAP_DMA_MCBSP2_TX             16
-#define OMAP_DMA_MCBSP2_RX             17
-#define OMAP_DMA_UART3_TX              18
-#define OMAP_DMA_UART3_RX              19
-#define OMAP_DMA_CAMERA_IF_RX          20
-#define OMAP_DMA_MMC_TX                        21
-#define OMAP_DMA_MMC_RX                        22
-#define OMAP_DMA_NAND                  23
-#define OMAP_DMA_IRQ_LCD_LINE          24
-#define OMAP_DMA_MEMORY_STICK          25
-#define OMAP_DMA_USB_W2FC_RX0          26
-#define OMAP_DMA_USB_W2FC_RX1          27
-#define OMAP_DMA_USB_W2FC_RX2          28
-#define OMAP_DMA_USB_W2FC_TX0          29
-#define OMAP_DMA_USB_W2FC_TX1          30
-#define OMAP_DMA_USB_W2FC_TX2          31
-
-/* These are only for 1610 */
-#define OMAP_DMA_CRYPTO_DES_IN         32
-#define OMAP_DMA_SPI_TX                        33
-#define OMAP_DMA_SPI_RX                        34
-#define OMAP_DMA_CRYPTO_HASH           35
-#define OMAP_DMA_CCP_ATTN              36
-#define OMAP_DMA_CCP_FIFO_NOT_EMPTY    37
-#define OMAP_DMA_CMT_APE_TX_CHAN_0     38
-#define OMAP_DMA_CMT_APE_RV_CHAN_0     39
-#define OMAP_DMA_CMT_APE_TX_CHAN_1     40
-#define OMAP_DMA_CMT_APE_RV_CHAN_1     41
-#define OMAP_DMA_CMT_APE_TX_CHAN_2     42
-#define OMAP_DMA_CMT_APE_RV_CHAN_2     43
-#define OMAP_DMA_CMT_APE_TX_CHAN_3     44
-#define OMAP_DMA_CMT_APE_RV_CHAN_3     45
-#define OMAP_DMA_CMT_APE_TX_CHAN_4     46
-#define OMAP_DMA_CMT_APE_RV_CHAN_4     47
-#define OMAP_DMA_CMT_APE_TX_CHAN_5     48
-#define OMAP_DMA_CMT_APE_RV_CHAN_5     49
-#define OMAP_DMA_CMT_APE_TX_CHAN_6     50
-#define OMAP_DMA_CMT_APE_RV_CHAN_6     51
-#define OMAP_DMA_CMT_APE_TX_CHAN_7     52
-#define OMAP_DMA_CMT_APE_RV_CHAN_7     53
-#define OMAP_DMA_MMC2_TX               54
-#define OMAP_DMA_MMC2_RX               55
-#define OMAP_DMA_CRYPTO_DES_OUT                56
-
-/* DMA channels for 24xx */
-#define OMAP24XX_DMA_NO_DEVICE         0
-#define OMAP24XX_DMA_XTI_DMA           1       /* S_DMA_0 */
-#define OMAP24XX_DMA_EXT_DMAREQ0       2       /* S_DMA_1 */
-#define OMAP24XX_DMA_EXT_DMAREQ1       3       /* S_DMA_2 */
-#define OMAP24XX_DMA_GPMC              4       /* S_DMA_3 */
-#define OMAP24XX_DMA_GFX               5       /* S_DMA_4 */
-#define OMAP24XX_DMA_DSS               6       /* S_DMA_5 */
-#define OMAP242X_DMA_VLYNQ_TX          7       /* S_DMA_6 */
-#define OMAP24XX_DMA_EXT_DMAREQ2       7       /* S_DMA_6 */
-#define OMAP24XX_DMA_CWT               8       /* S_DMA_7 */
-#define OMAP24XX_DMA_AES_TX            9       /* S_DMA_8 */
-#define OMAP24XX_DMA_AES_RX            10      /* S_DMA_9 */
-#define OMAP24XX_DMA_DES_TX            11      /* S_DMA_10 */
-#define OMAP24XX_DMA_DES_RX            12      /* S_DMA_11 */
-#define OMAP24XX_DMA_SHA1MD5_RX                13      /* S_DMA_12 */
-#define OMAP34XX_DMA_SHA2MD5_RX                13      /* S_DMA_12 */
-#define OMAP242X_DMA_EXT_DMAREQ2       14      /* S_DMA_13 */
-#define OMAP242X_DMA_EXT_DMAREQ3       15      /* S_DMA_14 */
-#define OMAP242X_DMA_EXT_DMAREQ4       16      /* S_DMA_15 */
-#define OMAP242X_DMA_EAC_AC_RD         17      /* S_DMA_16 */
-#define OMAP242X_DMA_EAC_AC_WR         18      /* S_DMA_17 */
-#define OMAP242X_DMA_EAC_MD_UL_RD      19      /* S_DMA_18 */
-#define OMAP242X_DMA_EAC_MD_UL_WR      20      /* S_DMA_19 */
-#define OMAP242X_DMA_EAC_MD_DL_RD      21      /* S_DMA_20 */
-#define OMAP242X_DMA_EAC_MD_DL_WR      22      /* S_DMA_21 */
-#define OMAP242X_DMA_EAC_BT_UL_RD      23      /* S_DMA_22 */
-#define OMAP242X_DMA_EAC_BT_UL_WR      24      /* S_DMA_23 */
-#define OMAP242X_DMA_EAC_BT_DL_RD      25      /* S_DMA_24 */
-#define OMAP242X_DMA_EAC_BT_DL_WR      26      /* S_DMA_25 */
-#define OMAP243X_DMA_EXT_DMAREQ3       14      /* S_DMA_13 */
-#define OMAP24XX_DMA_SPI3_TX0          15      /* S_DMA_14 */
-#define OMAP24XX_DMA_SPI3_RX0          16      /* S_DMA_15 */
-#define OMAP24XX_DMA_MCBSP3_TX         17      /* S_DMA_16 */
-#define OMAP24XX_DMA_MCBSP3_RX         18      /* S_DMA_17 */
-#define OMAP24XX_DMA_MCBSP4_TX         19      /* S_DMA_18 */
-#define OMAP24XX_DMA_MCBSP4_RX         20      /* S_DMA_19 */
-#define OMAP24XX_DMA_MCBSP5_TX         21      /* S_DMA_20 */
-#define OMAP24XX_DMA_MCBSP5_RX         22      /* S_DMA_21 */
-#define OMAP24XX_DMA_SPI3_TX1          23      /* S_DMA_22 */
-#define OMAP24XX_DMA_SPI3_RX1          24      /* S_DMA_23 */
-#define OMAP243X_DMA_EXT_DMAREQ4       25      /* S_DMA_24 */
-#define OMAP243X_DMA_EXT_DMAREQ5       26      /* S_DMA_25 */
-#define OMAP34XX_DMA_I2C3_TX           25      /* S_DMA_24 */
-#define OMAP34XX_DMA_I2C3_RX           26      /* S_DMA_25 */
-#define OMAP24XX_DMA_I2C1_TX           27      /* S_DMA_26 */
-#define OMAP24XX_DMA_I2C1_RX           28      /* S_DMA_27 */
-#define OMAP24XX_DMA_I2C2_TX           29      /* S_DMA_28 */
-#define OMAP24XX_DMA_I2C2_RX           30      /* S_DMA_29 */
-#define OMAP24XX_DMA_MCBSP1_TX         31      /* S_DMA_30 */
-#define OMAP24XX_DMA_MCBSP1_RX         32      /* S_DMA_31 */
-#define OMAP24XX_DMA_MCBSP2_TX         33      /* S_DMA_32 */
-#define OMAP24XX_DMA_MCBSP2_RX         34      /* S_DMA_33 */
-#define OMAP24XX_DMA_SPI1_TX0          35      /* S_DMA_34 */
-#define OMAP24XX_DMA_SPI1_RX0          36      /* S_DMA_35 */
-#define OMAP24XX_DMA_SPI1_TX1          37      /* S_DMA_36 */
-#define OMAP24XX_DMA_SPI1_RX1          38      /* S_DMA_37 */
-#define OMAP24XX_DMA_SPI1_TX2          39      /* S_DMA_38 */
-#define OMAP24XX_DMA_SPI1_RX2          40      /* S_DMA_39 */
-#define OMAP24XX_DMA_SPI1_TX3          41      /* S_DMA_40 */
-#define OMAP24XX_DMA_SPI1_RX3          42      /* S_DMA_41 */
-#define OMAP24XX_DMA_SPI2_TX0          43      /* S_DMA_42 */
-#define OMAP24XX_DMA_SPI2_RX0          44      /* S_DMA_43 */
-#define OMAP24XX_DMA_SPI2_TX1          45      /* S_DMA_44 */
-#define OMAP24XX_DMA_SPI2_RX1          46      /* S_DMA_45 */
-#define OMAP24XX_DMA_MMC2_TX           47      /* S_DMA_46 */
-#define OMAP24XX_DMA_MMC2_RX           48      /* S_DMA_47 */
-#define OMAP24XX_DMA_UART1_TX          49      /* S_DMA_48 */
-#define OMAP24XX_DMA_UART1_RX          50      /* S_DMA_49 */
-#define OMAP24XX_DMA_UART2_TX          51      /* S_DMA_50 */
-#define OMAP24XX_DMA_UART2_RX          52      /* S_DMA_51 */
-#define OMAP24XX_DMA_UART3_TX          53      /* S_DMA_52 */
-#define OMAP24XX_DMA_UART3_RX          54      /* S_DMA_53 */
-#define OMAP24XX_DMA_USB_W2FC_TX0      55      /* S_DMA_54 */
-#define OMAP24XX_DMA_USB_W2FC_RX0      56      /* S_DMA_55 */
-#define OMAP24XX_DMA_USB_W2FC_TX1      57      /* S_DMA_56 */
-#define OMAP24XX_DMA_USB_W2FC_RX1      58      /* S_DMA_57 */
-#define OMAP24XX_DMA_USB_W2FC_TX2      59      /* S_DMA_58 */
-#define OMAP24XX_DMA_USB_W2FC_RX2      60      /* S_DMA_59 */
-#define OMAP24XX_DMA_MMC1_TX           61      /* S_DMA_60 */
-#define OMAP24XX_DMA_MMC1_RX           62      /* S_DMA_61 */
-#define OMAP24XX_DMA_MS                        63      /* S_DMA_62 */
-#define OMAP242X_DMA_EXT_DMAREQ5       64      /* S_DMA_63 */
-#define OMAP243X_DMA_EXT_DMAREQ6       64      /* S_DMA_63 */
-#define OMAP34XX_DMA_EXT_DMAREQ3       64      /* S_DMA_63 */
-#define OMAP34XX_DMA_AES2_TX           65      /* S_DMA_64 */
-#define OMAP34XX_DMA_AES2_RX           66      /* S_DMA_65 */
-#define OMAP34XX_DMA_DES2_TX           67      /* S_DMA_66 */
-#define OMAP34XX_DMA_DES2_RX           68      /* S_DMA_67 */
-#define OMAP34XX_DMA_SHA1MD5_RX                69      /* S_DMA_68 */
-#define OMAP34XX_DMA_SPI4_TX0          70      /* S_DMA_69 */
-#define OMAP34XX_DMA_SPI4_RX0          71      /* S_DMA_70 */
-#define OMAP34XX_DSS_DMA0              72      /* S_DMA_71 */
-#define OMAP34XX_DSS_DMA1              73      /* S_DMA_72 */
-#define OMAP34XX_DSS_DMA2              74      /* S_DMA_73 */
-#define OMAP34XX_DSS_DMA3              75      /* S_DMA_74 */
-#define OMAP34XX_DMA_MMC3_TX           77      /* S_DMA_76 */
-#define OMAP34XX_DMA_MMC3_RX           78      /* S_DMA_77 */
-#define OMAP34XX_DMA_USIM_TX           79      /* S_DMA_78 */
-#define OMAP34XX_DMA_USIM_RX           80      /* S_DMA_79 */
-
-#define OMAP36XX_DMA_UART4_TX          81      /* S_DMA_80 */
-#define OMAP36XX_DMA_UART4_RX          82      /* S_DMA_81 */
-
-/* Only for AM35xx */
-#define AM35XX_DMA_UART4_TX            54
-#define AM35XX_DMA_UART4_RX            55
-
-/*----------------------------------------------------------------------------*/
-
 #define OMAP1_DMA_TOUT_IRQ             (1 << 0)
 #define OMAP_DMA_DROP_IRQ              (1 << 1)
 #define OMAP_DMA_HALF_IRQ              (1 << 2)
 #define SRC_PORT                       BIT(0x7)
 #define DST_PORT                       BIT(0x8)
 #define SRC_INDEX                      BIT(0x9)
-#define DST_INDEX                      BIT(0xA)
-#define IS_BURST_ONLY4                 BIT(0xB)
-#define CLEAR_CSR_ON_READ              BIT(0xC)
-#define IS_WORD_16                     BIT(0xD)
+#define DST_INDEX                      BIT(0xa)
+#define IS_BURST_ONLY4                 BIT(0xb)
+#define CLEAR_CSR_ON_READ              BIT(0xc)
+#define IS_WORD_16                     BIT(0xd)
+#define ENABLE_16XX_MODE               BIT(0xe)
+#define HS_CHANNELS_RESERVED           BIT(0xf)
 
 /* Defines for DMA Capabilities */
 #define DMA_HAS_TRANSPARENT_CAPS       (0x1 << 18)
@@ -449,7 +272,15 @@ struct omap_system_dma_plat_info {
        u32 (*dma_read)(int reg, int lch);
 };
 
-extern void __init omap_init_consistent_dma_size(void);
+#ifdef CONFIG_ARCH_OMAP2PLUS
+#define dma_omap2plus()        1
+#else
+#define dma_omap2plus()        0
+#endif
+#define dma_omap1()    (!dma_omap2plus())
+#define dma_omap15xx() ((dma_omap1() && (d->dev_caps & ENABLE_1510_MODE)))
+#define dma_omap16xx() ((dma_omap1() && (d->dev_caps & ENABLE_16XX_MODE)))
+
 extern void omap_set_dma_priority(int lch, int dst_port, int priority);
 extern int omap_request_dma(int dev_id, const char *dev_name,
                        void (*callback)(int lch, u16 ch_status, void *data),
diff --git a/arch/arm/plat-omap/include/plat/clkdev_omap.h b/arch/arm/plat-omap/include/plat/clkdev_omap.h
deleted file mode 100644 (file)
index 025d85a..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * clkdev <-> OMAP integration
- *
- * Russell King <linux@arm.linux.org.uk>
- *
- */
-
-#ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_CLKDEV_OMAP_H
-#define __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_CLKDEV_OMAP_H
-
-#include <linux/clkdev.h>
-
-struct omap_clk {
-       u16                             cpu;
-       struct clk_lookup               lk;
-};
-
-#define CLK(dev, con, ck, cp)          \
-       {                               \
-                .cpu = cp,             \
-               .lk = {                 \
-                       .dev_id = dev,  \
-                       .con_id = con,  \
-                       .clk = ck,      \
-               },                      \
-       }
-
-/* Platform flags for the clkdev-OMAP integration code */
-#define CK_310         (1 << 0)
-#define CK_7XX         (1 << 1)        /* 7xx, 850 */
-#define CK_1510                (1 << 2)
-#define CK_16XX                (1 << 3)        /* 16xx, 17xx, 5912 */
-#define CK_242X                (1 << 4)
-#define CK_243X                (1 << 5)        /* 243x, 253x */
-#define CK_3430ES1     (1 << 6)        /* 34xxES1 only */
-#define CK_3430ES2PLUS (1 << 7)        /* 34xxES2, ES3, non-Sitara 35xx only */
-#define CK_AM35XX      (1 << 9)        /* Sitara AM35xx */
-#define CK_36XX                (1 << 10)       /* 36xx/37xx-specific clocks */
-#define CK_443X                (1 << 11)
-#define CK_TI816X      (1 << 12)
-#define CK_446X                (1 << 13)
-#define CK_AM33XX      (1 << 14)       /* AM33xx specific clocks */
-#define CK_1710                (1 << 15)       /* 1710 extra for rate selection */
-
-
-#define CK_34XX                (CK_3430ES1 | CK_3430ES2PLUS)
-#define CK_3XXX                (CK_34XX | CK_AM35XX | CK_36XX)
-
-
-#endif
-
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h
deleted file mode 100644 (file)
index e2e2d04..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * OMAP clock: data structure definitions, function prototypes, shared macros
- *
- * Copyright (C) 2004-2005, 2008-2010 Nokia Corporation
- * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
- * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, 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 __ARCH_ARM_OMAP_CLOCK_H
-#define __ARCH_ARM_OMAP_CLOCK_H
-
-#include <linux/list.h>
-
-struct module;
-struct clk;
-struct clockdomain;
-
-/* Temporary, needed during the common clock framework conversion */
-#define __clk_get_name(clk)    (clk->name)
-#define __clk_get_parent(clk)  (clk->parent)
-#define __clk_get_rate(clk)    (clk->rate)
-
-/**
- * struct clkops - some clock function pointers
- * @enable: fn ptr that enables the current clock in hardware
- * @disable: fn ptr that enables the current clock in hardware
- * @find_idlest: function returning the IDLEST register for the clock's IP blk
- * @find_companion: function returning the "companion" clk reg for the clock
- * @allow_idle: fn ptr that enables autoidle for the current clock in hardware
- * @deny_idle: fn ptr that disables autoidle for the current clock in hardware
- *
- * A "companion" clk is an accompanying clock to the one being queried
- * that must be enabled for the IP module connected to the clock to
- * become accessible by the hardware.  Neither @find_idlest nor
- * @find_companion should be needed; that information is IP
- * block-specific; the hwmod code has been created to handle this, but
- * until hwmod data is ready and drivers have been converted to use PM
- * runtime calls in place of clk_enable()/clk_disable(), @find_idlest and
- * @find_companion must, unfortunately, remain.
- */
-struct clkops {
-       int                     (*enable)(struct clk *);
-       void                    (*disable)(struct clk *);
-       void                    (*find_idlest)(struct clk *, void __iomem **,
-                                              u8 *, u8 *);
-       void                    (*find_companion)(struct clk *, void __iomem **,
-                                                 u8 *);
-       void                    (*allow_idle)(struct clk *);
-       void                    (*deny_idle)(struct clk *);
-};
-
-#ifdef CONFIG_ARCH_OMAP2PLUS
-
-/* struct clksel_rate.flags possibilities */
-#define RATE_IN_242X           (1 << 0)
-#define RATE_IN_243X           (1 << 1)
-#define RATE_IN_3430ES1                (1 << 2)        /* 3430ES1 rates only */
-#define RATE_IN_3430ES2PLUS    (1 << 3)        /* 3430 ES >= 2 rates only */
-#define RATE_IN_36XX           (1 << 4)
-#define RATE_IN_4430           (1 << 5)
-#define RATE_IN_TI816X         (1 << 6)
-#define RATE_IN_4460           (1 << 7)
-#define RATE_IN_AM33XX         (1 << 8)
-#define RATE_IN_TI814X         (1 << 9)
-
-#define RATE_IN_24XX           (RATE_IN_242X | RATE_IN_243X)
-#define RATE_IN_34XX           (RATE_IN_3430ES1 | RATE_IN_3430ES2PLUS)
-#define RATE_IN_3XXX           (RATE_IN_34XX | RATE_IN_36XX)
-#define RATE_IN_44XX           (RATE_IN_4430 | RATE_IN_4460)
-
-/* RATE_IN_3430ES2PLUS_36XX includes 34xx/35xx with ES >=2, and all 36xx/37xx */
-#define RATE_IN_3430ES2PLUS_36XX       (RATE_IN_3430ES2PLUS | RATE_IN_36XX)
-
-
-/**
- * struct clksel_rate - register bitfield values corresponding to clk divisors
- * @val: register bitfield value (shifted to bit 0)
- * @div: clock divisor corresponding to @val
- * @flags: (see "struct clksel_rate.flags possibilities" above)
- *
- * @val should match the value of a read from struct clk.clksel_reg
- * AND'ed with struct clk.clksel_mask, shifted right to bit 0.
- *
- * @div is the divisor that should be applied to the parent clock's rate
- * to produce the current clock's rate.
- */
-struct clksel_rate {
-       u32                     val;
-       u8                      div;
-       u16                     flags;
-};
-
-/**
- * struct clksel - available parent clocks, and a pointer to their divisors
- * @parent: struct clk * to a possible parent clock
- * @rates: available divisors for this parent clock
- *
- * A struct clksel is always associated with one or more struct clks
- * and one or more struct clksel_rates.
- */
-struct clksel {
-       struct clk               *parent;
-       const struct clksel_rate *rates;
-};
-
-/**
- * struct dpll_data - DPLL registers and integration data
- * @mult_div1_reg: register containing the DPLL M and N bitfields
- * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg
- * @div1_mask: mask of the DPLL N bitfield in @mult_div1_reg
- * @clk_bypass: struct clk pointer to the clock's bypass clock input
- * @clk_ref: struct clk pointer to the clock's reference clock input
- * @control_reg: register containing the DPLL mode bitfield
- * @enable_mask: mask of the DPLL mode bitfield in @control_reg
- * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate()
- * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate()
- * @max_multiplier: maximum valid non-bypass multiplier value (actual)
- * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate()
- * @min_divider: minimum valid non-bypass divider value (actual)
- * @max_divider: maximum valid non-bypass divider value (actual)
- * @modes: possible values of @enable_mask
- * @autoidle_reg: register containing the DPLL autoidle mode bitfield
- * @idlest_reg: register containing the DPLL idle status bitfield
- * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg
- * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg
- * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg
- * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg
- * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs
- * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs
- * @flags: DPLL type/features (see below)
- *
- * Possible values for @flags:
- * DPLL_J_TYPE: "J-type DPLL" (only some 36xx, 4xxx DPLLs)
- *
- * @freqsel_mask is only used on the OMAP34xx family and AM35xx.
- *
- * XXX Some DPLLs have multiple bypass inputs, so it's not technically
- * correct to only have one @clk_bypass pointer.
- *
- * XXX The runtime-variable fields (@last_rounded_rate, @last_rounded_m,
- * @last_rounded_n) should be separated from the runtime-fixed fields
- * and placed into a different structure, so that the runtime-fixed data
- * can be placed into read-only space.
- */
-struct dpll_data {
-       void __iomem            *mult_div1_reg;
-       u32                     mult_mask;
-       u32                     div1_mask;
-       struct clk              *clk_bypass;
-       struct clk              *clk_ref;
-       void __iomem            *control_reg;
-       u32                     enable_mask;
-       unsigned long           last_rounded_rate;
-       u16                     last_rounded_m;
-       u16                     max_multiplier;
-       u8                      last_rounded_n;
-       u8                      min_divider;
-       u16                     max_divider;
-       u8                      modes;
-       void __iomem            *autoidle_reg;
-       void __iomem            *idlest_reg;
-       u32                     autoidle_mask;
-       u32                     freqsel_mask;
-       u32                     idlest_mask;
-       u32                     dco_mask;
-       u32                     sddiv_mask;
-       u8                      auto_recal_bit;
-       u8                      recal_en_bit;
-       u8                      recal_st_bit;
-       u8                      flags;
-};
-
-#endif
-
-/*
- * struct clk.flags possibilities
- *
- * XXX document the rest of the clock flags here
- *
- * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL
- *     bits share the same register.  This flag allows the
- *     omap4_dpllmx*() code to determine which GATE_CTRL bit field
- *     should be used.  This is a temporary solution - a better approach
- *     would be to associate clock type-specific data with the clock,
- *     similar to the struct dpll_data approach.
- */
-#define ENABLE_REG_32BIT       (1 << 0)        /* Use 32-bit access */
-#define CLOCK_IDLE_CONTROL     (1 << 1)
-#define CLOCK_NO_IDLE_PARENT   (1 << 2)
-#define ENABLE_ON_INIT         (1 << 3)        /* Enable upon framework init */
-#define INVERT_ENABLE          (1 << 4)        /* 0 enables, 1 disables */
-#define CLOCK_CLKOUTX2         (1 << 5)
-
-/**
- * struct clk - OMAP struct clk
- * @node: list_head connecting this clock into the full clock list
- * @ops: struct clkops * for this clock
- * @name: the name of the clock in the hardware (used in hwmod data and debug)
- * @parent: pointer to this clock's parent struct clk
- * @children: list_head connecting to the child clks' @sibling list_heads
- * @sibling: list_head connecting this clk to its parent clk's @children
- * @rate: current clock rate
- * @enable_reg: register to write to enable the clock (see @enable_bit)
- * @recalc: fn ptr that returns the clock's current rate
- * @set_rate: fn ptr that can change the clock's current rate
- * @round_rate: fn ptr that can round the clock's current rate
- * @init: fn ptr to do clock-specific initialization
- * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
- * @usecount: number of users that have requested this clock to be enabled
- * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div
- * @flags: see "struct clk.flags possibilities" above
- * @clksel_reg: for clksel clks, register va containing src/divisor select
- * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector
- * @clksel: for clksel clks, pointer to struct clksel for this clock
- * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock
- * @clkdm_name: clockdomain name that this clock is contained in
- * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime
- * @rate_offset: bitshift for rate selection bitfield (OMAP1 only)
- * @src_offset: bitshift for source selection bitfield (OMAP1 only)
- *
- * XXX @rate_offset, @src_offset should probably be removed and OMAP1
- * clock code converted to use clksel.
- *
- * XXX @usecount is poorly named.  It should be "enable_count" or
- * something similar.  "users" in the description refers to kernel
- * code (core code or drivers) that have called clk_enable() and not
- * yet called clk_disable(); the usecount of parent clocks is also
- * incremented by the clock code when clk_enable() is called on child
- * clocks and decremented by the clock code when clk_disable() is
- * called on child clocks.
- *
- * XXX @clkdm, @usecount, @children, @sibling should be marked for
- * internal use only.
- *
- * @children and @sibling are used to optimize parent-to-child clock
- * tree traversals.  (child-to-parent traversals use @parent.)
- *
- * XXX The notion of the clock's current rate probably needs to be
- * separated from the clock's target rate.
- */
-struct clk {
-       struct list_head        node;
-       const struct clkops     *ops;
-       const char              *name;
-       struct clk              *parent;
-       struct list_head        children;
-       struct list_head        sibling;        /* node for children */
-       unsigned long           rate;
-       void __iomem            *enable_reg;
-       unsigned long           (*recalc)(struct clk *);
-       int                     (*set_rate)(struct clk *, unsigned long);
-       long                    (*round_rate)(struct clk *, unsigned long);
-       void                    (*init)(struct clk *);
-       u8                      enable_bit;
-       s8                      usecount;
-       u8                      fixed_div;
-       u8                      flags;
-#ifdef CONFIG_ARCH_OMAP2PLUS
-       void __iomem            *clksel_reg;
-       u32                     clksel_mask;
-       const struct clksel     *clksel;
-       struct dpll_data        *dpll_data;
-       const char              *clkdm_name;
-       struct clockdomain      *clkdm;
-#else
-       u8                      rate_offset;
-       u8                      src_offset;
-#endif
-#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
-       struct dentry           *dent;  /* For visible tree hierarchy */
-#endif
-};
-
-struct clk_functions {
-       int             (*clk_enable)(struct clk *clk);
-       void            (*clk_disable)(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);
-       void            (*clk_allow_idle)(struct clk *clk);
-       void            (*clk_deny_idle)(struct clk *clk);
-       void            (*clk_disable_unused)(struct clk *clk);
-};
-
-extern int mpurate;
-
-extern int clk_init(struct clk_functions *custom_clocks);
-extern void clk_preinit(struct clk *clk);
-extern int clk_register(struct clk *clk);
-extern void clk_reparent(struct clk *child, struct clk *parent);
-extern void clk_unregister(struct clk *clk);
-extern void propagate_rate(struct clk *clk);
-extern void recalculate_root_clocks(void);
-extern unsigned long followparent_recalc(struct clk *clk);
-extern void clk_enable_init_clocks(void);
-unsigned long omap_fixed_divisor_recalc(struct clk *clk);
-extern struct clk *omap_clk_get_by_name(const char *name);
-extern int omap_clk_enable_autoidle_all(void);
-extern int omap_clk_disable_autoidle_all(void);
-
-extern const struct clkops clkops_null;
-
-extern struct clk dummy_ck;
-
-#endif
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
deleted file mode 100644 (file)
index d1cb6f5..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * arch/arm/plat-omap/include/mach/common.h
- *
- * Header for code common to all OMAP machines.
- *
- * 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
- * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * 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.,
- * 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __ARCH_ARM_MACH_OMAP_COMMON_H
-#define __ARCH_ARM_MACH_OMAP_COMMON_H
-
-#include <plat/i2c.h>
-#include <plat/omap_hwmod.h>
-
-extern int __init omap_init_clocksource_32k(void __iomem *vbase);
-
-extern void __init omap_check_revision(void);
-
-extern void omap_reserve(void);
-extern int omap_dss_reset(struct omap_hwmod *);
-
-void omap_sram_init(void);
-
-#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */
diff --git a/arch/arm/plat-omap/include/plat/counter-32k.h b/arch/arm/plat-omap/include/plat/counter-32k.h
new file mode 100644 (file)
index 0000000..da000d4
--- /dev/null
@@ -0,0 +1 @@
+int omap_init_clocksource_32k(void __iomem *vbase);
index 67da857783ce6e7155cf3b5424cac1fe693a52d3..b4516aba67ed5fd32687de5d9f94660bf21003c6 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/arm/plat-omap/include/mach/cpu.h
- *
  * OMAP cpu type detection
  *
  * Copyright (C) 2004, 2008 Nokia Corporation
 #ifndef __ASM_ARCH_OMAP_CPU_H
 #define __ASM_ARCH_OMAP_CPU_H
 
-#ifndef __ASSEMBLY__
-
-#include <linux/bitops.h>
-#include <plat/multi.h>
-
-/*
- * Omap device type i.e. EMU/HS/TST/GP/BAD
- */
-#define OMAP2_DEVICE_TYPE_TEST         0
-#define OMAP2_DEVICE_TYPE_EMU          1
-#define OMAP2_DEVICE_TYPE_SEC          2
-#define OMAP2_DEVICE_TYPE_GP           3
-#define OMAP2_DEVICE_TYPE_BAD          4
-
-int omap_type(void);
-
-/*
- * omap_rev bits:
- * CPU id bits (0730, 1510, 1710, 2422...)     [31:16]
- * CPU revision        (See _REV_ defined in cpu.h)    [15:08]
- * CPU class bits (15xx, 16xx, 24xx, 34xx...)  [07:00]
- */
-unsigned int omap_rev(void);
-
-/*
- * Get the CPU revision for OMAP devices
- */
-#define GET_OMAP_REVISION()    ((omap_rev() >> 8) & 0xff)
-
-/*
- * Macros to group OMAP into cpu classes.
- * These can be used in most places.
- * cpu_is_omap7xx():   True for OMAP730, OMAP850
- * cpu_is_omap15xx():  True for OMAP1510, OMAP5910 and OMAP310
- * cpu_is_omap16xx():  True for OMAP1610, OMAP5912 and OMAP1710
- * cpu_is_omap24xx():  True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
- * cpu_is_omap242x():  True for OMAP2420, OMAP2422, OMAP2423
- * cpu_is_omap243x():  True for OMAP2430
- * cpu_is_omap343x():  True for OMAP3430
- * cpu_is_omap443x():  True for OMAP4430
- * cpu_is_omap446x():  True for OMAP4460
- * cpu_is_omap447x():  True for OMAP4470
- * soc_is_omap543x():  True for OMAP5430, OMAP5432
- */
-#define GET_OMAP_CLASS (omap_rev() & 0xff)
-
-#define IS_OMAP_CLASS(class, id)                       \
-static inline int is_omap ##class (void)               \
-{                                                      \
-       return (GET_OMAP_CLASS == (id)) ? 1 : 0;        \
-}
-
-#define GET_AM_CLASS   ((omap_rev() >> 24) & 0xff)
-
-#define IS_AM_CLASS(class, id)                         \
-static inline int is_am ##class (void)                 \
-{                                                      \
-       return (GET_AM_CLASS == (id)) ? 1 : 0;          \
-}
-
-#define GET_TI_CLASS   ((omap_rev() >> 24) & 0xff)
-
-#define IS_TI_CLASS(class, id)                 \
-static inline int is_ti ##class (void)         \
-{                                                      \
-       return (GET_TI_CLASS == (id)) ? 1 : 0;  \
-}
-
-#define GET_OMAP_SUBCLASS      ((omap_rev() >> 20) & 0x0fff)
-
-#define IS_OMAP_SUBCLASS(subclass, id)                 \
-static inline int is_omap ##subclass (void)            \
-{                                                      \
-       return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0;     \
-}
-
-#define IS_TI_SUBCLASS(subclass, id)                   \
-static inline int is_ti ##subclass (void)              \
-{                                                      \
-       return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0;     \
-}
-
-#define IS_AM_SUBCLASS(subclass, id)                   \
-static inline int is_am ##subclass (void)              \
-{                                                      \
-       return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0;     \
-}
-
-IS_OMAP_CLASS(7xx, 0x07)
-IS_OMAP_CLASS(15xx, 0x15)
-IS_OMAP_CLASS(16xx, 0x16)
-IS_OMAP_CLASS(24xx, 0x24)
-IS_OMAP_CLASS(34xx, 0x34)
-IS_OMAP_CLASS(44xx, 0x44)
-IS_AM_CLASS(35xx, 0x35)
-IS_OMAP_CLASS(54xx, 0x54)
-IS_AM_CLASS(33xx, 0x33)
-
-IS_TI_CLASS(81xx, 0x81)
-
-IS_OMAP_SUBCLASS(242x, 0x242)
-IS_OMAP_SUBCLASS(243x, 0x243)
-IS_OMAP_SUBCLASS(343x, 0x343)
-IS_OMAP_SUBCLASS(363x, 0x363)
-IS_OMAP_SUBCLASS(443x, 0x443)
-IS_OMAP_SUBCLASS(446x, 0x446)
-IS_OMAP_SUBCLASS(447x, 0x447)
-IS_OMAP_SUBCLASS(543x, 0x543)
-
-IS_TI_SUBCLASS(816x, 0x816)
-IS_TI_SUBCLASS(814x, 0x814)
-IS_AM_SUBCLASS(335x, 0x335)
-
-#define cpu_is_omap7xx()               0
-#define cpu_is_omap15xx()              0
-#define cpu_is_omap16xx()              0
-#define cpu_is_omap24xx()              0
-#define cpu_is_omap242x()              0
-#define cpu_is_omap243x()              0
-#define cpu_is_omap34xx()              0
-#define cpu_is_omap343x()              0
-#define cpu_is_ti81xx()                        0
-#define cpu_is_ti816x()                        0
-#define cpu_is_ti814x()                        0
-#define soc_is_am35xx()                        0
-#define soc_is_am33xx()                        0
-#define soc_is_am335x()                        0
-#define cpu_is_omap44xx()              0
-#define cpu_is_omap443x()              0
-#define cpu_is_omap446x()              0
-#define cpu_is_omap447x()              0
-#define soc_is_omap54xx()              0
-#define soc_is_omap543x()              0
-
-#if defined(MULTI_OMAP1)
-# if defined(CONFIG_ARCH_OMAP730)
-#  undef  cpu_is_omap7xx
-#  define cpu_is_omap7xx()             is_omap7xx()
-# endif
-# if defined(CONFIG_ARCH_OMAP850)
-#  undef  cpu_is_omap7xx
-#  define cpu_is_omap7xx()             is_omap7xx()
-# endif
-# if defined(CONFIG_ARCH_OMAP15XX)
-#  undef  cpu_is_omap15xx
-#  define cpu_is_omap15xx()            is_omap15xx()
-# endif
-# if defined(CONFIG_ARCH_OMAP16XX)
-#  undef  cpu_is_omap16xx
-#  define cpu_is_omap16xx()            is_omap16xx()
-# endif
-#else
-# if defined(CONFIG_ARCH_OMAP730)
-#  undef  cpu_is_omap7xx
-#  define cpu_is_omap7xx()             1
-# endif
-# if defined(CONFIG_ARCH_OMAP850)
-#  undef  cpu_is_omap7xx
-#  define cpu_is_omap7xx()             1
-# endif
-# if defined(CONFIG_ARCH_OMAP15XX)
-#  undef  cpu_is_omap15xx
-#  define cpu_is_omap15xx()            1
-# endif
-# if defined(CONFIG_ARCH_OMAP16XX)
-#  undef  cpu_is_omap16xx
-#  define cpu_is_omap16xx()            1
-# endif
-#endif
-
-#if defined(MULTI_OMAP2)
-# if defined(CONFIG_ARCH_OMAP2)
-#  undef  cpu_is_omap24xx
-#  define cpu_is_omap24xx()            is_omap24xx()
-# endif
-# if defined (CONFIG_SOC_OMAP2420)
-#  undef  cpu_is_omap242x
-#  define cpu_is_omap242x()            is_omap242x()
-# endif
-# if defined (CONFIG_SOC_OMAP2430)
-#  undef  cpu_is_omap243x
-#  define cpu_is_omap243x()            is_omap243x()
-# endif
-# if defined(CONFIG_ARCH_OMAP3)
-#  undef  cpu_is_omap34xx
-#  undef  cpu_is_omap343x
-#  define cpu_is_omap34xx()            is_omap34xx()
-#  define cpu_is_omap343x()            is_omap343x()
-# endif
-#else
-# if defined(CONFIG_ARCH_OMAP2)
-#  undef  cpu_is_omap24xx
-#  define cpu_is_omap24xx()            1
-# endif
-# if defined(CONFIG_SOC_OMAP2420)
-#  undef  cpu_is_omap242x
-#  define cpu_is_omap242x()            1
-# endif
-# if defined(CONFIG_SOC_OMAP2430)
-#  undef  cpu_is_omap243x
-#  define cpu_is_omap243x()            1
-# endif
-# if defined(CONFIG_ARCH_OMAP3)
-#  undef  cpu_is_omap34xx
-#  define cpu_is_omap34xx()            1
-# endif
-# if defined(CONFIG_SOC_OMAP3430)
-#  undef  cpu_is_omap343x
-#  define cpu_is_omap343x()            1
-# endif
-#endif
-
-/*
- * Macros to detect individual cpu types.
- * These are only rarely needed.
- * cpu_is_omap310():   True for OMAP310
- * cpu_is_omap1510():  True for OMAP1510
- * cpu_is_omap1610():  True for OMAP1610
- * cpu_is_omap1611():  True for OMAP1611
- * cpu_is_omap5912():  True for OMAP5912
- * cpu_is_omap1621():  True for OMAP1621
- * cpu_is_omap1710():  True for OMAP1710
- * cpu_is_omap2420():  True for OMAP2420
- * cpu_is_omap2422():  True for OMAP2422
- * cpu_is_omap2423():  True for OMAP2423
- * cpu_is_omap2430():  True for OMAP2430
- * cpu_is_omap3430():  True for OMAP3430
- */
-#define GET_OMAP_TYPE  ((omap_rev() >> 16) & 0xffff)
-
-#define IS_OMAP_TYPE(type, id)                         \
-static inline int is_omap ##type (void)                        \
-{                                                      \
-       return (GET_OMAP_TYPE == (id)) ? 1 : 0;         \
-}
-
-IS_OMAP_TYPE(310, 0x0310)
-IS_OMAP_TYPE(1510, 0x1510)
-IS_OMAP_TYPE(1610, 0x1610)
-IS_OMAP_TYPE(1611, 0x1611)
-IS_OMAP_TYPE(5912, 0x1611)
-IS_OMAP_TYPE(1621, 0x1621)
-IS_OMAP_TYPE(1710, 0x1710)
-IS_OMAP_TYPE(2420, 0x2420)
-IS_OMAP_TYPE(2422, 0x2422)
-IS_OMAP_TYPE(2423, 0x2423)
-IS_OMAP_TYPE(2430, 0x2430)
-IS_OMAP_TYPE(3430, 0x3430)
-
-#define cpu_is_omap310()               0
-#define cpu_is_omap1510()              0
-#define cpu_is_omap1610()              0
-#define cpu_is_omap5912()              0
-#define cpu_is_omap1611()              0
-#define cpu_is_omap1621()              0
-#define cpu_is_omap1710()              0
-#define cpu_is_omap2420()              0
-#define cpu_is_omap2422()              0
-#define cpu_is_omap2423()              0
-#define cpu_is_omap2430()              0
-#define cpu_is_omap3430()              0
-#define cpu_is_omap3630()              0
-#define soc_is_omap5430()              0
-
-/*
- * Whether we have MULTI_OMAP1 or not, we still need to distinguish
- * between 310 vs. 1510 and 1611B/5912 vs. 1710.
- */
-
-#if defined(CONFIG_ARCH_OMAP15XX)
-# undef  cpu_is_omap310
-# undef  cpu_is_omap1510
-# define cpu_is_omap310()              is_omap310()
-# define cpu_is_omap1510()             is_omap1510()
-#endif
-
-#if defined(CONFIG_ARCH_OMAP16XX)
-# undef  cpu_is_omap1610
-# undef  cpu_is_omap1611
-# undef  cpu_is_omap5912
-# undef  cpu_is_omap1621
-# undef  cpu_is_omap1710
-# define cpu_is_omap1610()             is_omap1610()
-# define cpu_is_omap1611()             is_omap1611()
-# define cpu_is_omap5912()             is_omap5912()
-# define cpu_is_omap1621()             is_omap1621()
-# define cpu_is_omap1710()             is_omap1710()
-#endif
-
-#if defined(CONFIG_ARCH_OMAP2)
-# undef  cpu_is_omap2420
-# undef  cpu_is_omap2422
-# undef  cpu_is_omap2423
-# undef  cpu_is_omap2430
-# define cpu_is_omap2420()             is_omap2420()
-# define cpu_is_omap2422()             is_omap2422()
-# define cpu_is_omap2423()             is_omap2423()
-# define cpu_is_omap2430()             is_omap2430()
-#endif
-
-#if defined(CONFIG_ARCH_OMAP3)
-# undef cpu_is_omap3430
-# undef cpu_is_ti81xx
-# undef cpu_is_ti816x
-# undef cpu_is_ti814x
-# undef soc_is_am35xx
-# define cpu_is_omap3430()             is_omap3430()
-# undef cpu_is_omap3630
-# define cpu_is_omap3630()             is_omap363x()
-# define cpu_is_ti81xx()               is_ti81xx()
-# define cpu_is_ti816x()               is_ti816x()
-# define cpu_is_ti814x()               is_ti814x()
-# define soc_is_am35xx()               is_am35xx()
+#ifdef CONFIG_ARCH_OMAP1
+#include <mach/soc.h>
 #endif
 
-# if defined(CONFIG_SOC_AM33XX)
-# undef soc_is_am33xx
-# undef soc_is_am335x
-# define soc_is_am33xx()               is_am33xx()
-# define soc_is_am335x()               is_am335x()
+#ifdef CONFIG_ARCH_OMAP2PLUS
+#include "../../mach-omap2/soc.h"
 #endif
 
-# if defined(CONFIG_ARCH_OMAP4)
-# undef cpu_is_omap44xx
-# undef cpu_is_omap443x
-# undef cpu_is_omap446x
-# undef cpu_is_omap447x
-# define cpu_is_omap44xx()             is_omap44xx()
-# define cpu_is_omap443x()             is_omap443x()
-# define cpu_is_omap446x()             is_omap446x()
-# define cpu_is_omap447x()             is_omap447x()
-# endif
-
-# if defined(CONFIG_SOC_OMAP5)
-# undef soc_is_omap54xx
-# undef soc_is_omap543x
-# define soc_is_omap54xx()             is_omap54xx()
-# define soc_is_omap543x()             is_omap543x()
-#endif
-
-/* Macros to detect if we have OMAP1 or OMAP2 */
-#define cpu_class_is_omap1()   (cpu_is_omap7xx() || cpu_is_omap15xx() || \
-                               cpu_is_omap16xx())
-#define cpu_class_is_omap2()   (cpu_is_omap24xx() || cpu_is_omap34xx() || \
-                               cpu_is_omap44xx() || soc_is_omap54xx() || \
-                               soc_is_am33xx())
-
-/* Various silicon revisions for omap2 */
-#define OMAP242X_CLASS         0x24200024
-#define OMAP2420_REV_ES1_0     OMAP242X_CLASS
-#define OMAP2420_REV_ES2_0     (OMAP242X_CLASS | (0x1 << 8))
-
-#define OMAP243X_CLASS         0x24300024
-#define OMAP2430_REV_ES1_0     OMAP243X_CLASS
-
-#define OMAP343X_CLASS         0x34300034
-#define OMAP3430_REV_ES1_0     OMAP343X_CLASS
-#define OMAP3430_REV_ES2_0     (OMAP343X_CLASS | (0x1 << 8))
-#define OMAP3430_REV_ES2_1     (OMAP343X_CLASS | (0x2 << 8))
-#define OMAP3430_REV_ES3_0     (OMAP343X_CLASS | (0x3 << 8))
-#define OMAP3430_REV_ES3_1     (OMAP343X_CLASS | (0x4 << 8))
-#define OMAP3430_REV_ES3_1_2   (OMAP343X_CLASS | (0x5 << 8))
-
-#define OMAP363X_CLASS         0x36300034
-#define OMAP3630_REV_ES1_0     OMAP363X_CLASS
-#define OMAP3630_REV_ES1_1     (OMAP363X_CLASS | (0x1 << 8))
-#define OMAP3630_REV_ES1_2     (OMAP363X_CLASS | (0x2 << 8))
-
-#define TI816X_CLASS           0x81600034
-#define TI8168_REV_ES1_0       TI816X_CLASS
-#define TI8168_REV_ES1_1       (TI816X_CLASS | (0x1 << 8))
-
-#define TI814X_CLASS           0x81400034
-#define TI8148_REV_ES1_0       TI814X_CLASS
-#define TI8148_REV_ES2_0       (TI814X_CLASS | (0x1 << 8))
-#define TI8148_REV_ES2_1       (TI814X_CLASS | (0x2 << 8))
-
-#define AM35XX_CLASS           0x35170034
-#define AM35XX_REV_ES1_0       AM35XX_CLASS
-#define AM35XX_REV_ES1_1       (AM35XX_CLASS | (0x1 << 8))
-
-#define AM335X_CLASS           0x33500033
-#define AM335X_REV_ES1_0       AM335X_CLASS
-
-#define OMAP443X_CLASS         0x44300044
-#define OMAP4430_REV_ES1_0     (OMAP443X_CLASS | (0x10 << 8))
-#define OMAP4430_REV_ES2_0     (OMAP443X_CLASS | (0x20 << 8))
-#define OMAP4430_REV_ES2_1     (OMAP443X_CLASS | (0x21 << 8))
-#define OMAP4430_REV_ES2_2     (OMAP443X_CLASS | (0x22 << 8))
-#define OMAP4430_REV_ES2_3     (OMAP443X_CLASS | (0x23 << 8))
-
-#define OMAP446X_CLASS         0x44600044
-#define OMAP4460_REV_ES1_0     (OMAP446X_CLASS | (0x10 << 8))
-#define OMAP4460_REV_ES1_1     (OMAP446X_CLASS | (0x11 << 8))
-
-#define OMAP447X_CLASS         0x44700044
-#define OMAP4470_REV_ES1_0     (OMAP447X_CLASS | (0x10 << 8))
-
-#define OMAP54XX_CLASS         0x54000054
-#define OMAP5430_REV_ES1_0     (OMAP54XX_CLASS | (0x30 << 16) | (0x10 << 8))
-#define OMAP5432_REV_ES1_0     (OMAP54XX_CLASS | (0x32 << 16) | (0x10 << 8))
-
-void omap2xxx_check_revision(void);
-void omap3xxx_check_revision(void);
-void omap4xxx_check_revision(void);
-void omap5xxx_check_revision(void);
-void omap3xxx_check_features(void);
-void ti81xx_check_features(void);
-void omap4xxx_check_features(void);
-
-/*
- * Runtime detection of OMAP3 features
- *
- * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip
- *    family have OS-level control over the I/O chain clock.  This is
- *    to avoid a window during which wakeups could potentially be lost
- *    during powerdomain transitions.  If this bit is set, it
- *    indicates that the chip does support OS-level control of this
- *    feature.
- */
-extern u32 omap_features;
-
-#define OMAP3_HAS_L2CACHE              BIT(0)
-#define OMAP3_HAS_IVA                  BIT(1)
-#define OMAP3_HAS_SGX                  BIT(2)
-#define OMAP3_HAS_NEON                 BIT(3)
-#define OMAP3_HAS_ISP                  BIT(4)
-#define OMAP3_HAS_192MHZ_CLK           BIT(5)
-#define OMAP3_HAS_IO_WAKEUP            BIT(6)
-#define OMAP3_HAS_SDRC                 BIT(7)
-#define OMAP3_HAS_IO_CHAIN_CTRL                BIT(8)
-#define OMAP4_HAS_MPU_1GHZ             BIT(9)
-#define OMAP4_HAS_MPU_1_2GHZ           BIT(10)
-#define OMAP4_HAS_MPU_1_5GHZ           BIT(11)
-
-
-#define OMAP3_HAS_FEATURE(feat,flag)                   \
-static inline unsigned int omap3_has_ ##feat(void)     \
-{                                                      \
-       return omap_features & OMAP3_HAS_ ##flag;       \
-}                                                      \
-
-OMAP3_HAS_FEATURE(l2cache, L2CACHE)
-OMAP3_HAS_FEATURE(sgx, SGX)
-OMAP3_HAS_FEATURE(iva, IVA)
-OMAP3_HAS_FEATURE(neon, NEON)
-OMAP3_HAS_FEATURE(isp, ISP)
-OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
-OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP)
-OMAP3_HAS_FEATURE(sdrc, SDRC)
-OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL)
-
-/*
- * Runtime detection of OMAP4 features
- */
-#define OMAP4_HAS_FEATURE(feat, flag)                  \
-static inline unsigned int omap4_has_ ##feat(void)     \
-{                                                      \
-       return omap_features & OMAP4_HAS_ ##flag;       \
-}                                                      \
-
-OMAP4_HAS_FEATURE(mpu_1ghz, MPU_1GHZ)
-OMAP4_HAS_FEATURE(mpu_1_2ghz, MPU_1_2GHZ)
-OMAP4_HAS_FEATURE(mpu_1_5ghz, MPU_1_5GHZ)
-
-#endif /* __ASSEMBLY__ */
 #endif
similarity index 54%
rename from arch/arm/mach-omap2/debug-devices.h
rename to arch/arm/plat-omap/include/plat/debug-devices.h
index a4edbd2f748485e8810fa5eda8711ae5ba8e109d..8fc4287222ddcd054440c989058715bcc032b5bf 100644 (file)
@@ -1,9 +1,2 @@
-#ifndef _OMAP_DEBUG_DEVICES_H
-#define _OMAP_DEBUG_DEVICES_H
-
-#include <linux/types.h>
-
 /* for TI reference platforms sharing the same debug card */
 extern int debug_card_init(u32 addr, unsigned gpio);
-
-#endif
diff --git a/arch/arm/plat-omap/include/plat/dma-44xx.h b/arch/arm/plat-omap/include/plat/dma-44xx.h
deleted file mode 100644 (file)
index 1f767cb..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * OMAP4 SDMA channel definitions
- *
- * Copyright (C) 2009-2010 Texas Instruments, Inc.
- * Copyright (C) 2009-2010 Nokia Corporation
- *
- * Santosh Shilimkar (santosh.shilimkar@ti.com)
- * Benoit Cousson (b-cousson@ti.com)
- * Paul Walmsley (paul@pwsan.com)
- *
- * This file is automatically generated from the OMAP hardware databases.
- * We respectfully ask that any modifications to this file be coordinated
- * with the public linux-omap@vger.kernel.org mailing list and the
- * authors above to ensure that the autogeneration scripts are kept
- * up-to-date with the file contents.
- *
- * 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 __ARCH_ARM_MACH_OMAP2_OMAP44XX_DMA_H
-#define __ARCH_ARM_MACH_OMAP2_OMAP44XX_DMA_H
-
-#define OMAP44XX_DMA_SYS_REQ0                  2
-#define OMAP44XX_DMA_SYS_REQ1                  3
-#define OMAP44XX_DMA_GPMC                      4
-#define OMAP44XX_DMA_DSS_DISPC_REQ             6
-#define OMAP44XX_DMA_SYS_REQ2                  7
-#define OMAP44XX_DMA_MCASP1_AXEVT              8
-#define OMAP44XX_DMA_ISS_REQ1                  9
-#define OMAP44XX_DMA_ISS_REQ2                  10
-#define OMAP44XX_DMA_MCASP1_AREVT              11
-#define OMAP44XX_DMA_ISS_REQ3                  12
-#define OMAP44XX_DMA_ISS_REQ4                  13
-#define OMAP44XX_DMA_DSS_RFBI_REQ              14
-#define OMAP44XX_DMA_SPI3_TX0                  15
-#define OMAP44XX_DMA_SPI3_RX0                  16
-#define OMAP44XX_DMA_MCBSP2_TX                 17
-#define OMAP44XX_DMA_MCBSP2_RX                 18
-#define OMAP44XX_DMA_MCBSP3_TX                 19
-#define OMAP44XX_DMA_MCBSP3_RX                 20
-#define OMAP44XX_DMA_C2C_SSCM_GPO0             21
-#define OMAP44XX_DMA_C2C_SSCM_GPO1             22
-#define OMAP44XX_DMA_SPI3_TX1                  23
-#define OMAP44XX_DMA_SPI3_RX1                  24
-#define OMAP44XX_DMA_I2C3_TX                   25
-#define OMAP44XX_DMA_I2C3_RX                   26
-#define OMAP44XX_DMA_I2C1_TX                   27
-#define OMAP44XX_DMA_I2C1_RX                   28
-#define OMAP44XX_DMA_I2C2_TX                   29
-#define OMAP44XX_DMA_I2C2_RX                   30
-#define OMAP44XX_DMA_MCBSP4_TX                 31
-#define OMAP44XX_DMA_MCBSP4_RX                 32
-#define OMAP44XX_DMA_MCBSP1_TX                 33
-#define OMAP44XX_DMA_MCBSP1_RX                 34
-#define OMAP44XX_DMA_SPI1_TX0                  35
-#define OMAP44XX_DMA_SPI1_RX0                  36
-#define OMAP44XX_DMA_SPI1_TX1                  37
-#define OMAP44XX_DMA_SPI1_RX1                  38
-#define OMAP44XX_DMA_SPI1_TX2                  39
-#define OMAP44XX_DMA_SPI1_RX2                  40
-#define OMAP44XX_DMA_SPI1_TX3                  41
-#define OMAP44XX_DMA_SPI1_RX3                  42
-#define OMAP44XX_DMA_SPI2_TX0                  43
-#define OMAP44XX_DMA_SPI2_RX0                  44
-#define OMAP44XX_DMA_SPI2_TX1                  45
-#define OMAP44XX_DMA_SPI2_RX1                  46
-#define OMAP44XX_DMA_MMC2_TX                   47
-#define OMAP44XX_DMA_MMC2_RX                   48
-#define OMAP44XX_DMA_UART1_TX                  49
-#define OMAP44XX_DMA_UART1_RX                  50
-#define OMAP44XX_DMA_UART2_TX                  51
-#define OMAP44XX_DMA_UART2_RX                  52
-#define OMAP44XX_DMA_UART3_TX                  53
-#define OMAP44XX_DMA_UART3_RX                  54
-#define OMAP44XX_DMA_UART4_TX                  55
-#define OMAP44XX_DMA_UART4_RX                  56
-#define OMAP44XX_DMA_MMC4_TX                   57
-#define OMAP44XX_DMA_MMC4_RX                   58
-#define OMAP44XX_DMA_MMC5_TX                   59
-#define OMAP44XX_DMA_MMC5_RX                   60
-#define OMAP44XX_DMA_MMC1_TX                   61
-#define OMAP44XX_DMA_MMC1_RX                   62
-#define OMAP44XX_DMA_SYS_REQ3                  64
-#define OMAP44XX_DMA_MCPDM_UP                  65
-#define OMAP44XX_DMA_MCPDM_DL                  66
-#define OMAP44XX_DMA_DMIC_REQ                  67
-#define OMAP44XX_DMA_C2C_SSCM_GPO2             68
-#define OMAP44XX_DMA_C2C_SSCM_GPO3             69
-#define OMAP44XX_DMA_SPI4_TX0                  70
-#define OMAP44XX_DMA_SPI4_RX0                  71
-#define OMAP44XX_DMA_DSS_DSI1_REQ0             72
-#define OMAP44XX_DMA_DSS_DSI1_REQ1             73
-#define OMAP44XX_DMA_DSS_DSI1_REQ2             74
-#define OMAP44XX_DMA_DSS_DSI1_REQ3             75
-#define OMAP44XX_DMA_DSS_HDMI_REQ              76
-#define OMAP44XX_DMA_MMC3_TX                   77
-#define OMAP44XX_DMA_MMC3_RX                   78
-#define OMAP44XX_DMA_USIM_TX                   79
-#define OMAP44XX_DMA_USIM_RX                   80
-#define OMAP44XX_DMA_DSS_DSI2_REQ0             81
-#define OMAP44XX_DMA_DSS_DSI2_REQ1             82
-#define OMAP44XX_DMA_DSS_DSI2_REQ2             83
-#define OMAP44XX_DMA_DSS_DSI2_REQ3             84
-#define OMAP44XX_DMA_SLIMBUS1_TX0              85
-#define OMAP44XX_DMA_SLIMBUS1_TX1              86
-#define OMAP44XX_DMA_SLIMBUS1_TX2              87
-#define OMAP44XX_DMA_SLIMBUS1_TX3              88
-#define OMAP44XX_DMA_SLIMBUS1_RX0              89
-#define OMAP44XX_DMA_SLIMBUS1_RX1              90
-#define OMAP44XX_DMA_SLIMBUS1_RX2              91
-#define OMAP44XX_DMA_SLIMBUS1_RX3              92
-#define OMAP44XX_DMA_SLIMBUS2_TX0              93
-#define OMAP44XX_DMA_SLIMBUS2_TX1              94
-#define OMAP44XX_DMA_SLIMBUS2_TX2              95
-#define OMAP44XX_DMA_SLIMBUS2_TX3              96
-#define OMAP44XX_DMA_SLIMBUS2_RX0              97
-#define OMAP44XX_DMA_SLIMBUS2_RX1              98
-#define OMAP44XX_DMA_SLIMBUS2_RX2              99
-#define OMAP44XX_DMA_SLIMBUS2_RX3              100
-#define OMAP44XX_DMA_ABE_REQ_0                 101
-#define OMAP44XX_DMA_ABE_REQ_1                 102
-#define OMAP44XX_DMA_ABE_REQ_2                 103
-#define OMAP44XX_DMA_ABE_REQ_3                 104
-#define OMAP44XX_DMA_ABE_REQ_4                 105
-#define OMAP44XX_DMA_ABE_REQ_5                 106
-#define OMAP44XX_DMA_ABE_REQ_6                 107
-#define OMAP44XX_DMA_ABE_REQ_7                 108
-#define OMAP44XX_DMA_AES1_P_CTX_IN_REQ         109
-#define OMAP44XX_DMA_AES1_P_DATA_IN_REQ                110
-#define OMAP44XX_DMA_AES1_P_DATA_OUT_REQ       111
-#define OMAP44XX_DMA_AES2_P_CTX_IN_REQ         112
-#define OMAP44XX_DMA_AES2_P_DATA_IN_REQ                113
-#define OMAP44XX_DMA_AES2_P_DATA_OUT_REQ       114
-#define OMAP44XX_DMA_DES_P_CTX_IN_REQ          115
-#define OMAP44XX_DMA_DES_P_DATA_IN_REQ         116
-#define OMAP44XX_DMA_DES_P_DATA_OUT_REQ                117
-#define OMAP44XX_DMA_SHA2_CTXIN_P              118
-#define OMAP44XX_DMA_SHA2_DIN_P                        119
-#define OMAP44XX_DMA_SHA2_CTXOUT_P             120
-#define OMAP44XX_DMA_AES1_P_CONTEXT_OUT_REQ    121
-#define OMAP44XX_DMA_AES2_P_CONTEXT_OUT_REQ    122
-#define OMAP44XX_DMA_I2C4_TX                   124
-#define OMAP44XX_DMA_I2C4_RX                   125
-
-#endif
index 85868e98c11cd4ce4466da49669ee4cafc41c29f..f8943c8f9dbf4ba2575ae1544e932ce516cdc6da 100644 (file)
@@ -94,11 +94,13 @@ struct dmtimer_platform_data {
        /* set_timer_src - Only used for OMAP1 devices */
        int (*set_timer_src)(struct platform_device *pdev, int source);
        u32 timer_capability;
+       int (*get_context_loss_count)(struct device *);
 };
 
 int omap_dm_timer_reserve_systimer(int id);
 struct omap_dm_timer *omap_dm_timer_request(void);
 struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id);
+struct omap_dm_timer *omap_dm_timer_request_by_cap(u32 cap);
 int omap_dm_timer_free(struct omap_dm_timer *timer);
 void omap_dm_timer_enable(struct omap_dm_timer *timer);
 void omap_dm_timer_disable(struct omap_dm_timer *timer);
@@ -263,6 +265,7 @@ struct omap_dm_timer {
        unsigned reserved:1;
        unsigned posted:1;
        struct timer_regs context;
+       int (*get_context_loss_count)(struct device *);
        int ctx_loss_count;
        int revision;
        u32 capability;
diff --git a/arch/arm/plat-omap/include/plat/fpga.h b/arch/arm/plat-omap/include/plat/fpga.h
deleted file mode 100644 (file)
index bd3c632..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * arch/arm/plat-omap/include/mach/fpga.h
- *
- * Interrupt handler for OMAP-1510 FPGA
- *
- * Copyright (C) 2001 RidgeRun, Inc.
- * Author: Greg Lonnon <glonnon@ridgerun.com>
- *
- * Copyright (C) 2002 MontaVista Software, Inc.
- *
- * Separated FPGA interrupts from innovator1510.c and cleaned up for 2.6
- * Copyright (C) 2004 Nokia Corporation by Tony Lindrgen <tony@atomide.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 __ASM_ARCH_OMAP_FPGA_H
-#define __ASM_ARCH_OMAP_FPGA_H
-
-extern void omap1510_fpga_init_irq(void);
-
-#define fpga_read(reg)                 __raw_readb(reg)
-#define fpga_write(val, reg)           __raw_writeb(val, reg)
-
-/*
- * ---------------------------------------------------------------------------
- *  H2/P2 Debug board FPGA
- * ---------------------------------------------------------------------------
- */
-/* maps in the FPGA registers and the ETHR registers */
-#define H2P2_DBG_FPGA_BASE             0xE8000000              /* VA */
-#define H2P2_DBG_FPGA_SIZE             SZ_4K                   /* SIZE */
-#define H2P2_DBG_FPGA_START            0x04000000              /* PA */
-
-#define H2P2_DBG_FPGA_ETHR_START       (H2P2_DBG_FPGA_START + 0x300)
-#define H2P2_DBG_FPGA_FPGA_REV         IOMEM(H2P2_DBG_FPGA_BASE + 0x10)        /* FPGA Revision */
-#define H2P2_DBG_FPGA_BOARD_REV                IOMEM(H2P2_DBG_FPGA_BASE + 0x12)        /* Board Revision */
-#define H2P2_DBG_FPGA_GPIO             IOMEM(H2P2_DBG_FPGA_BASE + 0x14)        /* GPIO outputs */
-#define H2P2_DBG_FPGA_LEDS             IOMEM(H2P2_DBG_FPGA_BASE + 0x16)        /* LEDs outputs */
-#define H2P2_DBG_FPGA_MISC_INPUTS      IOMEM(H2P2_DBG_FPGA_BASE + 0x18)        /* Misc inputs */
-#define H2P2_DBG_FPGA_LAN_STATUS       IOMEM(H2P2_DBG_FPGA_BASE + 0x1A)        /* LAN Status line */
-#define H2P2_DBG_FPGA_LAN_RESET                IOMEM(H2P2_DBG_FPGA_BASE + 0x1C)        /* LAN Reset line */
-
-/* NOTE:  most boards don't have a static mapping for the FPGA ... */
-struct h2p2_dbg_fpga {
-       /* offset 0x00 */
-       u16             smc91x[8];
-       /* offset 0x10 */
-       u16             fpga_rev;
-       u16             board_rev;
-       u16             gpio_outputs;
-       u16             leds;
-       /* offset 0x18 */
-       u16             misc_inputs;
-       u16             lan_status;
-       u16             lan_reset;
-       u16             reserved0;
-       /* offset 0x20 */
-       u16             ps2_data;
-       u16             ps2_ctrl;
-       /* plus also 4 rs232 ports ... */
-};
-
-/* LEDs definition on debug board (16 LEDs, all physically green) */
-#define H2P2_DBG_FPGA_LED_GREEN                (1 << 15)
-#define H2P2_DBG_FPGA_LED_AMBER                (1 << 14)
-#define H2P2_DBG_FPGA_LED_RED          (1 << 13)
-#define H2P2_DBG_FPGA_LED_BLUE         (1 << 12)
-/*  cpu0 load-meter LEDs */
-#define H2P2_DBG_FPGA_LOAD_METER       (1 << 0)        // A bit of fun on our board ...
-#define H2P2_DBG_FPGA_LOAD_METER_SIZE  11
-#define H2P2_DBG_FPGA_LOAD_METER_MASK  ((1 << H2P2_DBG_FPGA_LOAD_METER_SIZE) - 1)
-
-#define H2P2_DBG_FPGA_P2_LED_TIMER             (1 << 0)
-#define H2P2_DBG_FPGA_P2_LED_IDLE              (1 << 1)
-
-/*
- * ---------------------------------------------------------------------------
- *  OMAP-1510 FPGA
- * ---------------------------------------------------------------------------
- */
-#define OMAP1510_FPGA_BASE             0xE8000000              /* VA */
-#define OMAP1510_FPGA_SIZE             SZ_4K
-#define OMAP1510_FPGA_START            0x08000000              /* PA */
-
-/* Revision */
-#define OMAP1510_FPGA_REV_LOW                  IOMEM(OMAP1510_FPGA_BASE + 0x0)
-#define OMAP1510_FPGA_REV_HIGH                 IOMEM(OMAP1510_FPGA_BASE + 0x1)
-
-#define OMAP1510_FPGA_LCD_PANEL_CONTROL                IOMEM(OMAP1510_FPGA_BASE + 0x2)
-#define OMAP1510_FPGA_LED_DIGIT                        IOMEM(OMAP1510_FPGA_BASE + 0x3)
-#define INNOVATOR_FPGA_HID_SPI                 IOMEM(OMAP1510_FPGA_BASE + 0x4)
-#define OMAP1510_FPGA_POWER                    IOMEM(OMAP1510_FPGA_BASE + 0x5)
-
-/* Interrupt status */
-#define OMAP1510_FPGA_ISR_LO                   IOMEM(OMAP1510_FPGA_BASE + 0x6)
-#define OMAP1510_FPGA_ISR_HI                   IOMEM(OMAP1510_FPGA_BASE + 0x7)
-
-/* Interrupt mask */
-#define OMAP1510_FPGA_IMR_LO                   IOMEM(OMAP1510_FPGA_BASE + 0x8)
-#define OMAP1510_FPGA_IMR_HI                   IOMEM(OMAP1510_FPGA_BASE + 0x9)
-
-/* Reset registers */
-#define OMAP1510_FPGA_HOST_RESET               IOMEM(OMAP1510_FPGA_BASE + 0xa)
-#define OMAP1510_FPGA_RST                      IOMEM(OMAP1510_FPGA_BASE + 0xb)
-
-#define OMAP1510_FPGA_AUDIO                    IOMEM(OMAP1510_FPGA_BASE + 0xc)
-#define OMAP1510_FPGA_DIP                      IOMEM(OMAP1510_FPGA_BASE + 0xe)
-#define OMAP1510_FPGA_FPGA_IO                  IOMEM(OMAP1510_FPGA_BASE + 0xf)
-#define OMAP1510_FPGA_UART1                    IOMEM(OMAP1510_FPGA_BASE + 0x14)
-#define OMAP1510_FPGA_UART2                    IOMEM(OMAP1510_FPGA_BASE + 0x15)
-#define OMAP1510_FPGA_OMAP1510_STATUS          IOMEM(OMAP1510_FPGA_BASE + 0x16)
-#define OMAP1510_FPGA_BOARD_REV                        IOMEM(OMAP1510_FPGA_BASE + 0x18)
-#define OMAP1510P1_PPT_DATA                    IOMEM(OMAP1510_FPGA_BASE + 0x100)
-#define OMAP1510P1_PPT_STATUS                  IOMEM(OMAP1510_FPGA_BASE + 0x101)
-#define OMAP1510P1_PPT_CONTROL                 IOMEM(OMAP1510_FPGA_BASE + 0x102)
-
-#define OMAP1510_FPGA_TOUCHSCREEN              IOMEM(OMAP1510_FPGA_BASE + 0x204)
-
-#define INNOVATOR_FPGA_INFO                    IOMEM(OMAP1510_FPGA_BASE + 0x205)
-#define INNOVATOR_FPGA_LCD_BRIGHT_LO           IOMEM(OMAP1510_FPGA_BASE + 0x206)
-#define INNOVATOR_FPGA_LCD_BRIGHT_HI           IOMEM(OMAP1510_FPGA_BASE + 0x207)
-#define INNOVATOR_FPGA_LED_GRN_LO              IOMEM(OMAP1510_FPGA_BASE + 0x208)
-#define INNOVATOR_FPGA_LED_GRN_HI              IOMEM(OMAP1510_FPGA_BASE + 0x209)
-#define INNOVATOR_FPGA_LED_RED_LO              IOMEM(OMAP1510_FPGA_BASE + 0x20a)
-#define INNOVATOR_FPGA_LED_RED_HI              IOMEM(OMAP1510_FPGA_BASE + 0x20b)
-#define INNOVATOR_FPGA_CAM_USB_CONTROL         IOMEM(OMAP1510_FPGA_BASE + 0x20c)
-#define INNOVATOR_FPGA_EXP_CONTROL             IOMEM(OMAP1510_FPGA_BASE + 0x20d)
-#define INNOVATOR_FPGA_ISR2                    IOMEM(OMAP1510_FPGA_BASE + 0x20e)
-#define INNOVATOR_FPGA_IMR2                    IOMEM(OMAP1510_FPGA_BASE + 0x210)
-
-#define OMAP1510_FPGA_ETHR_START               (OMAP1510_FPGA_START + 0x300)
-
-/*
- * Power up Giga UART driver, turn on HID clock.
- * Turn off BT power, since we're not using it and it
- * draws power.
- */
-#define OMAP1510_FPGA_RESET_VALUE              0x42
-
-#define OMAP1510_FPGA_PCR_IF_PD0               (1 << 7)
-#define OMAP1510_FPGA_PCR_COM2_EN              (1 << 6)
-#define OMAP1510_FPGA_PCR_COM1_EN              (1 << 5)
-#define OMAP1510_FPGA_PCR_EXP_PD0              (1 << 4)
-#define OMAP1510_FPGA_PCR_EXP_PD1              (1 << 3)
-#define OMAP1510_FPGA_PCR_48MHZ_CLK            (1 << 2)
-#define OMAP1510_FPGA_PCR_4MHZ_CLK             (1 << 1)
-#define OMAP1510_FPGA_PCR_RSRVD_BIT0           (1 << 0)
-
-/*
- * Innovator/OMAP1510 FPGA HID register bit definitions
- */
-#define OMAP1510_FPGA_HID_SCLK (1<<0)  /* output */
-#define OMAP1510_FPGA_HID_MOSI (1<<1)  /* output */
-#define OMAP1510_FPGA_HID_nSS  (1<<2)  /* output 0/1 chip idle/select */
-#define OMAP1510_FPGA_HID_nHSUS        (1<<3)  /* output 0/1 host active/suspended */
-#define OMAP1510_FPGA_HID_MISO (1<<4)  /* input */
-#define OMAP1510_FPGA_HID_ATN  (1<<5)  /* input  0/1 chip idle/ATN */
-#define OMAP1510_FPGA_HID_rsrvd        (1<<6)
-#define OMAP1510_FPGA_HID_RESETn (1<<7)        /* output - 0/1 USAR reset/run */
-
-/* The FPGA IRQ is cascaded through GPIO_13 */
-#define OMAP1510_INT_FPGA              (IH_GPIO_BASE + 13)
-
-/* IRQ Numbers for interrupts muxed through the FPGA */
-#define OMAP1510_INT_FPGA_ATN          (OMAP_FPGA_IRQ_BASE + 0)
-#define OMAP1510_INT_FPGA_ACK          (OMAP_FPGA_IRQ_BASE + 1)
-#define OMAP1510_INT_FPGA2             (OMAP_FPGA_IRQ_BASE + 2)
-#define OMAP1510_INT_FPGA3             (OMAP_FPGA_IRQ_BASE + 3)
-#define OMAP1510_INT_FPGA4             (OMAP_FPGA_IRQ_BASE + 4)
-#define OMAP1510_INT_FPGA5             (OMAP_FPGA_IRQ_BASE + 5)
-#define OMAP1510_INT_FPGA6             (OMAP_FPGA_IRQ_BASE + 6)
-#define OMAP1510_INT_FPGA7             (OMAP_FPGA_IRQ_BASE + 7)
-#define OMAP1510_INT_FPGA8             (OMAP_FPGA_IRQ_BASE + 8)
-#define OMAP1510_INT_FPGA9             (OMAP_FPGA_IRQ_BASE + 9)
-#define OMAP1510_INT_FPGA10            (OMAP_FPGA_IRQ_BASE + 10)
-#define OMAP1510_INT_FPGA11            (OMAP_FPGA_IRQ_BASE + 11)
-#define OMAP1510_INT_FPGA12            (OMAP_FPGA_IRQ_BASE + 12)
-#define OMAP1510_INT_ETHER             (OMAP_FPGA_IRQ_BASE + 13)
-#define OMAP1510_INT_FPGAUART1         (OMAP_FPGA_IRQ_BASE + 14)
-#define OMAP1510_INT_FPGAUART2         (OMAP_FPGA_IRQ_BASE + 15)
-#define OMAP1510_INT_FPGA_TS           (OMAP_FPGA_IRQ_BASE + 16)
-#define OMAP1510_INT_FPGA17            (OMAP_FPGA_IRQ_BASE + 17)
-#define OMAP1510_INT_FPGA_CAM          (OMAP_FPGA_IRQ_BASE + 18)
-#define OMAP1510_INT_FPGA_RTC_A                (OMAP_FPGA_IRQ_BASE + 19)
-#define OMAP1510_INT_FPGA_RTC_B                (OMAP_FPGA_IRQ_BASE + 20)
-#define OMAP1510_INT_FPGA_CD           (OMAP_FPGA_IRQ_BASE + 21)
-#define OMAP1510_INT_FPGA22            (OMAP_FPGA_IRQ_BASE + 22)
-#define OMAP1510_INT_FPGA23            (OMAP_FPGA_IRQ_BASE + 23)
-
-#endif
index 7c22b9e10dc3513c6598934943798ee092858803..7a9028cb5a758bb3c7b96bb269e9c06d2f2930b6 100644 (file)
  * 02110-1301 USA
  *
  */
-#ifndef __ASM__ARCH_OMAP_I2C_H
-#define __ASM__ARCH_OMAP_I2C_H
 
-#include <linux/i2c.h>
-#include <linux/i2c-omap.h>
+#ifndef __PLAT_OMAP_I2C_H
+#define __PLAT_OMAP_I2C_H
+
+struct i2c_board_info;
+struct omap_i2c_bus_platform_data;
+
+int omap_i2c_add_bus(struct omap_i2c_bus_platform_data *i2c_pdata,
+                       int bus_id);
 
 #if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
 extern int omap_register_i2c_bus(int bus_id, u32 clkrate,
@@ -37,23 +41,7 @@ static inline int omap_register_i2c_bus(int bus_id, u32 clkrate,
 }
 #endif
 
-/**
- * i2c_dev_attr - OMAP I2C controller device attributes for omap_hwmod
- * @fifo_depth: total controller FIFO size (in bytes)
- * @flags: differences in hardware support capability
- *
- * @fifo_depth represents what exists on the hardware, not what is
- * actually configured at runtime by the device driver.
- */
-struct omap_i2c_dev_attr {
-       u8      fifo_depth;
-       u32     flags;
-};
-
-void __init omap1_i2c_mux_pins(int bus_id);
-void __init omap2_i2c_mux_pins(int bus_id);
-
 struct omap_hwmod;
 int omap_i2c_reset(struct omap_hwmod *oh);
 
-#endif /* __ASM__ARCH_OMAP_I2C_H */
+#endif /* __PLAT_OMAP_I2C_H */
diff --git a/arch/arm/plat-omap/include/plat/multi.h b/arch/arm/plat-omap/include/plat/multi.h
deleted file mode 100644 (file)
index 324d31b..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Support for compiling in multiple OMAP processors
- *
- * Copyright (C) 2010 Nokia Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#ifndef __PLAT_OMAP_MULTI_H
-#define __PLAT_OMAP_MULTI_H
-
-/*
- * Test if multicore OMAP support is needed
- */
-#undef MULTI_OMAP1
-#undef MULTI_OMAP2
-#undef OMAP_NAME
-
-#ifdef CONFIG_ARCH_OMAP730
-# ifdef OMAP_NAME
-#  undef  MULTI_OMAP1
-#  define MULTI_OMAP1
-# else
-#  define OMAP_NAME omap730
-# endif
-#endif
-#ifdef CONFIG_ARCH_OMAP850
-# ifdef OMAP_NAME
-#  undef  MULTI_OMAP1
-#  define MULTI_OMAP1
-# else
-#  define OMAP_NAME omap850
-# endif
-#endif
-#ifdef CONFIG_ARCH_OMAP15XX
-# ifdef OMAP_NAME
-#  undef  MULTI_OMAP1
-#  define MULTI_OMAP1
-# else
-#  define OMAP_NAME omap1510
-# endif
-#endif
-#ifdef CONFIG_ARCH_OMAP16XX
-# ifdef OMAP_NAME
-#  undef  MULTI_OMAP1
-#  define MULTI_OMAP1
-# else
-#  define OMAP_NAME omap16xx
-# endif
-#endif
-#ifdef CONFIG_ARCH_OMAP2PLUS
-# if (defined(OMAP_NAME) || defined(MULTI_OMAP1))
-#  error "OMAP1 and OMAP2PLUS can't be selected at the same time"
-# endif
-#endif
-#ifdef CONFIG_SOC_OMAP2420
-# ifdef OMAP_NAME
-#  undef  MULTI_OMAP2
-#  define MULTI_OMAP2
-# else
-#  define OMAP_NAME omap2420
-# endif
-#endif
-#ifdef CONFIG_SOC_OMAP2430
-# ifdef OMAP_NAME
-#  undef  MULTI_OMAP2
-#  define MULTI_OMAP2
-# else
-#  define OMAP_NAME omap2430
-# endif
-#endif
-#ifdef CONFIG_ARCH_OMAP3
-# ifdef OMAP_NAME
-#  undef  MULTI_OMAP2
-#  define MULTI_OMAP2
-# else
-#  define OMAP_NAME omap3
-# endif
-#endif
-#ifdef CONFIG_ARCH_OMAP4
-# ifdef OMAP_NAME
-#  undef  MULTI_OMAP2
-#  define MULTI_OMAP2
-# else
-#  define OMAP_NAME omap4
-# endif
-#endif
-
-#ifdef CONFIG_SOC_OMAP5
-# ifdef OMAP_NAME
-#  undef  MULTI_OMAP2
-#  define MULTI_OMAP2
-# else
-#  define OMAP_NAME omap5
-# endif
-#endif
-
-#ifdef CONFIG_SOC_AM33XX
-# ifdef OMAP_NAME
-#  undef  MULTI_OMAP2
-#  define MULTI_OMAP2
-# else
-#  define OMAP_NAME am33xx
-# endif
-#endif
-
-#endif /* __PLAT_OMAP_MULTI_H */
diff --git a/arch/arm/plat-omap/include/plat/omap-secure.h b/arch/arm/plat-omap/include/plat/omap-secure.h
deleted file mode 100644 (file)
index 0e4acd2..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __OMAP_SECURE_H__
-#define __OMAP_SECURE_H__
-
-#include <linux/types.h>
-
-extern int omap_secure_ram_reserve_memblock(void);
-
-#ifdef CONFIG_OMAP4_ERRATA_I688
-extern int omap_barrier_reserve_memblock(void);
-#else
-static inline void omap_barrier_reserve_memblock(void)
-{ }
-#endif
-#endif /* __OMAP_SECURE_H__ */
diff --git a/arch/arm/plat-omap/include/plat/prcm.h b/arch/arm/plat-omap/include/plat/prcm.h
deleted file mode 100644 (file)
index 267f43b..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * arch/arm/plat-omap/include/mach/prcm.h
- *
- * Access definations for use in OMAP24XX clock and power management
- *
- * Copyright (C) 2005 Texas Instruments, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License 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
- *
- * XXX This file is deprecated.  The PRCM is an OMAP2+-only subsystem,
- * so this file doesn't belong in plat-omap/include/plat.  Please
- * do not add anything new to this file.
- */
-
-#ifndef __ASM_ARM_ARCH_OMAP_PRCM_H
-#define __ASM_ARM_ARCH_OMAP_PRCM_H
-
-u32 omap_prcm_get_reset_sources(void);
-int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
-                        const char *name);
-
-#endif
-
-
-
diff --git a/arch/arm/plat-omap/include/plat/sdrc.h b/arch/arm/plat-omap/include/plat/sdrc.h
deleted file mode 100644 (file)
index 36d6a76..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-#ifndef ____ASM_ARCH_SDRC_H
-#define ____ASM_ARCH_SDRC_H
-
-/*
- * OMAP2/3 SDRC/SMS register definitions
- *
- * Copyright (C) 2007-2008 Texas Instruments, Inc.
- * Copyright (C) 2007-2008 Nokia Corporation
- *
- * Tony Lindgren
- * Paul Walmsley
- * Richard Woodruff
- *
- * 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.
- */
-
-
-/* SDRC register offsets - read/write with sdrc_{read,write}_reg() */
-
-#define SDRC_SYSCONFIG         0x010
-#define SDRC_CS_CFG            0x040
-#define SDRC_SHARING           0x044
-#define SDRC_ERR_TYPE          0x04C
-#define SDRC_DLLA_CTRL         0x060
-#define SDRC_DLLA_STATUS       0x064
-#define SDRC_DLLB_CTRL         0x068
-#define SDRC_DLLB_STATUS       0x06C
-#define SDRC_POWER             0x070
-#define SDRC_MCFG_0            0x080
-#define SDRC_MR_0              0x084
-#define SDRC_EMR2_0            0x08c
-#define SDRC_ACTIM_CTRL_A_0    0x09c
-#define SDRC_ACTIM_CTRL_B_0    0x0a0
-#define SDRC_RFR_CTRL_0                0x0a4
-#define SDRC_MANUAL_0          0x0a8
-#define SDRC_MCFG_1            0x0B0
-#define SDRC_MR_1              0x0B4
-#define SDRC_EMR2_1            0x0BC
-#define SDRC_ACTIM_CTRL_A_1    0x0C4
-#define SDRC_ACTIM_CTRL_B_1    0x0C8
-#define SDRC_RFR_CTRL_1                0x0D4
-#define SDRC_MANUAL_1          0x0D8
-
-#define SDRC_POWER_AUTOCOUNT_SHIFT     8
-#define SDRC_POWER_AUTOCOUNT_MASK      (0xffff << SDRC_POWER_AUTOCOUNT_SHIFT)
-#define SDRC_POWER_CLKCTRL_SHIFT       4
-#define SDRC_POWER_CLKCTRL_MASK                (0x3 << SDRC_POWER_CLKCTRL_SHIFT)
-#define SDRC_SELF_REFRESH_ON_AUTOCOUNT (0x2 << SDRC_POWER_CLKCTRL_SHIFT)
-
-/*
- * These values represent the number of memory clock cycles between
- * autorefresh initiation.  They assume 1 refresh per 64 ms (JEDEC), 8192
- * rows per device, and include a subtraction of a 50 cycle window in the
- * event that the autorefresh command is delayed due to other SDRC activity.
- * The '| 1' sets the ARE field to send one autorefresh when the autorefresh
- * counter reaches 0.
- *
- * These represent optimal values for common parts, it won't work for all.
- * As long as you scale down, most parameters are still work, they just
- * become sub-optimal. The RFR value goes in the opposite direction. If you
- * don't adjust it down as your clock period increases the refresh interval
- * will not be met. Setting all parameters for complete worst case may work,
- * but may cut memory performance by 2x. Due to errata the DLLs need to be
- * unlocked and their value needs run time calibration.        A dynamic call is
- * need for that as no single right value exists acorss production samples.
- *
- * Only the FULL speed values are given. Current code is such that rate
- * changes must be made at DPLLoutx2. The actual value adjustment for low
- * frequency operation will be handled by omap_set_performance()
- *
- * By having the boot loader boot up in the fastest L4 speed available likely
- * will result in something which you can switch between.
- */
-#define SDRC_RFR_CTRL_165MHz   (0x00044c00 | 1)
-#define SDRC_RFR_CTRL_133MHz   (0x0003de00 | 1)
-#define SDRC_RFR_CTRL_100MHz   (0x0002da01 | 1)
-#define SDRC_RFR_CTRL_110MHz   (0x0002da01 | 1) /* Need to calc */
-#define SDRC_RFR_CTRL_BYPASS   (0x00005000 | 1) /* Need to calc */
-
-
-/*
- * SMS register access
- */
-
-#define OMAP242X_SMS_REGADDR(reg)                                      \
-               (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE + reg)
-#define OMAP243X_SMS_REGADDR(reg)                                      \
-               (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE + reg)
-#define OMAP343X_SMS_REGADDR(reg)                                      \
-               (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE + reg)
-
-/* SMS register offsets - read/write with sms_{read,write}_reg() */
-
-#define SMS_SYSCONFIG                  0x010
-#define SMS_ROT_CONTROL(context)       (0x180 + 0x10 * context)
-#define SMS_ROT_SIZE(context)          (0x184 + 0x10 * context)
-#define SMS_ROT_PHYSICAL_BA(context)   (0x188 + 0x10 * context)
-/* REVISIT: fill in other SMS registers here */
-
-
-#ifndef __ASSEMBLER__
-
-/**
- * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate
- * @rate: SDRC clock rate (in Hz)
- * @actim_ctrla: Value to program to SDRC_ACTIM_CTRLA for this rate
- * @actim_ctrlb: Value to program to SDRC_ACTIM_CTRLB for this rate
- * @rfr_ctrl: Value to program to SDRC_RFR_CTRL for this rate
- * @mr: Value to program to SDRC_MR for this rate
- *
- * This structure holds a pre-computed set of register values for the
- * SDRC for a given SDRC clock rate and SDRAM chip.  These are
- * intended to be pre-computed and specified in an array in the board-*.c
- * files.  The structure is keyed off the 'rate' field.
- */
-struct omap_sdrc_params {
-       unsigned long rate;
-       u32 actim_ctrla;
-       u32 actim_ctrlb;
-       u32 rfr_ctrl;
-       u32 mr;
-};
-
-#ifdef CONFIG_SOC_HAS_OMAP2_SDRC
-void omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
-                           struct omap_sdrc_params *sdrc_cs1);
-#else
-static inline void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
-                                         struct omap_sdrc_params *sdrc_cs1) {};
-#endif
-
-int omap2_sdrc_get_params(unsigned long r,
-                         struct omap_sdrc_params **sdrc_cs0,
-                         struct omap_sdrc_params **sdrc_cs1);
-void omap2_sms_save_context(void);
-void omap2_sms_restore_context(void);
-
-void omap2_sms_write_rot_control(u32 val, unsigned ctx);
-void omap2_sms_write_rot_size(u32 val, unsigned ctx);
-void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx);
-
-#ifdef CONFIG_ARCH_OMAP2
-
-struct memory_timings {
-       u32 m_type;             /* ddr = 1, sdr = 0 */
-       u32 dll_mode;           /* use lock mode = 1, unlock mode = 0 */
-       u32 slow_dll_ctrl;      /* unlock mode, dll value for slow speed */
-       u32 fast_dll_ctrl;      /* unlock mode, dll value for fast speed */
-       u32 base_cs;            /* base chip select to use for calculations */
-};
-
-extern void omap2xxx_sdrc_init_params(u32 force_lock_to_unlock_mode);
-struct omap_sdrc_params *rx51_get_sdram_timings(void);
-
-u32 omap2xxx_sdrc_dll_is_unlocked(void);
-u32 omap2xxx_sdrc_reprogram(u32 level, u32 force);
-
-#endif  /* CONFIG_ARCH_OMAP2 */
-
-#endif  /* __ASSEMBLER__ */
-
-#endif
index 227ae26575549eb3e1ad488247dc9af08d4bbcef..ba4525059a996d44f9ce8ddb83ae0bba6802fc79 100644 (file)
@@ -1,18 +1,8 @@
-/*
- * arch/arm/plat-omap/include/mach/sram.h
- *
- * Interface for functions that need to be run in internal SRAM
- *
- * 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.
- */
+int omap_sram_init(void);
 
-#ifndef __ARCH_ARM_OMAP_SRAM_H
-#define __ARCH_ARM_OMAP_SRAM_H
-
-#ifndef __ASSEMBLY__
-#include <asm/fncpy.h>
+void omap_map_sram(unsigned long start, unsigned long size,
+                       unsigned long skip, int cached);
+void omap_sram_reset(void);
 
 extern void *omap_sram_push_address(unsigned long size);
 
@@ -24,82 +14,3 @@ extern void *omap_sram_push_address(unsigned long size);
                _res = fncpy(_sram_address, &(funcp), size);    \
        _res;                                                   \
 })
-
-extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl);
-
-extern void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
-                               u32 base_cs, u32 force_unlock);
-extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
-                                     u32 mem_type);
-extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
-
-extern u32 omap3_configure_core_dpll(
-                       u32 m2, u32 unlock_dll, u32 f, u32 inc,
-                       u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
-                       u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
-                       u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
-                       u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
-extern void omap3_sram_restore_context(void);
-
-/* Do not use these */
-extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
-extern unsigned long omap1_sram_reprogram_clock_sz;
-
-extern void omap24xx_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
-extern unsigned long omap24xx_sram_reprogram_clock_sz;
-
-extern void omap242x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
-                                               u32 base_cs, u32 force_unlock);
-extern unsigned long omap242x_sram_ddr_init_sz;
-
-extern u32 omap242x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val,
-                                               int bypass);
-extern unsigned long omap242x_sram_set_prcm_sz;
-
-extern void omap242x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
-                                               u32 mem_type);
-extern unsigned long omap242x_sram_reprogram_sdrc_sz;
-
-
-extern void omap243x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
-                                               u32 base_cs, u32 force_unlock);
-extern unsigned long omap243x_sram_ddr_init_sz;
-
-extern u32 omap243x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val,
-                                               int bypass);
-extern unsigned long omap243x_sram_set_prcm_sz;
-
-extern void omap243x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
-                                               u32 mem_type);
-extern unsigned long omap243x_sram_reprogram_sdrc_sz;
-
-extern u32 omap3_sram_configure_core_dpll(
-                       u32 m2, u32 unlock_dll, u32 f, u32 inc,
-                       u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
-                       u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
-                       u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
-                       u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
-extern unsigned long omap3_sram_configure_core_dpll_sz;
-
-#ifdef CONFIG_PM
-extern void omap_push_sram_idle(void);
-#else
-static inline void omap_push_sram_idle(void) {}
-#endif /* CONFIG_PM */
-
-#endif /* __ASSEMBLY__ */
-
-/*
- * OMAP2+: define the SRAM PA addresses.
- * Used by the SRAM management code and the idle sleep code.
- */
-#define OMAP2_SRAM_PA          0x40200000
-#define OMAP3_SRAM_PA           0x40200000
-#ifdef CONFIG_OMAP4_ERRATA_I688
-#define OMAP4_SRAM_PA          0x40304000
-#define OMAP4_SRAM_VA          0xfe404000
-#else
-#define OMAP4_SRAM_PA          0x40300000
-#endif
-#define AM33XX_SRAM_PA         0x40300000
-#endif
diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
deleted file mode 100644 (file)
index 7f7b112..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * arch/arm/plat-omap/include/mach/uncompress.h
- *
- * Serial port stubs for kernel decompress status messages
- *
- * Initially based on:
- * linux-2.4.15-rmk1-dsplinux1.6/arch/arm/plat-omap/include/mach1510/uncompress.h
- * Copyright (C) 2000 RidgeRun, Inc.
- * Author: Greg Lonnon <glonnon@ridgerun.com>
- *
- * Rewritten by:
- * Author: <source@mvista.com>
- * 2004 (c) MontaVista Software, Inc.
- *
- * 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/types.h>
-#include <linux/serial_reg.h>
-
-#include <asm/memory.h>
-#include <asm/mach-types.h>
-
-#include <plat/serial.h>
-
-#define MDR1_MODE_MASK                 0x07
-
-volatile u8 *uart_base;
-int uart_shift;
-
-/*
- * Store the DEBUG_LL uart number into memory.
- * See also debug-macro.S, and serial.c for related code.
- */
-static void set_omap_uart_info(unsigned char port)
-{
-       /*
-        * Get address of some.bss variable and round it down
-        * a la CONFIG_AUTO_ZRELADDR.
-        */
-       u32 ram_start = (u32)&uart_shift & 0xf8000000;
-       u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS);
-       *uart_info = port;
-}
-
-static void putc(int c)
-{
-       if (!uart_base)
-               return;
-
-       /* Check for UART 16x mode */
-       if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0)
-               return;
-
-       while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
-               barrier();
-       uart_base[UART_TX << uart_shift] = c;
-}
-
-static inline void flush(void)
-{
-}
-
-/*
- * Macros to configure UART1 and debug UART
- */
-#define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id)              \
-       if (machine_is_##mach()) {                                      \
-               uart_base = (volatile u8 *)(dbg_uart);                  \
-               uart_shift = (dbg_shft);                                \
-               port = (dbg_id);                                        \
-               set_omap_uart_info(port);                               \
-               break;                                                  \
-       }
-
-#define DEBUG_LL_OMAP7XX(p, mach)                                      \
-       _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, \
-               OMAP1UART##p)
-
-#define DEBUG_LL_OMAP1(p, mach)                                                \
-       _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT,    \
-               OMAP1UART##p)
-
-#define DEBUG_LL_OMAP2(p, mach)                                                \
-       _DEBUG_LL_ENTRY(mach, OMAP2_UART##p##_BASE, OMAP_PORT_SHIFT,    \
-               OMAP2UART##p)
-
-#define DEBUG_LL_OMAP3(p, mach)                                                \
-       _DEBUG_LL_ENTRY(mach, OMAP3_UART##p##_BASE, OMAP_PORT_SHIFT,    \
-               OMAP3UART##p)
-
-#define DEBUG_LL_OMAP4(p, mach)                                                \
-       _DEBUG_LL_ENTRY(mach, OMAP4_UART##p##_BASE, OMAP_PORT_SHIFT,    \
-               OMAP4UART##p)
-
-#define DEBUG_LL_OMAP5(p, mach)                                                \
-       _DEBUG_LL_ENTRY(mach, OMAP5_UART##p##_BASE, OMAP_PORT_SHIFT,    \
-               OMAP5UART##p)
-/* Zoom2/3 shift is different for UART1 and external port */
-#define DEBUG_LL_ZOOM(mach)                                            \
-       _DEBUG_LL_ENTRY(mach, ZOOM_UART_BASE, ZOOM_PORT_SHIFT, ZOOM_UART)
-
-#define DEBUG_LL_TI81XX(p, mach)                                       \
-       _DEBUG_LL_ENTRY(mach, TI81XX_UART##p##_BASE, OMAP_PORT_SHIFT,   \
-               TI81XXUART##p)
-
-#define DEBUG_LL_AM33XX(p, mach)                                       \
-       _DEBUG_LL_ENTRY(mach, AM33XX_UART##p##_BASE, OMAP_PORT_SHIFT,   \
-               AM33XXUART##p)
-
-static inline void arch_decomp_setup(void)
-{
-       int port = 0;
-
-       /*
-        * Initialize the port based on the machine ID from the bootloader.
-        * Note that we're using macros here instead of switch statement
-        * as machine_is functions are optimized out for the boards that
-        * are not selected.
-        */
-       do {
-               /* omap7xx/8xx based boards using UART1 with shift 0 */
-               DEBUG_LL_OMAP7XX(1, herald);
-               DEBUG_LL_OMAP7XX(1, omap_perseus2);
-
-               /* omap15xx/16xx based boards using UART1 */
-               DEBUG_LL_OMAP1(1, ams_delta);
-               DEBUG_LL_OMAP1(1, nokia770);
-               DEBUG_LL_OMAP1(1, omap_h2);
-               DEBUG_LL_OMAP1(1, omap_h3);
-               DEBUG_LL_OMAP1(1, omap_innovator);
-               DEBUG_LL_OMAP1(1, omap_osk);
-               DEBUG_LL_OMAP1(1, omap_palmte);
-               DEBUG_LL_OMAP1(1, omap_palmz71);
-
-               /* omap15xx/16xx based boards using UART2 */
-               DEBUG_LL_OMAP1(2, omap_palmtt);
-
-               /* omap15xx/16xx based boards using UART3 */
-               DEBUG_LL_OMAP1(3, sx1);
-
-               /* omap2 based boards using UART1 */
-               DEBUG_LL_OMAP2(1, omap_2430sdp);
-               DEBUG_LL_OMAP2(1, omap_apollon);
-               DEBUG_LL_OMAP2(1, omap_h4);
-
-               /* omap2 based boards using UART3 */
-               DEBUG_LL_OMAP2(3, nokia_n800);
-               DEBUG_LL_OMAP2(3, nokia_n810);
-               DEBUG_LL_OMAP2(3, nokia_n810_wimax);
-
-               /* omap3 based boards using UART1 */
-               DEBUG_LL_OMAP2(1, omap3evm);
-               DEBUG_LL_OMAP3(1, omap_3430sdp);
-               DEBUG_LL_OMAP3(1, omap_3630sdp);
-               DEBUG_LL_OMAP3(1, omap3530_lv_som);
-               DEBUG_LL_OMAP3(1, omap3_torpedo);
-
-               /* omap3 based boards using UART3 */
-               DEBUG_LL_OMAP3(3, cm_t35);
-               DEBUG_LL_OMAP3(3, cm_t3517);
-               DEBUG_LL_OMAP3(3, cm_t3730);
-               DEBUG_LL_OMAP3(3, craneboard);
-               DEBUG_LL_OMAP3(3, devkit8000);
-               DEBUG_LL_OMAP3(3, igep0020);
-               DEBUG_LL_OMAP3(3, igep0030);
-               DEBUG_LL_OMAP3(3, nokia_rm680);
-               DEBUG_LL_OMAP3(3, nokia_rm696);
-               DEBUG_LL_OMAP3(3, nokia_rx51);
-               DEBUG_LL_OMAP3(3, omap3517evm);
-               DEBUG_LL_OMAP3(3, omap3_beagle);
-               DEBUG_LL_OMAP3(3, omap3_pandora);
-               DEBUG_LL_OMAP3(3, omap_ldp);
-               DEBUG_LL_OMAP3(3, overo);
-               DEBUG_LL_OMAP3(3, touchbook);
-
-               /* omap4 based boards using UART3 */
-               DEBUG_LL_OMAP4(3, omap_4430sdp);
-               DEBUG_LL_OMAP4(3, omap4_panda);
-
-               /* omap5 based boards using UART3 */
-               DEBUG_LL_OMAP5(3, omap5_sevm);
-
-               /* zoom2/3 external uart */
-               DEBUG_LL_ZOOM(omap_zoom2);
-               DEBUG_LL_ZOOM(omap_zoom3);
-
-               /* TI8168 base boards using UART3 */
-               DEBUG_LL_TI81XX(3, ti8168evm);
-
-               /* TI8148 base boards using UART1 */
-               DEBUG_LL_TI81XX(1, ti8148evm);
-
-               /* AM33XX base boards using UART1 */
-               DEBUG_LL_AM33XX(1, am335xevm);
-       } while (0);
-}
-
-/*
- * nothing to do
- */
-#define arch_decomp_wdog()
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h
deleted file mode 100644 (file)
index 87ee140..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-// include/asm-arm/mach-omap/usb.h
-
-#ifndef        __ASM_ARCH_OMAP_USB_H
-#define        __ASM_ARCH_OMAP_USB_H
-
-#include <linux/io.h>
-#include <linux/platform_device.h>
-#include <linux/usb/musb.h>
-
-#define OMAP3_HS_USB_PORTS     3
-
-enum usbhs_omap_port_mode {
-       OMAP_USBHS_PORT_MODE_UNUSED,
-       OMAP_EHCI_PORT_MODE_PHY,
-       OMAP_EHCI_PORT_MODE_TLL,
-       OMAP_EHCI_PORT_MODE_HSIC,
-       OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0,
-       OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM,
-       OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0,
-       OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM,
-       OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0,
-       OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM,
-       OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0,
-       OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM,
-       OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0,
-       OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM
-};
-
-struct usbhs_omap_board_data {
-       enum usbhs_omap_port_mode       port_mode[OMAP3_HS_USB_PORTS];
-
-       /* have to be valid if phy_reset is true and portx is in phy mode */
-       int     reset_gpio_port[OMAP3_HS_USB_PORTS];
-
-       /* Set this to true for ES2.x silicon */
-       unsigned                        es2_compatibility:1;
-
-       unsigned                        phy_reset:1;
-
-       /*
-        * Regulators for USB PHYs.
-        * Each PHY can have a separate regulator.
-        */
-       struct regulator                *regulator[OMAP3_HS_USB_PORTS];
-};
-
-#ifdef CONFIG_ARCH_OMAP2PLUS
-
-struct ehci_hcd_omap_platform_data {
-       enum usbhs_omap_port_mode       port_mode[OMAP3_HS_USB_PORTS];
-       int                             reset_gpio_port[OMAP3_HS_USB_PORTS];
-       struct regulator                *regulator[OMAP3_HS_USB_PORTS];
-       unsigned                        phy_reset:1;
-};
-
-struct ohci_hcd_omap_platform_data {
-       enum usbhs_omap_port_mode       port_mode[OMAP3_HS_USB_PORTS];
-       unsigned                        es2_compatibility:1;
-};
-
-struct usbhs_omap_platform_data {
-       enum usbhs_omap_port_mode               port_mode[OMAP3_HS_USB_PORTS];
-
-       struct ehci_hcd_omap_platform_data      *ehci_data;
-       struct ohci_hcd_omap_platform_data      *ohci_data;
-};
-
-struct usbtll_omap_platform_data {
-       enum usbhs_omap_port_mode               port_mode[OMAP3_HS_USB_PORTS];
-};
-/*-------------------------------------------------------------------------*/
-
-struct omap_musb_board_data {
-       u8      interface_type;
-       u8      mode;
-       u16     power;
-       unsigned extvbus:1;
-       void    (*set_phy_power)(u8 on);
-       void    (*clear_irq)(void);
-       void    (*set_mode)(u8 mode);
-       void    (*reset)(void);
-};
-
-enum musb_interface    {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
-
-extern void usb_musb_init(struct omap_musb_board_data *board_data);
-
-extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
-extern int omap_tll_enable(void);
-extern int omap_tll_disable(void);
-
-extern int omap4430_phy_power(struct device *dev, int ID, int on);
-extern int omap4430_phy_set_clk(struct device *dev, int on);
-extern int omap4430_phy_init(struct device *dev);
-extern int omap4430_phy_exit(struct device *dev);
-extern int omap4430_phy_suspend(struct device *dev, int suspend);
-
-#endif
-
-extern void am35x_musb_reset(void);
-extern void am35x_musb_phy_power(u8 on);
-extern void am35x_musb_clear_irq(void);
-extern void am35x_set_mode(u8 musb_mode);
-extern void ti81xx_musb_phy_power(u8 on);
-
-/* AM35x */
-/* USB 2.0 PHY Control */
-#define CONF2_PHY_GPIOMODE     (1 << 23)
-#define CONF2_OTGMODE          (3 << 14)
-#define CONF2_NO_OVERRIDE      (0 << 14)
-#define CONF2_FORCE_HOST       (1 << 14)
-#define CONF2_FORCE_DEVICE     (2 << 14)
-#define CONF2_FORCE_HOST_VBUS_LOW (3 << 14)
-#define CONF2_SESENDEN         (1 << 13)
-#define CONF2_VBDTCTEN         (1 << 12)
-#define CONF2_REFFREQ_24MHZ    (2 << 8)
-#define CONF2_REFFREQ_26MHZ    (7 << 8)
-#define CONF2_REFFREQ_13MHZ    (6 << 8)
-#define CONF2_REFFREQ          (0xf << 8)
-#define CONF2_PHYCLKGD         (1 << 7)
-#define CONF2_VBUSSENSE                (1 << 6)
-#define CONF2_PHY_PLLON                (1 << 5)
-#define CONF2_RESET            (1 << 4)
-#define CONF2_PHYPWRDN         (1 << 3)
-#define CONF2_OTGPWRDN         (1 << 2)
-#define CONF2_DATPOL           (1 << 1)
-
-/* TI81XX specific definitions */
-#define USBCTRL0       0x620
-#define USBSTAT0       0x624
-
-/* TI816X PHY controls bits */
-#define TI816X_USBPHY0_NORMAL_MODE     (1 << 0)
-#define TI816X_USBPHY_REFCLK_OSC       (1 << 8)
-
-/* TI814X PHY controls bits */
-#define USBPHY_CM_PWRDN                (1 << 0)
-#define USBPHY_OTG_PWRDN       (1 << 1)
-#define USBPHY_CHGDET_DIS      (1 << 2)
-#define USBPHY_CHGDET_RSTRT    (1 << 3)
-#define USBPHY_SRCONDM         (1 << 4)
-#define USBPHY_SINKONDP                (1 << 5)
-#define USBPHY_CHGISINK_EN     (1 << 6)
-#define USBPHY_CHGVSRC_EN      (1 << 7)
-#define USBPHY_DMPULLUP                (1 << 8)
-#define USBPHY_DPPULLUP                (1 << 9)
-#define USBPHY_CDET_EXTCTL     (1 << 10)
-#define USBPHY_GPIO_MODE       (1 << 12)
-#define USBPHY_DPOPBUFCTL      (1 << 13)
-#define USBPHY_DMOPBUFCTL      (1 << 14)
-#define USBPHY_DPINPUT         (1 << 15)
-#define USBPHY_DMINPUT         (1 << 16)
-#define USBPHY_DPGPIO_PD       (1 << 17)
-#define USBPHY_DMGPIO_PD       (1 << 18)
-#define USBPHY_OTGVDET_EN      (1 << 19)
-#define USBPHY_OTGSESSEND_EN   (1 << 20)
-#define USBPHY_DATA_POLARITY   (1 << 23)
-
-#if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_USB)
-u32 omap1_usb0_init(unsigned nwires, unsigned is_device);
-u32 omap1_usb1_init(unsigned nwires);
-u32 omap1_usb2_init(unsigned nwires, unsigned alt_pingroup);
-#else
-static inline u32 omap1_usb0_init(unsigned nwires, unsigned is_device)
-{
-       return 0;
-}
-static inline u32 omap1_usb1_init(unsigned nwires)
-{
-       return 0;
-
-}
-static inline u32 omap1_usb2_init(unsigned nwires, unsigned alt_pingroup)
-{
-       return 0;
-}
-#endif
-
-#endif /* __ASM_ARCH_OMAP_USB_H */
index 28acb383e7df0182d5538a1c47d9c23b7dafb2f9..743fc2836f7aaa8877349cd47fe98669351e11d2 100644 (file)
 #include <linux/init.h>
 #include <linux/io.h>
 
+#include <asm/fncpy.h>
 #include <asm/tlb.h>
 #include <asm/cacheflush.h>
 
 #include <asm/mach/map.h>
 
-#include <plat/sram.h>
-#include <plat/cpu.h>
-
-#include "sram.h"
-
-/* XXX These "sideways" includes will disappear when sram.c becomes a driver */
-#include "../mach-omap2/iomap.h"
-#include "../mach-omap2/prm2xxx_3xxx.h"
-#include "../mach-omap2/sdrc.h"
-
-#define OMAP1_SRAM_PA          0x20000000
-#define OMAP2_SRAM_PUB_PA      (OMAP2_SRAM_PA + 0xf800)
-#define OMAP3_SRAM_PUB_PA       (OMAP3_SRAM_PA + 0x8000)
-#ifdef CONFIG_OMAP4_ERRATA_I688
-#define OMAP4_SRAM_PUB_PA      OMAP4_SRAM_PA
-#else
-#define OMAP4_SRAM_PUB_PA      (OMAP4_SRAM_PA + 0x4000)
-#endif
-#define OMAP5_SRAM_PA          0x40300000
-
-#if defined(CONFIG_ARCH_OMAP2PLUS)
-#define SRAM_BOOTLOADER_SZ     0x00
-#else
-#define SRAM_BOOTLOADER_SZ     0x80
-#endif
-
-#define OMAP24XX_VA_REQINFOPERM0       OMAP2_L3_IO_ADDRESS(0x68005048)
-#define OMAP24XX_VA_READPERM0          OMAP2_L3_IO_ADDRESS(0x68005050)
-#define OMAP24XX_VA_WRITEPERM0         OMAP2_L3_IO_ADDRESS(0x68005058)
-
-#define OMAP34XX_VA_REQINFOPERM0       OMAP2_L3_IO_ADDRESS(0x68012848)
-#define OMAP34XX_VA_READPERM0          OMAP2_L3_IO_ADDRESS(0x68012850)
-#define OMAP34XX_VA_WRITEPERM0         OMAP2_L3_IO_ADDRESS(0x68012858)
-#define OMAP34XX_VA_ADDR_MATCH2                OMAP2_L3_IO_ADDRESS(0x68012880)
-#define OMAP34XX_VA_SMS_RG_ATT0                OMAP2_L3_IO_ADDRESS(0x6C000048)
-
-#define GP_DEVICE              0x300
-
 #define ROUND_DOWN(value,boundary)     ((value) & (~((boundary)-1)))
 
-static unsigned long omap_sram_start;
 static void __iomem *omap_sram_base;
 static unsigned long omap_sram_skip;
 static unsigned long omap_sram_size;
 static void __iomem *omap_sram_ceil;
 
-/*
- * Depending on the target RAMFS firewall setup, the public usable amount of
- * SRAM varies.  The default accessible size for all device types is 2k. A GP
- * device allows ARM11 but not other initiators for full size. This
- * functionality seems ok until some nice security API happens.
- */
-static int is_sram_locked(void)
-{
-       if (OMAP2_DEVICE_TYPE_GP == omap_type()) {
-               /* RAMFW: R/W access to all initiators for all qualifier sets */
-               if (cpu_is_omap242x()) {
-                       __raw_writel(0xFF, OMAP24XX_VA_REQINFOPERM0); /* all q-vects */
-                       __raw_writel(0xCFDE, OMAP24XX_VA_READPERM0);  /* all i-read */
-                       __raw_writel(0xCFDE, OMAP24XX_VA_WRITEPERM0); /* all i-write */
-               }
-               if (cpu_is_omap34xx()) {
-                       __raw_writel(0xFFFF, OMAP34XX_VA_REQINFOPERM0); /* all q-vects */
-                       __raw_writel(0xFFFF, OMAP34XX_VA_READPERM0);  /* all i-read */
-                       __raw_writel(0xFFFF, OMAP34XX_VA_WRITEPERM0); /* all i-write */
-                       __raw_writel(0x0, OMAP34XX_VA_ADDR_MATCH2);
-                       __raw_writel(0xFFFFFFFF, OMAP34XX_VA_SMS_RG_ATT0);
-               }
-               return 0;
-       } else
-               return 1; /* assume locked with no PPA or security driver */
-}
-
-/*
- * The amount of SRAM depends on the core type.
- * Note that we cannot try to test for SRAM here because writes
- * to secure SRAM will hang the system. Also the SRAM is not
- * yet mapped at this point.
- */
-static void __init omap_detect_sram(void)
-{
-       omap_sram_skip = SRAM_BOOTLOADER_SZ;
-       if (cpu_class_is_omap2()) {
-               if (is_sram_locked()) {
-                       if (cpu_is_omap34xx()) {
-                               omap_sram_start = OMAP3_SRAM_PUB_PA;
-                               if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||
-                                   (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {
-                                       omap_sram_size = 0x7000; /* 28K */
-                                       omap_sram_skip += SZ_16K;
-                               } else {
-                                       omap_sram_size = 0x8000; /* 32K */
-                               }
-                       } else if (cpu_is_omap44xx()) {
-                               omap_sram_start = OMAP4_SRAM_PUB_PA;
-                               omap_sram_size = 0xa000; /* 40K */
-                       } else if (soc_is_omap54xx()) {
-                               omap_sram_start = OMAP5_SRAM_PA;
-                               omap_sram_size = SZ_128K; /* 128KB */
-                       } else {
-                               omap_sram_start = OMAP2_SRAM_PUB_PA;
-                               omap_sram_size = 0x800; /* 2K */
-                       }
-               } else {
-                       if (soc_is_am33xx()) {
-                               omap_sram_start = AM33XX_SRAM_PA;
-                               omap_sram_size = 0x10000; /* 64K */
-                       } else if (cpu_is_omap34xx()) {
-                               omap_sram_start = OMAP3_SRAM_PA;
-                               omap_sram_size = 0x10000; /* 64K */
-                       } else if (cpu_is_omap44xx()) {
-                               omap_sram_start = OMAP4_SRAM_PA;
-                               omap_sram_size = 0xe000; /* 56K */
-                       } else if (soc_is_omap54xx()) {
-                               omap_sram_start = OMAP5_SRAM_PA;
-                               omap_sram_size = SZ_128K; /* 128KB */
-                       } else {
-                               omap_sram_start = OMAP2_SRAM_PA;
-                               if (cpu_is_omap242x())
-                                       omap_sram_size = 0xa0000; /* 640K */
-                               else if (cpu_is_omap243x())
-                                       omap_sram_size = 0x10000; /* 64K */
-                       }
-               }
-       } else {
-               omap_sram_start = OMAP1_SRAM_PA;
-
-               if (cpu_is_omap7xx())
-                       omap_sram_size = 0x32000;       /* 200K */
-               else if (cpu_is_omap15xx())
-                       omap_sram_size = 0x30000;       /* 192K */
-               else if (cpu_is_omap1610() || cpu_is_omap1611() ||
-                               cpu_is_omap1621() || cpu_is_omap1710())
-                       omap_sram_size = 0x4000;        /* 16K */
-               else {
-                       pr_err("Could not detect SRAM size\n");
-                       omap_sram_size = 0x4000;
-               }
-       }
-}
-
-/*
- * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early.
- */
-static void __init omap_map_sram(void)
-{
-       int cached = 1;
-
-       if (omap_sram_size == 0)
-               return;
-
-#ifdef CONFIG_OMAP4_ERRATA_I688
-       if (cpu_is_omap44xx()) {
-               omap_sram_start += PAGE_SIZE;
-               omap_sram_size -= SZ_16K;
-       }
-#endif
-       if (cpu_is_omap34xx()) {
-               /*
-                * SRAM must be marked as non-cached on OMAP3 since the
-                * CORE DPLL M2 divider change code (in SRAM) runs with the
-                * SDRAM controller disabled, and if it is marked cached,
-                * the ARM may attempt to write cache lines back to SDRAM
-                * which will cause the system to hang.
-                */
-               cached = 0;
-       }
-
-       omap_sram_start = ROUND_DOWN(omap_sram_start, PAGE_SIZE);
-       omap_sram_base = __arm_ioremap_exec(omap_sram_start, omap_sram_size,
-                                               cached);
-       if (!omap_sram_base) {
-               pr_err("SRAM: Could not map\n");
-               return;
-       }
-
-       omap_sram_ceil = omap_sram_base + omap_sram_size;
-
-       /*
-        * Looks like we need to preserve some bootloader code at the
-        * beginning of SRAM for jumping to flash for reboot to work...
-        */
-       memset_io(omap_sram_base + omap_sram_skip, 0,
-                 omap_sram_size - omap_sram_skip);
-}
-
 /*
  * Memory allocator for SRAM: calculates the new ceiling address
  * for pushing a function using the fncpy API.
@@ -236,171 +58,39 @@ void *omap_sram_push_address(unsigned long size)
        return (void *)omap_sram_ceil;
 }
 
-#ifdef CONFIG_ARCH_OMAP1
-
-static void (*_omap_sram_reprogram_clock)(u32 dpllctl, u32 ckctl);
-
-void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl)
-{
-       BUG_ON(!_omap_sram_reprogram_clock);
-       /* On 730, bit 13 must always be 1 */
-       if (cpu_is_omap7xx())
-               ckctl |= 0x2000;
-       _omap_sram_reprogram_clock(dpllctl, ckctl);
-}
-
-static int __init omap1_sram_init(void)
-{
-       _omap_sram_reprogram_clock =
-                       omap_sram_push(omap1_sram_reprogram_clock,
-                                       omap1_sram_reprogram_clock_sz);
-
-       return 0;
-}
-
-#else
-#define omap1_sram_init()      do {} while (0)
-#endif
-
-#if defined(CONFIG_ARCH_OMAP2)
-
-static void (*_omap2_sram_ddr_init)(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
-                             u32 base_cs, u32 force_unlock);
-
-void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
-                  u32 base_cs, u32 force_unlock)
-{
-       BUG_ON(!_omap2_sram_ddr_init);
-       _omap2_sram_ddr_init(slow_dll_ctrl, fast_dll_ctrl,
-                            base_cs, force_unlock);
-}
-
-static void (*_omap2_sram_reprogram_sdrc)(u32 perf_level, u32 dll_val,
-                                         u32 mem_type);
-
-void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val, u32 mem_type)
-{
-       BUG_ON(!_omap2_sram_reprogram_sdrc);
-       _omap2_sram_reprogram_sdrc(perf_level, dll_val, mem_type);
-}
-
-static u32 (*_omap2_set_prcm)(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
-
-u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass)
-{
-       BUG_ON(!_omap2_set_prcm);
-       return _omap2_set_prcm(dpll_ctrl_val, sdrc_rfr_val, bypass);
-}
-#endif
-
-#ifdef CONFIG_SOC_OMAP2420
-static int __init omap242x_sram_init(void)
-{
-       _omap2_sram_ddr_init = omap_sram_push(omap242x_sram_ddr_init,
-                                       omap242x_sram_ddr_init_sz);
-
-       _omap2_sram_reprogram_sdrc = omap_sram_push(omap242x_sram_reprogram_sdrc,
-                                           omap242x_sram_reprogram_sdrc_sz);
-
-       _omap2_set_prcm = omap_sram_push(omap242x_sram_set_prcm,
-                                        omap242x_sram_set_prcm_sz);
-
-       return 0;
-}
-#else
-static inline int omap242x_sram_init(void)
-{
-       return 0;
-}
-#endif
-
-#ifdef CONFIG_SOC_OMAP2430
-static int __init omap243x_sram_init(void)
-{
-       _omap2_sram_ddr_init = omap_sram_push(omap243x_sram_ddr_init,
-                                       omap243x_sram_ddr_init_sz);
-
-       _omap2_sram_reprogram_sdrc = omap_sram_push(omap243x_sram_reprogram_sdrc,
-                                           omap243x_sram_reprogram_sdrc_sz);
-
-       _omap2_set_prcm = omap_sram_push(omap243x_sram_set_prcm,
-                                        omap243x_sram_set_prcm_sz);
-
-       return 0;
-}
-#else
-static inline int omap243x_sram_init(void)
-{
-       return 0;
-}
-#endif
-
-#ifdef CONFIG_ARCH_OMAP3
-
-static u32 (*_omap3_sram_configure_core_dpll)(
-                       u32 m2, u32 unlock_dll, u32 f, u32 inc,
-                       u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
-                       u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
-                       u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
-                       u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
-
-u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc,
-                       u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
-                       u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
-                       u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
-                       u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1)
-{
-       BUG_ON(!_omap3_sram_configure_core_dpll);
-       return _omap3_sram_configure_core_dpll(
-                       m2, unlock_dll, f, inc,
-                       sdrc_rfr_ctrl_0, sdrc_actim_ctrl_a_0,
-                       sdrc_actim_ctrl_b_0, sdrc_mr_0,
-                       sdrc_rfr_ctrl_1, sdrc_actim_ctrl_a_1,
-                       sdrc_actim_ctrl_b_1, sdrc_mr_1);
-}
-
-void omap3_sram_restore_context(void)
+/*
+ * The SRAM context is lost during off-idle and stack
+ * needs to be reset.
+ */
+void omap_sram_reset(void)
 {
        omap_sram_ceil = omap_sram_base + omap_sram_size;
-
-       _omap3_sram_configure_core_dpll =
-               omap_sram_push(omap3_sram_configure_core_dpll,
-                              omap3_sram_configure_core_dpll_sz);
-       omap_push_sram_idle();
 }
 
-static inline int omap34xx_sram_init(void)
-{
-       omap3_sram_restore_context();
-       return 0;
-}
-#else
-static inline int omap34xx_sram_init(void)
-{
-       return 0;
-}
-#endif /* CONFIG_ARCH_OMAP3 */
-
-static inline int am33xx_sram_init(void)
+/*
+ * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early.
+ */
+void __init omap_map_sram(unsigned long start, unsigned long size,
+                                unsigned long skip, int cached)
 {
-       return 0;
-}
+       if (size == 0)
+               return;
 
-int __init omap_sram_init(void)
-{
-       omap_detect_sram();
-       omap_map_sram();
+       start = ROUND_DOWN(start, PAGE_SIZE);
+       omap_sram_size = size;
+       omap_sram_skip = skip;
+       omap_sram_base = __arm_ioremap_exec(start, size, cached);
+       if (!omap_sram_base) {
+               pr_err("SRAM: Could not map\n");
+               return;
+       }
 
-       if (!(cpu_class_is_omap2()))
-               omap1_sram_init();
-       else if (cpu_is_omap242x())
-               omap242x_sram_init();
-       else if (cpu_is_omap2430())
-               omap243x_sram_init();
-       else if (soc_is_am33xx())
-               am33xx_sram_init();
-       else if (cpu_is_omap34xx())
-               omap34xx_sram_init();
+       omap_sram_reset();
 
-       return 0;
+       /*
+        * Looks like we need to preserve some bootloader code at the
+        * beginning of SRAM for jumping to flash for reboot to work...
+        */
+       memset_io(omap_sram_base + omap_sram_skip, 0,
+                 omap_sram_size - omap_sram_skip);
 }
diff --git a/arch/arm/plat-omap/sram.h b/arch/arm/plat-omap/sram.h
deleted file mode 100644 (file)
index 29b43ef..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __PLAT_OMAP_SRAM_H__
-#define __PLAT_OMAP_SRAM_H__
-
-extern int __init omap_sram_init(void);
-
-#endif /* __PLAT_OMAP_SRAM_H__ */
index c834b32af275d73d4cd760efeb4a365e940f1df7..3b44e0dd0a9327f8d75fc72c7bc8838a913f8571 100644 (file)
@@ -701,11 +701,14 @@ static int __init vfp_init(void)
                        elf_hwcap |= HWCAP_VFPv3;
 
                        /*
-                        * Check for VFPv3 D16. CPUs in this configuration
-                        * only have 16 x 64bit registers.
+                        * Check for VFPv3 D16 and VFPv4 D16.  CPUs in
+                        * this configuration only have 16 x 64bit
+                        * registers.
                         */
                        if (((fmrx(MVFR0) & MVFR0_A_SIMD_MASK)) == 1)
-                               elf_hwcap |= HWCAP_VFPv3D16;
+                               elf_hwcap |= HWCAP_VFPv3D16; /* also v4-D16 */
+                       else
+                               elf_hwcap |= HWCAP_VFPD32;
                }
 #endif
                /*
index 59bcb96ac3692446989501f363301daa81674d5b..f57609275449e704892101a514ecc40ee3021a3c 100644 (file)
@@ -166,3 +166,14 @@ void free_xenballooned_pages(int nr_pages, struct page **pages)
        *pages = NULL;
 }
 EXPORT_SYMBOL_GPL(free_xenballooned_pages);
+
+/* In the hypervisor.S file. */
+EXPORT_SYMBOL_GPL(HYPERVISOR_event_channel_op);
+EXPORT_SYMBOL_GPL(HYPERVISOR_grant_table_op);
+EXPORT_SYMBOL_GPL(HYPERVISOR_xen_version);
+EXPORT_SYMBOL_GPL(HYPERVISOR_console_io);
+EXPORT_SYMBOL_GPL(HYPERVISOR_sched_op);
+EXPORT_SYMBOL_GPL(HYPERVISOR_hvm_op);
+EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op);
+EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op);
+EXPORT_SYMBOL_GPL(privcmd_call);
index 074f5ed101b9d17bf49c2a0cd13b078408fcb64c..71f723984cbd94eced133e49bc7fd0db8dbdf92b 100644 (file)
 
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include <asm/opcodes-virt.h>
 #include <xen/interface/xen.h>
 
 
-/* HVC 0xEA1 */
-#ifdef CONFIG_THUMB2_KERNEL
-#define xen_hvc .word 0xf7e08ea1
-#else
-#define xen_hvc .word 0xe140ea71
-#endif
+#define XEN_IMM 0xEA1
 
 #define HYPERCALL_SIMPLE(hypercall)            \
 ENTRY(HYPERVISOR_##hypercall)                  \
        mov r12, #__HYPERVISOR_##hypercall;     \
-       xen_hvc;                                                        \
+       __HVC(XEN_IMM);                                         \
        mov pc, lr;                                                     \
 ENDPROC(HYPERVISOR_##hypercall)
 
@@ -76,7 +72,7 @@ ENTRY(HYPERVISOR_##hypercall)                 \
        stmdb sp!, {r4}                                         \
        ldr r4, [sp, #4]                                        \
        mov r12, #__HYPERVISOR_##hypercall;     \
-       xen_hvc                                                         \
+       __HVC(XEN_IMM);                                         \
        ldm sp!, {r4}                                           \
        mov pc, lr                                                      \
 ENDPROC(HYPERVISOR_##hypercall)
@@ -100,7 +96,7 @@ ENTRY(privcmd_call)
        mov r2, r3
        ldr r3, [sp, #8]
        ldr r4, [sp, #4]
-       xen_hvc
+       __HVC(XEN_IMM)
        ldm sp!, {r4}
        mov pc, lr
 ENDPROC(privcmd_call);
index ef54a59a9e89cba5e4920b8733aeea067d19d9e5..15ac18a56c93b78a2d3972e7196ce89875c2135c 100644 (file)
@@ -1,6 +1,7 @@
 config ARM64
        def_bool y
        select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
+       select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
        select GENERIC_CLOCKEVENTS
        select GENERIC_HARDIRQS_NO_DEPRECATED
        select GENERIC_IOMAP
index cf284649dfcbff5c84501ad539f4bc880e6766a7..07fea290d7c15b211e881856bb48d943a80c337a 100644 (file)
 #include <asm/user.h>
 
 typedef unsigned long elf_greg_t;
-typedef unsigned long elf_freg_t[3];
 
 #define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-typedef struct user_fp elf_fpregset_t;
+typedef struct user_fpsimd_state elf_fpregset_t;
 
 #define EM_AARCH64             183
 
@@ -87,7 +85,6 @@ typedef struct user_fp elf_fpregset_t;
 #define R_AARCH64_MOVW_PREL_G2_NC      292
 #define R_AARCH64_MOVW_PREL_G3         293
 
-
 /*
  * These are used to set parameters in the core dumps.
  */
index b42fab9f62a955f0e5ec864b186520103ebda60c..c43b4ac13008ffec8f0b39101e5cfd77e43fd3b5 100644 (file)
@@ -25,9 +25,8 @@
  *  - FPSR and FPCR
  *  - 32 128-bit data registers
  *
- * Note that user_fp forms a prefix of this structure, which is relied
- * upon in the ptrace FP/SIMD accessors. struct user_fpsimd_state must
- * form a prefix of struct fpsimd_state.
+ * Note that user_fpsimd forms a prefix of this structure, which is
+ * relied upon in the ptrace FP/SIMD accessors.
  */
 struct fpsimd_state {
        union {
index 74a2a7d304a959159e3cf69c94f0ede77a8232c2..54f6116697f7fa2d26fc4dafa5bcae05e02ed7d0 100644 (file)
@@ -114,7 +114,7 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
  *  I/O port access primitives.
  */
 #define IO_SPACE_LIMIT         0xffff
-#define PCI_IOBASE             ((void __iomem *)0xffffffbbfffe0000UL)
+#define PCI_IOBASE             ((void __iomem *)(MODULES_VADDR - SZ_2M))
 
 static inline u8 inb(unsigned long addr)
 {
@@ -225,9 +225,9 @@ extern void __iounmap(volatile void __iomem *addr);
 #define PROT_DEVICE_nGnRE      (PROT_DEFAULT | PTE_XN | PTE_ATTRINDX(MT_DEVICE_nGnRE))
 #define PROT_NORMAL_NC         (PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL_NC))
 
-#define ioremap(addr, size)            __ioremap((addr), (size), PROT_DEVICE_nGnRE)
-#define ioremap_nocache(addr, size)    __ioremap((addr), (size), PROT_DEVICE_nGnRE)
-#define ioremap_wc(addr, size)         __ioremap((addr), (size), PROT_NORMAL_NC)
+#define ioremap(addr, size)            __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
+#define ioremap_nocache(addr, size)    __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
+#define ioremap_wc(addr, size)         __ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
 #define iounmap                                __iounmap
 
 #define ARCH_HAS_IOREMAP_WC
index 5d810044fedabf7fb897ffc603c3f8a3aae271db..77f696c143396d9bf93521d6444bf12dd4b82c01 100644 (file)
@@ -43,6 +43,8 @@
 #else
 #define STACK_TOP              STACK_TOP_MAX
 #endif /* CONFIG_COMPAT */
+
+#define ARCH_LOW_ADDRESS_LIMIT PHYS_MASK
 #endif /* __KERNEL__ */
 
 struct debug_info {
index 63f853f8b718026a69342ce8bb46ff6fd948066e..68aff2816e8605113945a66e60e1dd2f5b5c2ade 100644 (file)
@@ -14,7 +14,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #ifdef CONFIG_COMPAT
-#define __ARCH_WANT_COMPAT_IPC_PARSE_VERSION
 #define __ARCH_WANT_COMPAT_STAT64
 #define __ARCH_WANT_SYS_GETHOSTNAME
 #define __ARCH_WANT_SYS_PAUSE
index ecbf2d81ec5ce483416bf57e2030bff2431c1972..c76c7241125b66d8ee762b13bdae3f73328f8fe7 100644 (file)
@@ -613,17 +613,11 @@ enum armv8_pmuv3_perf_types {
        ARMV8_PMUV3_PERFCTR_BUS_ACCESS                          = 0x19,
        ARMV8_PMUV3_PERFCTR_MEM_ERROR                           = 0x1A,
        ARMV8_PMUV3_PERFCTR_BUS_CYCLES                          = 0x1D,
-
-       /*
-        * This isn't an architected event.
-        * We detect this event number and use the cycle counter instead.
-        */
-       ARMV8_PMUV3_PERFCTR_CPU_CYCLES                          = 0xFF,
 };
 
 /* PMUv3 HW events mapping. */
 static const unsigned armv8_pmuv3_perf_map[PERF_COUNT_HW_MAX] = {
-       [PERF_COUNT_HW_CPU_CYCLES]              = ARMV8_PMUV3_PERFCTR_CPU_CYCLES,
+       [PERF_COUNT_HW_CPU_CYCLES]              = ARMV8_PMUV3_PERFCTR_CLOCK_CYCLES,
        [PERF_COUNT_HW_INSTRUCTIONS]            = ARMV8_PMUV3_PERFCTR_INSTR_EXECUTED,
        [PERF_COUNT_HW_CACHE_REFERENCES]        = ARMV8_PMUV3_PERFCTR_L1_DCACHE_ACCESS,
        [PERF_COUNT_HW_CACHE_MISSES]            = ARMV8_PMUV3_PERFCTR_L1_DCACHE_REFILL,
@@ -1106,7 +1100,7 @@ static int armv8pmu_get_event_idx(struct pmu_hw_events *cpuc,
        unsigned long evtype = event->config_base & ARMV8_EVTYPE_EVENT;
 
        /* Always place a cycle counter into the cycle counter. */
-       if (evtype == ARMV8_PMUV3_PERFCTR_CPU_CYCLES) {
+       if (evtype == ARMV8_PMUV3_PERFCTR_CLOCK_CYCLES) {
                if (test_and_set_bit(ARMV8_IDX_CYCLE_COUNTER, cpuc->used_mask))
                        return -EAGAIN;
 
index f22965ea1cfcd4bd2a5c6a276ed8675c49de19e4..e04cebdbb47fc5a82ae6042169b098b8fae13d54 100644 (file)
@@ -309,24 +309,6 @@ struct task_struct *__switch_to(struct task_struct *prev,
        return last;
 }
 
-/*
- * Fill in the task's elfregs structure for a core dump.
- */
-int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs)
-{
-       elf_core_copy_regs(elfregs, task_pt_regs(t));
-       return 1;
-}
-
-/*
- * fill in the fpe structure for a core dump...
- */
-int dump_fpu (struct pt_regs *regs, struct user_fp *fp)
-{
-       return 0;
-}
-EXPORT_SYMBOL(dump_fpu);
-
 /*
  * Shuffle the argument into the correct register before calling the
  * thread function.  x1 is the thread argument, x2 is the pointer to
index 226b6bf6e9c296ffbc0c94599b17222d69cae15d..538300f2273d82420973a0697a6d145aef60366a 100644 (file)
@@ -211,8 +211,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
         * before we continue.
         */
        set_cpu_online(cpu, true);
-       while (!cpu_active(cpu))
-               cpu_relax();
+       complete(&cpu_running);
 
        /*
         * OK, it's off to the idle thread for us
index efbf7df05d3f6e2ffe4b6105b8cdb0e49a97ab1b..4cd28931dba95da0711a4aeabed694613febce5f 100644 (file)
@@ -80,7 +80,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
 #ifdef CONFIG_ZONE_DMA32
        /* 4GB maximum for 32-bit only capable devices */
        max_dma32 = min(max, MAX_DMA32_PFN);
-       zone_size[ZONE_DMA32] = max_dma32 - min;
+       zone_size[ZONE_DMA32] = max(min, max_dma32) - min;
 #endif
        zone_size[ZONE_NORMAL] = max - max_dma32;
 
index b7412504f08a2c91635c6f75da624a59b6a6a953..df2eb4bd9fa2abbaa06c6978537fcabc88c22cf7 100644 (file)
@@ -13,6 +13,7 @@ config FRV
        select GENERIC_CPU_DEVICES
        select ARCH_WANT_IPC_PARSE_VERSION
        select GENERIC_KERNEL_THREAD
+       select GENERIC_KERNEL_EXECVE
 
 config ZONE_DMA
        bool
index 6ae3254da01976b6fdaa374f588c3c58a081058c..636d5bbcd53f31ca5cbbb96ca9f3e29f501fdfff 100644 (file)
@@ -17,6 +17,8 @@ PARAMS_PHYS    = 0x0207c000
 INITRD_PHYS     = 0x02180000
 INITRD_VIRT     = 0x02180000
 
+OBJCOPYFLAGS   :=-O binary -R .note -R .note.gnu.build-id -R .comment
+
 #
 # If you don't define ZRELADDR above,
 # then it defaults to ZTEXTADDR
@@ -32,18 +34,18 @@ Image: $(obj)/Image
 targets: $(obj)/Image
 
 $(obj)/Image: vmlinux FORCE
-       $(OBJCOPY) -O binary -R .note -R .comment -S vmlinux $@
+       $(OBJCOPY) $(OBJCOPYFLAGS) -S vmlinux $@
 
 #$(obj)/Image: $(CONFIGURE) $(SYSTEM)
-#      $(OBJCOPY) -O binary -R .note -R .comment -g -S $(SYSTEM) $@
+#      $(OBJCOPY) $(OBJCOPYFLAGS) -g -S $(SYSTEM) $@
 
 bzImage: zImage
 
 zImage:        $(CONFIGURE) compressed/$(LINUX)
-       $(OBJCOPY) -O binary -R .note -R .comment -S compressed/$(LINUX) $@
+       $(OBJCOPY) $(OBJCOPYFLAGS) -S compressed/$(LINUX) $@
 
 bootpImage: bootp/bootp
-       $(OBJCOPY) -O binary -R .note -R .comment -S bootp/bootp $@
+       $(OBJCOPY) $(OBJCOPYFLAGS) -S bootp/bootp $@
 
 compressed/$(LINUX): $(LINUX) dep
        @$(MAKE) -C compressed $(LINUX)
index 266a5b25a0c1698347715c91fd45b7e95b8eb864..2358634caccaa6b50a8cad83fb0601e1350e71d0 100644 (file)
@@ -30,7 +30,6 @@
 #define __ARCH_WANT_SYS_RT_SIGACTION
 #define __ARCH_WANT_SYS_RT_SIGSUSPEND
 #define __ARCH_WANT_SYS_EXECVE
-#define __ARCH_WANT_KERNEL_EXECVE
 
 /*
  * "Conditional" syscalls
index ee0beb354e4df38e0c067410e8f9643deec2856f..dfcd263c05176ea6cdbf3c169070a93fe79b8f5b 100644 (file)
@@ -869,11 +869,6 @@ ret_from_kernel_thread:
        call            schedule_tail
        calll.p         @(gr21,gr0)
        or              gr20,gr20,gr8
-       bra             sys_exit
-
-       .globl          ret_from_kernel_execve
-ret_from_kernel_execve:
-       ori             gr28,0,sp
        bra             __syscall_exit
 
 ###################################################################################################
@@ -1080,27 +1075,10 @@ __entry_return_from_kernel_interrupt:
        subicc          gr5,#0,gr0,icc0
        beq             icc0,#0,__entry_return_direct
 
-__entry_preempt_need_resched:
-       ldi             @(gr15,#TI_FLAGS),gr4
-       andicc          gr4,#_TIF_NEED_RESCHED,gr0,icc0
-       beq             icc0,#1,__entry_return_direct
-
-       setlos          #PREEMPT_ACTIVE,gr5
-       sti             gr5,@(gr15,#TI_FLAGS)
-
-       andi            gr23,#~PSR_PIL,gr23
-       movgs           gr23,psr
-
-       call            schedule
-       sti             gr0,@(gr15,#TI_PRE_COUNT)
-
-       movsg           psr,gr23
-       ori             gr23,#PSR_PIL_14,gr23
-       movgs           gr23,psr
-       bra             __entry_preempt_need_resched
-#else
-       bra             __entry_return_direct
+       subcc           gr0,gr0,gr0,icc2                /* set Z and clear C */
+       call            preempt_schedule_irq
 #endif
+       bra             __entry_return_direct
 
 
 ###############################################################################
index e1e3aa196aa4c25adcb33ed09fe1296b4be8e69d..7e33215f1d8fabfd28a1aa5c5144a8e73f621a90 100644 (file)
@@ -181,6 +181,9 @@ int copy_thread(unsigned long clone_flags,
        childregs = (struct pt_regs *)
                (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE);
 
+       /* set up the userspace frame (the only place that the USP is stored) */
+       *childregs = *__kernel_frame0_ptr;
+
        p->set_child_tid = p->clear_child_tid = NULL;
 
        p->thread.frame  = childregs;
@@ -191,10 +194,8 @@ int copy_thread(unsigned long clone_flags,
        p->thread.frame0 = childregs;
 
        if (unlikely(!regs)) {
-               memset(childregs, 0, sizeof(struct pt_regs));
                childregs->gr9 = usp; /* function */
                childregs->gr8 = arg;
-               childregs->psr = PSR_S;
                p->thread.pc = (unsigned long) ret_from_kernel_thread;
                save_user_regs(p->thread.user);
                return 0;
index e47857f889b6d2a18dcf839249bae5f7af66f334..b99c2a7cc7a41f6a0398c4a34715749d2a935afc 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <linux/types.h>
 #include <linux/slab.h>
+#include <linux/export.h>
 #include <linux/dma-mapping.h>
 #include <linux/list.h>
 #include <linux/pci.h>
index c6350283649d47ad3bfa50a8ef61f8f582896857..05887a1d80e5cc3755e995637e008fcf753deb94 100644 (file)
@@ -2,7 +2,8 @@
 #define __ARCH_H8300_CACHE_H
 
 /* bytes per L1 cache line */
-#define        L1_CACHE_BYTES  4
+#define        L1_CACHE_SHIFT  2
+#define        L1_CACHE_BYTES  (1 << L1_CACHE_SHIFT)
 
 /* m68k-elf-gcc  2.95.2 doesn't like these */
 
index 55bde6035216f35c5dc265b14366471cc1ce2b33..ad2b924167d799f4b410a1bc38e4350656f3da4c 100644 (file)
@@ -9,6 +9,8 @@
 
 #define LPM_ANYPATH 0xff
 #define __MAX_CSSID 0
+#define __MAX_SUBCHANNEL 65535
+#define __MAX_SSID 3
 
 #include <asm/scsw.h>
 
index dd647c919a66c766a75a8114588f1cd51afdafd7..2d3b7cb2600593f102b23dc8094fe384aa151b28 100644 (file)
@@ -506,12 +506,15 @@ static inline int pud_bad(pud_t pud)
 
 static inline int pmd_present(pmd_t pmd)
 {
-       return (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN) != 0UL;
+       unsigned long mask = _SEGMENT_ENTRY_INV | _SEGMENT_ENTRY_RO;
+       return (pmd_val(pmd) & mask) == _HPAGE_TYPE_NONE ||
+              !(pmd_val(pmd) & _SEGMENT_ENTRY_INV);
 }
 
 static inline int pmd_none(pmd_t pmd)
 {
-       return (pmd_val(pmd) & _SEGMENT_ENTRY_INV) != 0UL;
+       return (pmd_val(pmd) & _SEGMENT_ENTRY_INV) &&
+              !(pmd_val(pmd) & _SEGMENT_ENTRY_RO);
 }
 
 static inline int pmd_large(pmd_t pmd)
@@ -1223,6 +1226,11 @@ static inline void __pmd_idte(unsigned long address, pmd_t *pmdp)
 }
 
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
+
+#define SEGMENT_NONE   __pgprot(_HPAGE_TYPE_NONE)
+#define SEGMENT_RO     __pgprot(_HPAGE_TYPE_RO)
+#define SEGMENT_RW     __pgprot(_HPAGE_TYPE_RW)
+
 #define __HAVE_ARCH_PGTABLE_DEPOSIT
 extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable);
 
@@ -1242,16 +1250,15 @@ static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
 
 static inline unsigned long massage_pgprot_pmd(pgprot_t pgprot)
 {
-       unsigned long pgprot_pmd = 0;
-
-       if (pgprot_val(pgprot) & _PAGE_INVALID) {
-               if (pgprot_val(pgprot) & _PAGE_SWT)
-                       pgprot_pmd |= _HPAGE_TYPE_NONE;
-               pgprot_pmd |= _SEGMENT_ENTRY_INV;
-       }
-       if (pgprot_val(pgprot) & _PAGE_RO)
-               pgprot_pmd |= _SEGMENT_ENTRY_RO;
-       return pgprot_pmd;
+       /*
+        * pgprot is PAGE_NONE, PAGE_RO, or PAGE_RW (see __Pxxx / __Sxxx)
+        * Convert to segment table entry format.
+        */
+       if (pgprot_val(pgprot) == pgprot_val(PAGE_NONE))
+               return pgprot_val(SEGMENT_NONE);
+       if (pgprot_val(pgprot) == pgprot_val(PAGE_RO))
+               return pgprot_val(SEGMENT_RO);
+       return pgprot_val(SEGMENT_RW);
 }
 
 static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
@@ -1269,7 +1276,9 @@ static inline pmd_t pmd_mkhuge(pmd_t pmd)
 
 static inline pmd_t pmd_mkwrite(pmd_t pmd)
 {
-       pmd_val(pmd) &= ~_SEGMENT_ENTRY_RO;
+       /* Do not clobber _HPAGE_TYPE_NONE pages! */
+       if (!(pmd_val(pmd) & _SEGMENT_ENTRY_INV))
+               pmd_val(pmd) &= ~_SEGMENT_ENTRY_RO;
        return pmd;
 }
 
index bf053898630de935aa4bcbd875c62a405169384c..b6506ee32a363749c5effc99d81d551b90b9fc3d 100644 (file)
@@ -44,6 +44,12 @@ _sclp_wait_int:
 #endif
        mvc     .LoldpswS1-.LbaseS1(16,%r13),0(%r8)
        mvc     0(16,%r8),0(%r9)
+#ifdef CONFIG_64BIT
+       epsw    %r6,%r7                         # set current addressing mode
+       nill    %r6,0x1                         # in new psw (31 or 64 bit mode)
+       nilh    %r7,0x8000
+       stm     %r6,%r7,0(%r8)
+#endif
        lhi     %r6,0x0200                      # cr mask for ext int (cr0.54)
        ltr     %r2,%r2
        jz      .LsetctS1
@@ -87,7 +93,7 @@ _sclp_wait_int:
        .long   0x00080000, 0x80000000+.LwaitS1 # PSW to handle ext int
 #ifdef CONFIG_64BIT
 .LextpswS1_64:
-       .quad   0x0000000180000000, .LwaitS1    # PSW to handle ext int, 64 bit
+       .quad   0, .LwaitS1                     # PSW to handle ext int, 64 bit
 #endif
 .LwaitpswS1:
        .long   0x010a0000, 0x00000000+.LloopS1 # PSW to wait for ext int
index 2d37bb861faf69cf43e30971881fae771322158a..9017a63dda3dd21df684563770819af53a2cb370 100644 (file)
@@ -39,7 +39,7 @@ static __always_inline unsigned long follow_table(struct mm_struct *mm,
        pmd = pmd_offset(pud, addr);
        if (pmd_none(*pmd))
                return -0x10UL;
-       if (pmd_huge(*pmd)) {
+       if (pmd_large(*pmd)) {
                if (write && (pmd_val(*pmd) & _SEGMENT_ENTRY_RO))
                        return -0x04UL;
                return (pmd_val(*pmd) & HPAGE_MASK) + (addr & ~HPAGE_MASK);
index 60acb93a46809065b0d454e65f3837aa37e70aee..8b8285310b5a172a2f1e650b4c52d6c908bc193a 100644 (file)
@@ -126,7 +126,7 @@ static inline int gup_pmd_range(pud_t *pudp, pud_t pud, unsigned long addr,
                 */
                if (pmd_none(pmd) || pmd_trans_splitting(pmd))
                        return 0;
-               if (unlikely(pmd_huge(pmd))) {
+               if (unlikely(pmd_large(pmd))) {
                        if (!gup_huge_pmd(pmdp, pmd, addr, next,
                                          write, pages, nr))
                                return 0;
index b6b442b0d793daeff8caea90418458618a7ce506..9f2edb5c555179de8d00ee5d2031546df35f8a9d 100644 (file)
@@ -20,6 +20,7 @@ config SPARC
        select HAVE_ARCH_TRACEHOOK
        select SYSCTL_EXCEPTION_TRACE
        select ARCH_WANT_OPTIONAL_GPIOLIB
+       select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
        select RTC_CLASS
        select RTC_DRV_M48T59
        select HAVE_IRQ_WORK
index 6ae1ad5e502bda9de0833ebec5ee2d5758c5ceed..5d469d81761fcb039b44245b813d9f3a21310cad 100644 (file)
@@ -13,13 +13,13 @@ obj-$(CONFIG_CRYPTO_DES_SPARC64) += camellia-sparc64.o
 
 obj-$(CONFIG_CRYPTO_CRC32C_SPARC64) += crc32c-sparc64.o
 
-sha1-sparc64-y := sha1_asm.o sha1_glue.o crop_devid.o
-sha256-sparc64-y := sha256_asm.o sha256_glue.o crop_devid.o
-sha512-sparc64-y := sha512_asm.o sha512_glue.o crop_devid.o
-md5-sparc64-y := md5_asm.o md5_glue.o crop_devid.o
+sha1-sparc64-y := sha1_asm.o sha1_glue.o
+sha256-sparc64-y := sha256_asm.o sha256_glue.o
+sha512-sparc64-y := sha512_asm.o sha512_glue.o
+md5-sparc64-y := md5_asm.o md5_glue.o
 
-aes-sparc64-y := aes_asm.o aes_glue.o crop_devid.o
-des-sparc64-y := des_asm.o des_glue.o crop_devid.o
-camellia-sparc64-y := camellia_asm.o camellia_glue.o crop_devid.o
+aes-sparc64-y := aes_asm.o aes_glue.o
+des-sparc64-y := des_asm.o des_glue.o
+camellia-sparc64-y := camellia_asm.o camellia_glue.o
 
-crc32c-sparc64-y := crc32c_asm.o crc32c_glue.o crop_devid.o
+crc32c-sparc64-y := crc32c_asm.o crc32c_glue.o
index 8f1c9980f63767254e2133f0218fc449754f3b0f..3965d1d36dfaa84e4634a7918bfdb9626f4bfe1a 100644 (file)
@@ -475,3 +475,5 @@ MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("AES Secure Hash Algorithm, sparc64 aes opcode accelerated");
 
 MODULE_ALIAS("aes");
+
+#include "crop_devid.c"
index 42905c084299ebc962925cce691900bfd9fcad4a..62c89af3fd3fb3793a9dc0af63244fd94e7d808e 100644 (file)
@@ -320,3 +320,5 @@ MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Camellia Cipher Algorithm, sparc64 camellia opcode accelerated");
 
 MODULE_ALIAS("aes");
+
+#include "crop_devid.c"
index 0bd89cea8d8ed2798db52215b1d9810a07bf9cbc..5162fad912ce09faf6fcf5979e2ef60cadc03ba4 100644 (file)
@@ -177,3 +177,5 @@ MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("CRC32c (Castagnoli), sparc64 crc32c opcode accelerated");
 
 MODULE_ALIAS("crc32c");
+
+#include "crop_devid.c"
index c4940c2d307391dd47dbe04447ccc749b5b40962..41524cebcc49e4dfb48e0628efd67b9aa50619ac 100644 (file)
@@ -527,3 +527,5 @@ MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms, sparc64 des opcode accelerated");
 
 MODULE_ALIAS("des");
+
+#include "crop_devid.c"
index 603d723038ce2f6d909d2ff5d53a7d0a54197aa1..09a9ea1dfb697381a410cdaf043262d2e4e24898 100644 (file)
@@ -186,3 +186,5 @@ MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("MD5 Secure Hash Algorithm, sparc64 md5 opcode accelerated");
 
 MODULE_ALIAS("md5");
+
+#include "crop_devid.c"
index 2bbb20bee9f15c2404f1458a1815a901d3fb8828..6cd5f29e1e0d592050602afff567598d1062b713 100644 (file)
@@ -181,3 +181,5 @@ MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm, sparc64 sha1 opcode accelerated");
 
 MODULE_ALIAS("sha1");
+
+#include "crop_devid.c"
index 591e656bd891c4653ecf2c11d440eaf8f6a2593d..04f555ab268002d16ca0d1d1bf69e6e8829d4d04 100644 (file)
@@ -239,3 +239,5 @@ MODULE_DESCRIPTION("SHA-224 and SHA-256 Secure Hash Algorithm, sparc64 sha256 op
 
 MODULE_ALIAS("sha224");
 MODULE_ALIAS("sha256");
+
+#include "crop_devid.c"
index 486f0a2b7001fcda4d24edcfc5bea8ed78139080..f04d1994d19aa3acfc9286a82265a4a031b8ea5f 100644 (file)
@@ -224,3 +224,5 @@ MODULE_DESCRIPTION("SHA-384 and SHA-512 Secure Hash Algorithm, sparc64 sha512 op
 
 MODULE_ALIAS("sha384");
 MODULE_ALIAS("sha512");
+
+#include "crop_devid.c"
index ce35a1cf1a20b0b6f2ab7ae424c7ced8cc3da2f2..be56a244c9cf00de10e47b6d7933676791c8c4a8 100644 (file)
@@ -1,7 +1,7 @@
 /* atomic.h: Thankfully the V9 is at least reasonable for this
  *           stuff.
  *
- * Copyright (C) 1996, 1997, 2000 David S. Miller (davem@redhat.com)
+ * Copyright (C) 1996, 1997, 2000, 2012 David S. Miller (davem@redhat.com)
  */
 
 #ifndef __ARCH_SPARC64_ATOMIC__
@@ -106,6 +106,8 @@ static inline long atomic64_add_unless(atomic64_t *v, long a, long u)
 
 #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
 
+extern long atomic64_dec_if_positive(atomic64_t *v);
+
 /* Atomic operations are already serializing */
 #define smp_mb__before_atomic_dec()    barrier()
 #define smp_mb__after_atomic_dec()     barrier()
index db3af0d30fb10129124c594d1f1195bb59f2a6f2..4e02086b839cf2146431265ce77dbb984840d33e 100644 (file)
@@ -1,6 +1,46 @@
 #ifndef _SPARC64_BACKOFF_H
 #define _SPARC64_BACKOFF_H
 
+/* The macros in this file implement an exponential backoff facility
+ * for atomic operations.
+ *
+ * When multiple threads compete on an atomic operation, it is
+ * possible for one thread to be continually denied a successful
+ * completion of the compare-and-swap instruction.  Heavily
+ * threaded cpu implementations like Niagara can compound this
+ * problem even further.
+ *
+ * When an atomic operation fails and needs to be retried, we spin a
+ * certain number of times.  At each subsequent failure of the same
+ * operation we double the spin count, realizing an exponential
+ * backoff.
+ *
+ * When we spin, we try to use an operation that will cause the
+ * current cpu strand to block, and therefore make the core fully
+ * available to any other other runnable strands.  There are two
+ * options, based upon cpu capabilities.
+ *
+ * On all cpus prior to SPARC-T4 we do three dummy reads of the
+ * condition code register.  Each read blocks the strand for something
+ * between 40 and 50 cpu cycles.
+ *
+ * For SPARC-T4 and later we have a special "pause" instruction
+ * available.  This is implemented using writes to register %asr27.
+ * The cpu will block the number of cycles written into the register,
+ * unless a disrupting trap happens first.  SPARC-T4 specifically
+ * implements pause with a granularity of 8 cycles.  Each strand has
+ * an internal pause counter which decrements every 8 cycles.  So the
+ * chip shifts the %asr27 value down by 3 bits, and writes the result
+ * into the pause counter.  If a value smaller than 8 is written, the
+ * chip blocks for 1 cycle.
+ *
+ * To achieve the same amount of backoff as the three %ccr reads give
+ * on earlier chips, we shift the backoff value up by 7 bits.  (Three
+ * %ccr reads block for about 128 cycles, 1 << 7 == 128) We write the
+ * whole amount we want to block into the pause register, rather than
+ * loop writing 128 each time.
+ */
+
 #define BACKOFF_LIMIT  (4 * 1024)
 
 #ifdef CONFIG_SMP
 #define BACKOFF_LABEL(spin_label, continue_label) \
        spin_label
 
-#define BACKOFF_SPIN(reg, tmp, label)  \
-       mov     reg, tmp; \
-88:    brnz,pt tmp, 88b; \
-        sub    tmp, 1, tmp; \
-       set     BACKOFF_LIMIT, tmp; \
-       cmp     reg, tmp; \
-       bg,pn   %xcc, label; \
-        nop; \
-       ba,pt   %xcc, label; \
-        sllx   reg, 1, reg;
+#define BACKOFF_SPIN(reg, tmp, label)          \
+       mov             reg, tmp;               \
+88:    rd              %ccr, %g0;              \
+       rd              %ccr, %g0;              \
+       rd              %ccr, %g0;              \
+       .section        .pause_3insn_patch,"ax";\
+       .word           88b;                    \
+       sllx            tmp, 7, tmp;            \
+       wr              tmp, 0, %asr27;         \
+       clr             tmp;                    \
+       .previous;                              \
+       brnz,pt         tmp, 88b;               \
+        sub            tmp, 1, tmp;            \
+       set             BACKOFF_LIMIT, tmp;     \
+       cmp             reg, tmp;               \
+       bg,pn           %xcc, label;            \
+        nop;                                   \
+       ba,pt           %xcc, label;            \
+        sllx           reg, 1, reg;
 
 #else
 
index cef99fbc0a214b80721029fd826d1733f066868e..830502fe62b4e6a3d334abaf4076a5957deb2d9c 100644 (file)
@@ -232,9 +232,10 @@ static inline void __user *arch_compat_alloc_user_space(long len)
        struct pt_regs *regs = current_thread_info()->kregs;
        unsigned long usp = regs->u_regs[UREG_I6];
 
-       if (!(test_thread_flag(TIF_32BIT)))
+       if (test_thread_64bit_stack(usp))
                usp += STACK_BIAS;
-       else
+
+       if (test_thread_flag(TIF_32BIT))
                usp &= 0xffffffffUL;
 
        usp -= len;
index 4e5a483122a043a7eeba9e42001d32cdf56c0015..721e25f0e2ea80f19d4a7868791d4653097a2124 100644 (file)
@@ -196,7 +196,22 @@ extern unsigned long get_wchan(struct task_struct *task);
 #define KSTK_EIP(tsk)  (task_pt_regs(tsk)->tpc)
 #define KSTK_ESP(tsk)  (task_pt_regs(tsk)->u_regs[UREG_FP])
 
-#define cpu_relax()    barrier()
+/* Please see the commentary in asm/backoff.h for a description of
+ * what these instructions are doing and how they have been choosen.
+ * To make a long story short, we are trying to yield the current cpu
+ * strand during busy loops.
+ */
+#define cpu_relax()    asm volatile("\n99:\n\t"                        \
+                                    "rd        %%ccr, %%g0\n\t"        \
+                                    "rd        %%ccr, %%g0\n\t"        \
+                                    "rd        %%ccr, %%g0\n\t"        \
+                                    ".section  .pause_3insn_patch,\"ax\"\n\t"\
+                                    ".word     99b\n\t"                \
+                                    "wr        %%g0, 128, %%asr27\n\t" \
+                                    "nop\n\t"                          \
+                                    "nop\n\t"                          \
+                                    ".previous"                        \
+                                    ::: "memory")
 
 /* Prefetch support.  This is tuned for UltraSPARC-III and later.
  * UltraSPARC-I will treat these as nops, and UltraSPARC-II has
index c287651107069c58999381ba442bce84f2a6ed1f..f93003123bce01119544ef88b15b3e479fbf92cd 100644 (file)
@@ -63,5 +63,10 @@ extern char *of_console_options;
 extern void irq_trans_init(struct device_node *dp);
 extern char *build_path_component(struct device_node *dp);
 
+/* SPARC has a local implementation */
+extern int of_address_to_resource(struct device_node *dev, int index,
+                                 struct resource *r);
+#define of_address_to_resource of_address_to_resource
+
 #endif /* __KERNEL__ */
 #endif /* _SPARC_PROM_H */
index 4e227663108181b45700b0cb879d5043ee1da64b..a3fe4dcc0aa6c5d25c7fa67ce3c74390b3a01876 100644 (file)
@@ -259,6 +259,11 @@ static inline bool test_and_clear_restore_sigmask(void)
 
 #define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
 
+#define thread32_stack_is_64bit(__SP) (((__SP) & 0x1) != 0)
+#define test_thread_64bit_stack(__SP) \
+       ((test_thread_flag(TIF_32BIT) && !thread32_stack_is_64bit(__SP)) ? \
+        false : true)
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
index 48f2807d326563da2bc95be4f870517685331aaf..71b5a67522abb2bb0d8457819612aa26e948fdc8 100644 (file)
@@ -372,7 +372,9 @@ etrap_spill_fixup_64bit:                            \
 
 /* Normal 32bit spill */
 #define SPILL_2_GENERIC(ASI)                           \
-       srl     %sp, 0, %sp;                            \
+       and     %sp, 1, %g3;                            \
+       brnz,pn %g3, (. - (128 + 4));                   \
+        srl    %sp, 0, %sp;                            \
        stwa    %l0, [%sp + %g0] ASI;                   \
        mov     0x04, %g3;                              \
        stwa    %l1, [%sp + %g3] ASI;                   \
@@ -398,14 +400,16 @@ etrap_spill_fixup_64bit:                          \
        stwa    %i6, [%g1 + %g0] ASI;                   \
        stwa    %i7, [%g1 + %g3] ASI;                   \
        saved;                                          \
-        retry; nop; nop;                               \
+        retry;                                         \
        b,a,pt  %xcc, spill_fixup_dax;                  \
        b,a,pt  %xcc, spill_fixup_mna;                  \
        b,a,pt  %xcc, spill_fixup;
 
 #define SPILL_2_GENERIC_ETRAP          \
 etrap_user_spill_32bit:                        \
-       srl     %sp, 0, %sp;            \
+       and     %sp, 1, %g3;            \
+       brnz,pn %g3, etrap_user_spill_64bit;    \
+        srl    %sp, 0, %sp;            \
        stwa    %l0, [%sp + 0x00] %asi; \
        stwa    %l1, [%sp + 0x04] %asi; \
        stwa    %l2, [%sp + 0x08] %asi; \
@@ -427,7 +431,7 @@ etrap_user_spill_32bit:                     \
        ba,pt   %xcc, etrap_save;       \
         wrpr   %g1, %cwp;              \
        nop; nop; nop; nop;             \
-       nop; nop; nop; nop;             \
+       nop; nop;                       \
        ba,a,pt %xcc, etrap_spill_fixup_32bit; \
        ba,a,pt %xcc, etrap_spill_fixup_32bit; \
        ba,a,pt %xcc, etrap_spill_fixup_32bit;
@@ -592,7 +596,9 @@ user_rtt_fill_64bit:                                        \
 
 /* Normal 32bit fill */
 #define FILL_2_GENERIC(ASI)                            \
-       srl     %sp, 0, %sp;                            \
+       and     %sp, 1, %g3;                            \
+       brnz,pn %g3, (. - (128 + 4));                   \
+        srl    %sp, 0, %sp;                            \
        lduwa   [%sp + %g0] ASI, %l0;                   \
        mov     0x04, %g2;                              \
        mov     0x08, %g3;                              \
@@ -616,14 +622,16 @@ user_rtt_fill_64bit:                                      \
        lduwa   [%g1 + %g3] ASI, %i6;                   \
        lduwa   [%g1 + %g5] ASI, %i7;                   \
        restored;                                       \
-       retry; nop; nop; nop; nop;                      \
+       retry; nop; nop;                                \
        b,a,pt  %xcc, fill_fixup_dax;                   \
        b,a,pt  %xcc, fill_fixup_mna;                   \
        b,a,pt  %xcc, fill_fixup;
 
 #define FILL_2_GENERIC_RTRAP                           \
 user_rtt_fill_32bit:                                   \
-       srl     %sp, 0, %sp;                            \
+       and     %sp, 1, %g3;                            \
+       brnz,pn %g3, user_rtt_fill_64bit;               \
+        srl    %sp, 0, %sp;                            \
        lduwa   [%sp + 0x00] %asi, %l0;                 \
        lduwa   [%sp + 0x04] %asi, %l1;                 \
        lduwa   [%sp + 0x08] %asi, %l2;                 \
@@ -643,7 +651,7 @@ user_rtt_fill_32bit:                                        \
        ba,pt   %xcc, user_rtt_pre_restore;             \
         restored;                                      \
        nop; nop; nop; nop; nop;                        \
-       nop; nop; nop; nop; nop;                        \
+       nop; nop; nop;                                  \
        ba,a,pt %xcc, user_rtt_fill_fixup;              \
        ba,a,pt %xcc, user_rtt_fill_fixup;              \
        ba,a,pt %xcc, user_rtt_fill_fixup;
index 8974ef7ae920685174f7d6427da816e4d3c7d3db..cac719d1bc5c6b8238ff0b6be5f34bc166980534 100644 (file)
 #define __NR_setns             337
 #define __NR_process_vm_readv  338
 #define __NR_process_vm_writev 339
+#define __NR_kern_features     340
+#define __NR_kcmp              341
 
-#define NR_syscalls            340
+#define NR_syscalls            342
+
+/* Bitmask values returned from kern_features system call.  */
+#define KERN_FEATURE_MIXED_MODE_STACK  0x00000001
 
 #ifdef __32bit_syscall_numbers__
 /* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,
index 0c218e4c0881fba70c1748e6a4c295e0db280652..cc3c5cb47cdaa4d18e14533f5078b2dbd5f51649 100644 (file)
@@ -59,6 +59,13 @@ struct popc_6insn_patch_entry {
 extern struct popc_6insn_patch_entry __popc_6insn_patch,
        __popc_6insn_patch_end;
 
+struct pause_patch_entry {
+       unsigned int    addr;
+       unsigned int    insns[3];
+};
+extern struct pause_patch_entry __pause_3insn_patch,
+       __pause_3insn_patch_end;
+
 extern void __init per_cpu_patch(void);
 extern void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *,
                                    struct sun4v_1insn_patch_entry *);
index f8b6eee40bde6596cdd9043e46aa9c9ef908fa4c..87f60ee6543394b4aea00d3d5e91082ef0b8a41f 100644 (file)
@@ -56,11 +56,13 @@ static inline unsigned int leon_eirq_get(int cpu)
 static void leon_handle_ext_irq(unsigned int irq, struct irq_desc *desc)
 {
        unsigned int eirq;
+       struct irq_bucket *p;
        int cpu = sparc_leon3_cpuid();
 
        eirq = leon_eirq_get(cpu);
-       if ((eirq & 0x10) && irq_map[eirq]->irq) /* bit4 tells if IRQ happened */
-               generic_handle_irq(irq_map[eirq]->irq);
+       p = irq_map[eirq];
+       if ((eirq & 0x10) && p && p->irq) /* bit4 tells if IRQ happened */
+               generic_handle_irq(p->irq);
 }
 
 /* The extended IRQ controller has been found, this function registers it */
index 885a8af74064b1425be7e424ca205996c4add704..b5c38faa4eadf423db3bc20df35d2c98cd5dabf3 100644 (file)
@@ -1762,15 +1762,25 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
 
        ufp = regs->u_regs[UREG_I6] & 0xffffffffUL;
        do {
-               struct sparc_stackf32 *usf, sf;
                unsigned long pc;
 
-               usf = (struct sparc_stackf32 *) ufp;
-               if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
-                       break;
+               if (thread32_stack_is_64bit(ufp)) {
+                       struct sparc_stackf *usf, sf;
 
-               pc = sf.callers_pc;
-               ufp = (unsigned long)sf.fp;
+                       ufp += STACK_BIAS;
+                       usf = (struct sparc_stackf *) ufp;
+                       if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
+                               break;
+                       pc = sf.callers_pc & 0xffffffff;
+                       ufp = ((unsigned long) sf.fp) & 0xffffffff;
+               } else {
+                       struct sparc_stackf32 *usf, sf;
+                       usf = (struct sparc_stackf32 *) ufp;
+                       if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
+                               break;
+                       pc = sf.callers_pc;
+                       ufp = (unsigned long)sf.fp;
+               }
                perf_callchain_store(entry, pc);
        } while (entry->nr < PERF_MAX_STACK_DEPTH);
 }
index d778248ef3f8ea7b48de69d0a68ca586e5acfef3..c6e0c2910043556a073ba8e8f11843f09d20ca71 100644 (file)
@@ -452,13 +452,16 @@ void flush_thread(void)
 /* It's a bit more tricky when 64-bit tasks are involved... */
 static unsigned long clone_stackframe(unsigned long csp, unsigned long psp)
 {
+       bool stack_64bit = test_thread_64bit_stack(psp);
        unsigned long fp, distance, rval;
 
-       if (!(test_thread_flag(TIF_32BIT))) {
+       if (stack_64bit) {
                csp += STACK_BIAS;
                psp += STACK_BIAS;
                __get_user(fp, &(((struct reg_window __user *)psp)->ins[6]));
                fp += STACK_BIAS;
+               if (test_thread_flag(TIF_32BIT))
+                       fp &= 0xffffffff;
        } else
                __get_user(fp, &(((struct reg_window32 __user *)psp)->ins[6]));
 
@@ -472,7 +475,7 @@ static unsigned long clone_stackframe(unsigned long csp, unsigned long psp)
        rval = (csp - distance);
        if (copy_in_user((void __user *) rval, (void __user *) psp, distance))
                rval = 0;
-       else if (test_thread_flag(TIF_32BIT)) {
+       else if (!stack_64bit) {
                if (put_user(((u32)csp),
                             &(((struct reg_window32 __user *)rval)->ins[6])))
                        rval = 0;
@@ -507,18 +510,18 @@ void synchronize_user_stack(void)
 
        flush_user_windows();
        if ((window = get_thread_wsaved()) != 0) {
-               int winsize = sizeof(struct reg_window);
-               int bias = 0;
-
-               if (test_thread_flag(TIF_32BIT))
-                       winsize = sizeof(struct reg_window32);
-               else
-                       bias = STACK_BIAS;
-
                window -= 1;
                do {
-                       unsigned long sp = (t->rwbuf_stkptrs[window] + bias);
                        struct reg_window *rwin = &t->reg_window[window];
+                       int winsize = sizeof(struct reg_window);
+                       unsigned long sp;
+
+                       sp = t->rwbuf_stkptrs[window];
+
+                       if (test_thread_64bit_stack(sp))
+                               sp += STACK_BIAS;
+                       else
+                               winsize = sizeof(struct reg_window32);
 
                        if (!copy_to_user((char __user *)sp, rwin, winsize)) {
                                shift_window_buffer(window, get_thread_wsaved() - 1, t);
@@ -544,13 +547,6 @@ void fault_in_user_windows(void)
 {
        struct thread_info *t = current_thread_info();
        unsigned long window;
-       int winsize = sizeof(struct reg_window);
-       int bias = 0;
-
-       if (test_thread_flag(TIF_32BIT))
-               winsize = sizeof(struct reg_window32);
-       else
-               bias = STACK_BIAS;
 
        flush_user_windows();
        window = get_thread_wsaved();
@@ -558,8 +554,16 @@ void fault_in_user_windows(void)
        if (likely(window != 0)) {
                window -= 1;
                do {
-                       unsigned long sp = (t->rwbuf_stkptrs[window] + bias);
                        struct reg_window *rwin = &t->reg_window[window];
+                       int winsize = sizeof(struct reg_window);
+                       unsigned long sp;
+
+                       sp = t->rwbuf_stkptrs[window];
+
+                       if (test_thread_64bit_stack(sp))
+                               sp += STACK_BIAS;
+                       else
+                               winsize = sizeof(struct reg_window32);
 
                        if (unlikely(sp & 0x7UL))
                                stack_unaligned(sp);
index 484dabac7045aa2177df26f625ffabf9f6f523c7..7ff45e4ba6815080a29e02a64ad79bfdf9c1ed12 100644 (file)
@@ -151,7 +151,7 @@ static int regwindow64_get(struct task_struct *target,
 {
        unsigned long rw_addr = regs->u_regs[UREG_I6];
 
-       if (test_tsk_thread_flag(current, TIF_32BIT)) {
+       if (!test_thread_64bit_stack(rw_addr)) {
                struct reg_window32 win32;
                int i;
 
@@ -176,7 +176,7 @@ static int regwindow64_set(struct task_struct *target,
 {
        unsigned long rw_addr = regs->u_regs[UREG_I6];
 
-       if (test_tsk_thread_flag(current, TIF_32BIT)) {
+       if (!test_thread_64bit_stack(rw_addr)) {
                struct reg_window32 win32;
                int i;
 
index 0800e71d8a880242083688b385e88d564e4a681a..0eaf0059aaefa483bdbb228bf38c8154a7d9656b 100644 (file)
@@ -316,6 +316,25 @@ static void __init popc_patch(void)
        }
 }
 
+static void __init pause_patch(void)
+{
+       struct pause_patch_entry *p;
+
+       p = &__pause_3insn_patch;
+       while (p < &__pause_3insn_patch_end) {
+               unsigned long i, addr = p->addr;
+
+               for (i = 0; i < 3; i++) {
+                       *(unsigned int *) (addr +  (i * 4)) = p->insns[i];
+                       wmb();
+                       __asm__ __volatile__("flush     %0"
+                                            : : "r" (addr +  (i * 4)));
+               }
+
+               p++;
+       }
+}
+
 #ifdef CONFIG_SMP
 void __init boot_cpu_id_too_large(int cpu)
 {
@@ -528,6 +547,8 @@ static void __init init_sparc64_elf_hwcap(void)
 
        if (sparc64_elf_hwcap & AV_SPARC_POPC)
                popc_patch();
+       if (sparc64_elf_hwcap & AV_SPARC_PAUSE)
+               pause_patch();
 }
 
 void __init setup_arch(char **cmdline_p)
index 11c6c9603e71f03995a3c17fcdf2f28957d7fa43..878ef3d5fec522d6b23d0640df962f33c2b958df 100644 (file)
@@ -751,3 +751,8 @@ int kernel_execve(const char *filename,
                      : "cc");
        return __res;
 }
+
+asmlinkage long sys_kern_features(void)
+{
+       return KERN_FEATURE_MIXED_MODE_STACK;
+}
index 63402f9e9f51f75622f9132e0b8f5372bcc806c1..5147f574f1256a7f3304a716da22bfb2ef68d42a 100644 (file)
@@ -85,3 +85,4 @@ sys_call_table:
 /*325*/        .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init
 /*330*/        .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime
 /*335*/        .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
+/*340*/        .long sys_ni_syscall, sys_kcmp
index 3a58e0d66f51b0144ef5f9ca970bfbbbb9d01ed6..1c9af9fa38e9b0b489cb38899685e4c4c76b6584 100644 (file)
@@ -86,6 +86,7 @@ sys_call_table32:
        .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg, sys_fanotify_init
 /*330*/        .word sys32_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime
        .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev
+/*340*/        .word sys_kern_features, sys_kcmp
 
 #endif /* CONFIG_COMPAT */
 
@@ -163,3 +164,4 @@ sys_call_table:
        .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init
 /*330*/        .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime
        .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
+/*340*/        .word sys_kern_features, sys_kcmp
index f81d038f7340ce6b80cb65e0e27b2e7f2cb9edd2..8201c25e76697ad5f5a96de1b6921a3fb34372ac 100644 (file)
@@ -113,21 +113,24 @@ static inline long sign_extend_imm13(long imm)
 
 static unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs)
 {
-       unsigned long value;
+       unsigned long value, fp;
        
        if (reg < 16)
                return (!reg ? 0 : regs->u_regs[reg]);
+
+       fp = regs->u_regs[UREG_FP];
+
        if (regs->tstate & TSTATE_PRIV) {
                struct reg_window *win;
-               win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
+               win = (struct reg_window *)(fp + STACK_BIAS);
                value = win->locals[reg - 16];
-       } else if (test_thread_flag(TIF_32BIT)) {
+       } else if (!test_thread_64bit_stack(fp)) {
                struct reg_window32 __user *win32;
-               win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
+               win32 = (struct reg_window32 __user *)((unsigned long)((u32)fp));
                get_user(value, &win32->locals[reg - 16]);
        } else {
                struct reg_window __user *win;
-               win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
+               win = (struct reg_window __user *)(fp + STACK_BIAS);
                get_user(value, &win->locals[reg - 16]);
        }
        return value;
@@ -135,19 +138,24 @@ static unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs)
 
 static unsigned long *fetch_reg_addr(unsigned int reg, struct pt_regs *regs)
 {
+       unsigned long fp;
+
        if (reg < 16)
                return &regs->u_regs[reg];
+
+       fp = regs->u_regs[UREG_FP];
+
        if (regs->tstate & TSTATE_PRIV) {
                struct reg_window *win;
-               win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
+               win = (struct reg_window *)(fp + STACK_BIAS);
                return &win->locals[reg - 16];
-       } else if (test_thread_flag(TIF_32BIT)) {
+       } else if (!test_thread_64bit_stack(fp)) {
                struct reg_window32 *win32;
-               win32 = (struct reg_window32 *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
+               win32 = (struct reg_window32 *)((unsigned long)((u32)fp));
                return (unsigned long *)&win32->locals[reg - 16];
        } else {
                struct reg_window *win;
-               win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
+               win = (struct reg_window *)(fp + STACK_BIAS);
                return &win->locals[reg - 16];
        }
 }
@@ -392,13 +400,15 @@ int handle_popc(u32 insn, struct pt_regs *regs)
                if (rd)
                        regs->u_regs[rd] = ret;
        } else {
-               if (test_thread_flag(TIF_32BIT)) {
+               unsigned long fp = regs->u_regs[UREG_FP];
+
+               if (!test_thread_64bit_stack(fp)) {
                        struct reg_window32 __user *win32;
-                       win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
+                       win32 = (struct reg_window32 __user *)((unsigned long)((u32)fp));
                        put_user(ret, &win32->locals[rd - 16]);
                } else {
                        struct reg_window __user *win;
-                       win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
+                       win = (struct reg_window __user *)(fp + STACK_BIAS);
                        put_user(ret, &win->locals[rd - 16]);
                }
        }
@@ -554,7 +564,7 @@ void handle_ld_nf(u32 insn, struct pt_regs *regs)
                reg[0] = 0;
                if ((insn & 0x780000) == 0x180000)
                        reg[1] = 0;
-       } else if (test_thread_flag(TIF_32BIT)) {
+       } else if (!test_thread_64bit_stack(regs->u_regs[UREG_FP])) {
                put_user(0, (int __user *) reg);
                if ((insn & 0x780000) == 0x180000)
                        put_user(0, ((int __user *) reg) + 1);
index 08e074b7eb6a025e985700e0bf2443ef30fcb1d2..c096c624ac4d44ad6bd723b4bce88510dcdf70f5 100644 (file)
@@ -149,21 +149,24 @@ static inline void maybe_flush_windows(unsigned int rs1, unsigned int rs2,
 
 static unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs)
 {
-       unsigned long value;
+       unsigned long value, fp;
        
        if (reg < 16)
                return (!reg ? 0 : regs->u_regs[reg]);
+
+       fp = regs->u_regs[UREG_FP];
+
        if (regs->tstate & TSTATE_PRIV) {
                struct reg_window *win;
-               win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
+               win = (struct reg_window *)(fp + STACK_BIAS);
                value = win->locals[reg - 16];
-       } else if (test_thread_flag(TIF_32BIT)) {
+       } else if (!test_thread_64bit_stack(fp)) {
                struct reg_window32 __user *win32;
-               win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
+               win32 = (struct reg_window32 __user *)((unsigned long)((u32)fp));
                get_user(value, &win32->locals[reg - 16]);
        } else {
                struct reg_window __user *win;
-               win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
+               win = (struct reg_window __user *)(fp + STACK_BIAS);
                get_user(value, &win->locals[reg - 16]);
        }
        return value;
@@ -172,16 +175,18 @@ static unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs)
 static inline unsigned long __user *__fetch_reg_addr_user(unsigned int reg,
                                                          struct pt_regs *regs)
 {
+       unsigned long fp = regs->u_regs[UREG_FP];
+
        BUG_ON(reg < 16);
        BUG_ON(regs->tstate & TSTATE_PRIV);
 
-       if (test_thread_flag(TIF_32BIT)) {
+       if (!test_thread_64bit_stack(fp)) {
                struct reg_window32 __user *win32;
-               win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
+               win32 = (struct reg_window32 __user *)((unsigned long)((u32)fp));
                return (unsigned long __user *)&win32->locals[reg - 16];
        } else {
                struct reg_window __user *win;
-               win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
+               win = (struct reg_window __user *)(fp + STACK_BIAS);
                return &win->locals[reg - 16];
        }
 }
@@ -204,7 +209,7 @@ static void store_reg(struct pt_regs *regs, unsigned long val, unsigned long rd)
        } else {
                unsigned long __user *rd_user = __fetch_reg_addr_user(rd, regs);
 
-               if (test_thread_flag(TIF_32BIT))
+               if (!test_thread_64bit_stack(regs->u_regs[UREG_FP]))
                        __put_user((u32)val, (u32 __user *)rd_user);
                else
                        __put_user(val, rd_user);
index 89c2c29f154b4c45114df0dce93feee4ce8330af..0bacceb19150ebff3a9e9088b11b66d8f5d4490b 100644 (file)
@@ -132,6 +132,11 @@ SECTIONS
                *(.popc_6insn_patch)
                __popc_6insn_patch_end = .;
        }
+       .pause_3insn_patch : {
+               __pause_3insn_patch = .;
+               *(.pause_3insn_patch)
+               __pause_3insn_patch_end = .;
+       }
        PERCPU_SECTION(SMP_CACHE_BYTES)
 
        . = ALIGN(PAGE_SIZE);
index a6b0863c27df48e12bfa656a83783fee6ecfa05c..1e67ce95836972d439b50c88aa77d8395a543652 100644 (file)
@@ -43,6 +43,8 @@ spill_fixup_mna:
 spill_fixup_dax:
        TRAP_LOAD_THREAD_REG(%g6, %g1)
        ldx     [%g6 + TI_FLAGS], %g1
+       andcc   %sp, 0x1, %g0
+       movne   %icc, 0, %g1
        andcc   %g1, _TIF_32BIT, %g0
        ldub    [%g6 + TI_WSAVED], %g1
        sll     %g1, 3, %g3
index 4d502da3de78f2c9e3987a8b7f2ab0f807879201..85c233d0a34003d551587c7c378bd813f64712fe 100644 (file)
@@ -1,6 +1,6 @@
 /* atomic.S: These things are too big to do inline.
  *
- * Copyright (C) 1999, 2007 David S. Miller (davem@davemloft.net)
+ * Copyright (C) 1999, 2007 2012 David S. Miller (davem@davemloft.net)
  */
 
 #include <linux/linkage.h>
@@ -117,3 +117,17 @@ ENTRY(atomic64_sub_ret) /* %o0 = decrement, %o1 = atomic_ptr */
         sub    %g1, %o0, %o0
 2:     BACKOFF_SPIN(%o2, %o3, 1b)
 ENDPROC(atomic64_sub_ret)
+
+ENTRY(atomic64_dec_if_positive) /* %o0 = atomic_ptr */
+       BACKOFF_SETUP(%o2)
+1:     ldx     [%o0], %g1
+       brlez,pn %g1, 3f
+        sub    %g1, 1, %g7
+       casx    [%o0], %g1, %g7
+       cmp     %g1, %g7
+       bne,pn  %xcc, BACKOFF_LABEL(2f, 1b)
+        nop
+3:     retl
+        sub    %g1, 1, %o0
+2:     BACKOFF_SPIN(%o2, %o3, 1b)
+ENDPROC(atomic64_dec_if_positive)
index ee31b884c61b8390fa6a97e5d619ac4d1febe8cd..0c4e35e522fa0f5b719167cb90863e1343057968 100644 (file)
@@ -116,6 +116,7 @@ EXPORT_SYMBOL(atomic64_add);
 EXPORT_SYMBOL(atomic64_add_ret);
 EXPORT_SYMBOL(atomic64_sub);
 EXPORT_SYMBOL(atomic64_sub_ret);
+EXPORT_SYMBOL(atomic64_dec_if_positive);
 
 /* Atomic bit operations. */
 EXPORT_SYMBOL(test_and_set_bit);
index 1704068da92806d5868d0374bea669f31f21b113..034aadbff036fd617c8cae7afbcac20eee0ecaf8 100644 (file)
@@ -320,7 +320,7 @@ int do_mathemu(struct pt_regs *regs, struct fpustate *f, bool illegal_insn_trap)
                                        XR = 0;
                                else if (freg < 16)
                                        XR = regs->u_regs[freg];
-                               else if (test_thread_flag(TIF_32BIT)) {
+                               else if (!test_thread_64bit_stack(regs->u_regs[UREG_FP])) {
                                        struct reg_window32 __user *win32;
                                        flushw_user ();
                                        win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
index 59c226d120cdeccb6d8615e396f65b3ff2d4c050..c20d1ce62dc6a0a236280ab51b7ac8386fb1c32b 100644 (file)
@@ -359,18 +359,14 @@ HYPERVISOR_update_va_mapping(unsigned long va, pte_t new_val,
                return _hypercall4(int, update_va_mapping, va,
                                   new_val.pte, new_val.pte >> 32, flags);
 }
+extern int __must_check xen_event_channel_op_compat(int, void *);
 
 static inline int
 HYPERVISOR_event_channel_op(int cmd, void *arg)
 {
        int rc = _hypercall2(int, event_channel_op, cmd, arg);
-       if (unlikely(rc == -ENOSYS)) {
-               struct evtchn_op op;
-               op.cmd = cmd;
-               memcpy(&op.u, arg, sizeof(op.u));
-               rc = _hypercall1(int, event_channel_op_compat, &op);
-               memcpy(arg, &op.u, sizeof(op.u));
-       }
+       if (unlikely(rc == -ENOSYS))
+               rc = xen_event_channel_op_compat(cmd, arg);
        return rc;
 }
 
@@ -386,17 +382,14 @@ HYPERVISOR_console_io(int cmd, int count, char *str)
        return _hypercall3(int, console_io, cmd, count, str);
 }
 
+extern int __must_check HYPERVISOR_physdev_op_compat(int, void *);
+
 static inline int
 HYPERVISOR_physdev_op(int cmd, void *arg)
 {
        int rc = _hypercall2(int, physdev_op, cmd, arg);
-       if (unlikely(rc == -ENOSYS)) {
-               struct physdev_op op;
-               op.cmd = cmd;
-               memcpy(&op.u, arg, sizeof(op.u));
-               rc = _hypercall1(int, physdev_op_compat, &op);
-               memcpy(arg, &op.u, sizeof(op.u));
-       }
+       if (unlikely(rc == -ENOSYS))
+               rc = HYPERVISOR_physdev_op_compat(cmd, arg);
        return rc;
 }
 
index 66d0fff1ee8481ce0669cd5b0a137dde5d7dff8d..125f344f06a90e4d09dc4feab417042be9910e2a 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _ASM_X86_XEN_HYPERVISOR_H
 #define _ASM_X86_XEN_HYPERVISOR_H
 
-/* arch/i386/kernel/setup.c */
 extern struct shared_info *HYPERVISOR_shared_info;
 extern struct start_info *xen_start_info;
 
index 1eefebe5d72758873df0d13e4ae8c686a7d016ee..224a7e78cb6c40330dfebc943e315c0a7231efa1 100644 (file)
@@ -3779,7 +3779,7 @@ static int write_exit_mmio(struct kvm_vcpu *vcpu, gpa_t gpa,
 {
        struct kvm_mmio_fragment *frag = &vcpu->mmio_fragments[0];
 
-       memcpy(vcpu->run->mmio.data, frag->data, frag->len);
+       memcpy(vcpu->run->mmio.data, frag->data, min(8u, frag->len));
        return X86EMUL_CONTINUE;
 }
 
@@ -3832,18 +3832,11 @@ mmio:
        bytes -= handled;
        val += handled;
 
-       while (bytes) {
-               unsigned now = min(bytes, 8U);
-
-               frag = &vcpu->mmio_fragments[vcpu->mmio_nr_fragments++];
-               frag->gpa = gpa;
-               frag->data = val;
-               frag->len = now;
-
-               gpa += now;
-               val += now;
-               bytes -= now;
-       }
+       WARN_ON(vcpu->mmio_nr_fragments >= KVM_MAX_MMIO_FRAGMENTS);
+       frag = &vcpu->mmio_fragments[vcpu->mmio_nr_fragments++];
+       frag->gpa = gpa;
+       frag->data = val;
+       frag->len = bytes;
        return X86EMUL_CONTINUE;
 }
 
@@ -3890,7 +3883,7 @@ int emulator_read_write(struct x86_emulate_ctxt *ctxt, unsigned long addr,
        vcpu->mmio_needed = 1;
        vcpu->mmio_cur_fragment = 0;
 
-       vcpu->run->mmio.len = vcpu->mmio_fragments[0].len;
+       vcpu->run->mmio.len = min(8u, vcpu->mmio_fragments[0].len);
        vcpu->run->mmio.is_write = vcpu->mmio_is_write = ops->write;
        vcpu->run->exit_reason = KVM_EXIT_MMIO;
        vcpu->run->mmio.phys_addr = gpa;
@@ -5522,28 +5515,44 @@ static int complete_emulated_pio(struct kvm_vcpu *vcpu)
  *
  * read:
  *   for each fragment
- *     write gpa, len
- *     exit
- *     copy data
+ *     for each mmio piece in the fragment
+ *       write gpa, len
+ *       exit
+ *       copy data
  *   execute insn
  *
  * write:
  *   for each fragment
- *      write gpa, len
- *      copy data
- *      exit
+ *     for each mmio piece in the fragment
+ *       write gpa, len
+ *       copy data
+ *       exit
  */
 static int complete_emulated_mmio(struct kvm_vcpu *vcpu)
 {
        struct kvm_run *run = vcpu->run;
        struct kvm_mmio_fragment *frag;
+       unsigned len;
 
        BUG_ON(!vcpu->mmio_needed);
 
        /* Complete previous fragment */
-       frag = &vcpu->mmio_fragments[vcpu->mmio_cur_fragment++];
+       frag = &vcpu->mmio_fragments[vcpu->mmio_cur_fragment];
+       len = min(8u, frag->len);
        if (!vcpu->mmio_is_write)
-               memcpy(frag->data, run->mmio.data, frag->len);
+               memcpy(frag->data, run->mmio.data, len);
+
+       if (frag->len <= 8) {
+               /* Switch to the next fragment. */
+               frag++;
+               vcpu->mmio_cur_fragment++;
+       } else {
+               /* Go forward to the next mmio piece. */
+               frag->data += len;
+               frag->gpa += len;
+               frag->len -= len;
+       }
+
        if (vcpu->mmio_cur_fragment == vcpu->mmio_nr_fragments) {
                vcpu->mmio_needed = 0;
                if (vcpu->mmio_is_write)
@@ -5551,13 +5560,12 @@ static int complete_emulated_mmio(struct kvm_vcpu *vcpu)
                vcpu->mmio_read_completed = 1;
                return complete_emulated_io(vcpu);
        }
-       /* Initiate next fragment */
-       ++frag;
+
        run->exit_reason = KVM_EXIT_MMIO;
        run->mmio.phys_addr = frag->gpa;
        if (vcpu->mmio_is_write)
-               memcpy(run->mmio.data, frag->data, frag->len);
-       run->mmio.len = frag->len;
+               memcpy(run->mmio.data, frag->data, min(8u, frag->len));
+       run->mmio.len = min(8u, frag->len);
        run->mmio.is_write = vcpu->mmio_is_write;
        vcpu->arch.complete_userspace_io = complete_emulated_mmio;
        return 0;
index 6226c99729b963594a2e133290cbf8f3c6e681b8..dcf5f2dd91ec4fd91d814d46c7d6dbd6c5312a61 100644 (file)
@@ -1288,6 +1288,25 @@ unsigned long xen_read_cr2_direct(void)
        return this_cpu_read(xen_vcpu_info.arch.cr2);
 }
 
+void xen_flush_tlb_all(void)
+{
+       struct mmuext_op *op;
+       struct multicall_space mcs;
+
+       trace_xen_mmu_flush_tlb_all(0);
+
+       preempt_disable();
+
+       mcs = xen_mc_entry(sizeof(*op));
+
+       op = mcs.args;
+       op->cmd = MMUEXT_TLB_FLUSH_ALL;
+       MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
+
+       xen_mc_issue(PARAVIRT_LAZY_MMU);
+
+       preempt_enable();
+}
 static void xen_flush_tlb(void)
 {
        struct mmuext_op *op;
@@ -2518,7 +2537,7 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
        err = 0;
 out:
 
-       flush_tlb_all();
+       xen_flush_tlb_all();
 
        return err;
 }
index cdcb48adee4c6d05f65f34fb9893a55afdb4c5f1..0d1f36a22c98827ba204af46859b349ac3da91ae 100644 (file)
@@ -13,6 +13,8 @@ config XTENSA
        select GENERIC_CPU_DEVICES
        select MODULES_USE_ELF_RELA
        select GENERIC_PCI_IOMAP
+       select GENERIC_KERNEL_THREAD
+       select GENERIC_KERNEL_EXECVE
        select ARCH_WANT_OPTIONAL_GPIOLIB
        help
          Xtensa processors are 32-bit RISC machines designed by Tensilica
index e6be5b9091c2a65509f721ed3e5f92bc7c6783bc..700c2e6f2d259d454f5f8f310b431d6b20ecbc1f 100644 (file)
@@ -62,6 +62,10 @@ static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
 static inline void iounmap(volatile void __iomem *addr)
 {
 }
+
+#define virt_to_bus     virt_to_phys
+#define bus_to_virt     phys_to_virt
+
 #endif /* CONFIG_MMU */
 
 /*
index 5c371d8d45284a1c35808d2b9e4928db03cc7652..2d630e7399ca4f94584a77cdf2a150d6c9ff7319 100644 (file)
@@ -152,6 +152,7 @@ struct thread_struct {
 
 /* Clearing a0 terminates the backtrace. */
 #define start_thread(regs, new_pc, new_sp) \
+       memset(regs, 0, sizeof(*regs)); \
        regs->pc = new_pc; \
        regs->ps = USER_PS_VALUE; \
        regs->areg[1] = new_sp; \
@@ -168,9 +169,6 @@ struct mm_struct;
 /* Free all resources held by a thread. */
 #define release_thread(thread) do { } while(0)
 
-/* Create a kernel thread without removing it from tasklists */
-extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
-
 /* Copy and release all segment info associated with a VM */
 #define copy_segments(p, mm)   do { } while(0)
 #define release_segments(mm)   do { } while(0)
index c1dacca312f3906374614ae4eb0a486ab8070e8a..124aeee0d3816cadf7abe7317d168b5f3b326891 100644 (file)
@@ -10,7 +10,7 @@
 
 struct pt_regs;
 struct sigaction;
-asmlinkage long xtensa_execve(char*, char**, char**, struct pt_regs*);
+asmlinkage long sys_execve(char*, char**, char**, struct pt_regs*);
 asmlinkage long xtensa_clone(unsigned long, unsigned long, struct pt_regs*);
 asmlinkage long xtensa_ptrace(long, long, long, long);
 asmlinkage long xtensa_sigreturn(struct pt_regs*);
index 9ef1c31d2c8363fdae934f157abce35d1ef21e89..f4e6eaa40d1ca86946799a1f7eab6d7047a69dd5 100644 (file)
@@ -1,16 +1,9 @@
-/*
- * include/asm-xtensa/unistd.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.
- */
+#ifndef _XTENSA_UNISTD_H
+#define _XTENSA_UNISTD_H
 
+#define __ARCH_WANT_SYS_EXECVE
 #include <uapi/asm/unistd.h>
 
-
 /*
  * "Conditional" syscalls
  *
@@ -37,3 +30,5 @@
 #define __IGNORE_mmap                          /* use mmap2 */
 #define __IGNORE_vfork                         /* use clone */
 #define __IGNORE_fadvise64                     /* use fadvise64_64 */
+
+#endif /* _XTENSA_UNISTD_H */
index 479abaea5aae761a41b60ef5e1861bba3aa2e605..9f36d0e3e0aca7d8fc87257be6d48cbdea16f810 100644 (file)
@@ -1,14 +1,4 @@
-/*
- * include/asm-xtensa/unistd.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 - 2012 Tensilica Inc.
- */
-
-#ifndef _UAPI_XTENSA_UNISTD_H
+#if !defined(_UAPI_XTENSA_UNISTD_H) || defined(__SYSCALL)
 #define _UAPI_XTENSA_UNISTD_H
 
 #ifndef __SYSCALL
@@ -272,7 +262,7 @@ __SYSCALL(115, sys_sendmmsg, 4)
 #define __NR_clone                             116
 __SYSCALL(116, xtensa_clone, 5)
 #define __NR_execve                            117
-__SYSCALL(117, xtensa_execve, 3)
+__SYSCALL(117, sys_execve, 3)
 #define __NR_exit                              118
 __SYSCALL(118, sys_exit, 1)
 #define __NR_exit_group                        119
@@ -759,4 +749,6 @@ __SYSCALL(331, sys_kcmp, 5)
 
 #define SYS_XTENSA_COUNT                  5     /* count */
 
+#undef __SYSCALL
+
 #endif /* _UAPI_XTENSA_UNISTD_H */
index 18453067c2582034e896adee07c0d474912a98d2..90bfc1dbc13dcf46992e4fb09bb7eab3cfe1bea3 100644 (file)
@@ -1832,50 +1832,6 @@ ENTRY(system_call)
        retw
 
 
-/*
- * Create a kernel thread
- *
- * int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
- * a2                    a2                 a3             a4
- */
-
-ENTRY(kernel_thread)
-       entry   a1, 16
-
-       mov     a5, a2                  # preserve fn over syscall
-       mov     a7, a3                  # preserve args over syscall
-
-       movi    a3, _CLONE_VM | _CLONE_UNTRACED
-       movi    a2, __NR_clone
-       or      a6, a4, a3              # arg0: flags
-       mov     a3, a1                  # arg1: sp
-       syscall
-
-       beq     a3, a1, 1f              # branch if parent
-       mov     a6, a7                  # args
-       callx4  a5                      # fn(args)
-
-       movi    a2, __NR_exit
-       syscall                         # return value of fn(args) still in a6
-
-1:     retw
-
-/*
- * Do a system call from kernel instead of calling sys_execve, so we end up
- * with proper pt_regs.
- *
- * int kernel_execve(const char *fname, char *const argv[], charg *const envp[])
- * a2                        a2               a3                  a4
- */
-
-ENTRY(kernel_execve)
-       entry   a1, 16
-       mov     a6, a2                  # arg0 is in a6
-       movi    a2, __NR_execve
-       syscall
-
-       retw
-
 /*
  * Task switch.
  *
@@ -1958,3 +1914,16 @@ ENTRY(ret_from_fork)
 
        j       common_exception_return
 
+/*
+ * Kernel thread creation helper
+ * On entry, set up by copy_thread: a2 = thread_fn, a3 = thread_fn arg
+ *           left from _switch_to: a6 = prev
+ */
+ENTRY(ret_from_kernel_thread)
+
+       call4   schedule_tail
+       mov     a6, a3
+       callx4  a2
+       j       common_exception_return
+
+ENDPROC(ret_from_kernel_thread)
index 1908f6642d31e0073c5884b0f90445641452cb75..09ae7bfab9a7a4a8ff2a6e2c55aadf07dda48024 100644 (file)
@@ -45,6 +45,7 @@
 #include <asm/regs.h>
 
 extern void ret_from_fork(void);
+extern void ret_from_kernel_thread(void);
 
 struct task_struct *current_set[NR_CPUS] = {&init_task, };
 
@@ -158,18 +159,30 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 /*
  * Copy thread.
  *
+ * There are two modes in which this function is called:
+ * 1) Userspace thread creation,
+ *    regs != NULL, usp_thread_fn is userspace stack pointer.
+ *    It is expected to copy parent regs (in case CLONE_VM is not set
+ *    in the clone_flags) and set up passed usp in the childregs.
+ * 2) Kernel thread creation,
+ *    regs == NULL, usp_thread_fn is the function to run in the new thread
+ *    and thread_fn_arg is its parameter.
+ *    childregs are not used for the kernel threads.
+ *
  * The stack layout for the new thread looks like this:
  *
- *     +------------------------+ <- sp in childregs (= tos)
+ *     +------------------------+
  *     |       childregs        |
  *     +------------------------+ <- thread.sp = sp in dummy-frame
  *     |      dummy-frame       |    (saved in dummy-frame spill-area)
  *     +------------------------+
  *
- * We create a dummy frame to return to ret_from_fork:
- *   a0 points to ret_from_fork (simulating a call4)
+ * We create a dummy frame to return to either ret_from_fork or
+ *   ret_from_kernel_thread:
+ *   a0 points to ret_from_fork/ret_from_kernel_thread (simulating a call4)
  *   sp points to itself (thread.sp)
- *   a2, a3 are unused.
+ *   a2, a3 are unused for userspace threads,
+ *   a2 points to thread_fn, a3 holds thread_fn arg for kernel threads.
  *
  * Note: This is a pristine frame, so we don't need any spill region on top of
  *       childregs.
@@ -185,43 +198,63 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
  * involved.  Much simpler to just not copy those live frames across.
  */
 
-int copy_thread(unsigned long clone_flags, unsigned long usp,
-               unsigned long unused,
-                struct task_struct * p, struct pt_regs * regs)
+int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn,
+               unsigned long thread_fn_arg,
+               struct task_struct *p, struct pt_regs *unused)
 {
-       struct pt_regs *childregs;
-       unsigned long tos;
-       int user_mode = user_mode(regs);
+       struct pt_regs *childregs = task_pt_regs(p);
 
 #if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS)
        struct thread_info *ti;
 #endif
 
-       /* Set up new TSS. */
-       tos = (unsigned long)task_stack_page(p) + THREAD_SIZE;
-       if (user_mode)
-               childregs = (struct pt_regs*)(tos - PT_USER_SIZE);
-       else
-               childregs = (struct pt_regs*)tos - 1;
-
-       /* This does not copy all the regs.  In a bout of brilliance or madness,
-          ARs beyond a0-a15 exist past the end of the struct. */
-       *childregs = *regs;
-
        /* Create a call4 dummy-frame: a0 = 0, a1 = childregs. */
        *((int*)childregs - 3) = (unsigned long)childregs;
        *((int*)childregs - 4) = 0;
 
-       childregs->areg[2] = 0;
-       p->set_child_tid = p->clear_child_tid = NULL;
-       p->thread.ra = MAKE_RA_FOR_CALL((unsigned long)ret_from_fork, 0x1);
        p->thread.sp = (unsigned long)childregs;
 
-       if (user_mode(regs)) {
+       if (!(p->flags & PF_KTHREAD)) {
+               struct pt_regs *regs = current_pt_regs();
+               unsigned long usp = usp_thread_fn ?
+                       usp_thread_fn : regs->areg[1];
 
+               p->thread.ra = MAKE_RA_FOR_CALL(
+                               (unsigned long)ret_from_fork, 0x1);
+
+               /* This does not copy all the regs.
+                * In a bout of brilliance or madness,
+                * ARs beyond a0-a15 exist past the end of the struct.
+                */
+               *childregs = *regs;
                childregs->areg[1] = usp;
+               childregs->areg[2] = 0;
+
+               /* When sharing memory with the parent thread, the child
+                  usually starts on a pristine stack, so we have to reset
+                  windowbase, windowstart and wmask.
+                  (Note that such a new thread is required to always create
+                  an initial call4 frame)
+                  The exception is vfork, where the new thread continues to
+                  run on the parent's stack until it calls execve. This could
+                  be a call8 or call12, which requires a legal stack frame
+                  of the previous caller for the overflow handlers to work.
+                  (Note that it's always legal to overflow live registers).
+                  In this case, ensure to spill at least the stack pointer
+                  of that frame. */
+
                if (clone_flags & CLONE_VM) {
-                       childregs->wmask = 1;   /* can't share live windows */
+                       /* check that caller window is live and same stack */
+                       int len = childregs->wmask & ~0xf;
+                       if (regs->areg[1] == usp && len != 0) {
+                               int callinc = (regs->areg[0] >> 30) & 3;
+                               int caller_ars = XCHAL_NUM_AREGS - callinc * 4;
+                               put_user(regs->areg[caller_ars+1],
+                                        (unsigned __user*)(usp - 12));
+                       }
+                       childregs->wmask = 1;
+                       childregs->windowstart = 1;
+                       childregs->windowbase = 0;
                } else {
                        int len = childregs->wmask & ~0xf;
                        memcpy(&childregs->areg[XCHAL_NUM_AREGS - len/4],
@@ -230,11 +263,19 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
 // FIXME: we need to set THREADPTR in thread_info...
                if (clone_flags & CLONE_SETTLS)
                        childregs->areg[2] = childregs->areg[6];
-
        } else {
-               /* In kernel space, we start a new thread with a new stack. */
-               childregs->wmask = 1;
-               childregs->areg[1] = tos;
+               p->thread.ra = MAKE_RA_FOR_CALL(
+                               (unsigned long)ret_from_kernel_thread, 1);
+
+               /* pass parameters to ret_from_kernel_thread:
+                * a2 = thread_fn, a3 = thread_fn arg
+                */
+               *((int *)childregs - 1) = thread_fn_arg;
+               *((int *)childregs - 2) = usp_thread_fn;
+
+               /* Childregs are only used when we're going to userspace
+                * in which case start_thread will set them up.
+                */
        }
 
 #if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS)
@@ -330,32 +371,5 @@ long xtensa_clone(unsigned long clone_flags, unsigned long newsp,
                   void __user *child_tid, long a5,
                   struct pt_regs *regs)
 {
-        if (!newsp)
-                newsp = regs->areg[1];
         return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);
 }
-
-/*
- * xtensa_execve() executes a new program.
- */
-
-asmlinkage
-long xtensa_execve(const char __user *name,
-                  const char __user *const __user *argv,
-                   const char __user *const __user *envp,
-                   long a3, long a4, long a5,
-                   struct pt_regs *regs)
-{
-       long error;
-       struct filename *filename;
-
-       filename = getname(name);
-       error = PTR_ERR(filename);
-       if (IS_ERR(filename))
-               goto out;
-       error = do_execve(filename->name, argv, envp, regs);
-       putname(filename);
-out:
-       return error;
-}
-
index a5c01e74d5d5590f3c5287dace8f23c10c527cd9..5702065f472a88bebc4df721dec0629208957395 100644 (file)
@@ -32,10 +32,8 @@ typedef void (*syscall_t)(void);
 syscall_t sys_call_table[__NR_syscall_count] /* FIXME __cacheline_aligned */= {
        [0 ... __NR_syscall_count - 1] = (syscall_t)&sys_ni_syscall,
 
-#undef __SYSCALL
 #define __SYSCALL(nr,symbol,nargs) [ nr ] = (syscall_t)symbol,
-#undef  __KERNEL_SYSCALLS__
-#include <asm/unistd.h>
+#include <uapi/asm/unistd.h>
 };
 
 asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg)
@@ -49,7 +47,8 @@ asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg)
        return (long)ret;
 }
 
-asmlinkage long xtensa_fadvise64_64(int fd, int advice, unsigned long long offset, unsigned long long len)
+asmlinkage long xtensa_fadvise64_64(int fd, int advice,
+               unsigned long long offset, unsigned long long len)
 {
        return sys_fadvise64_64(fd, offset, len, advice);
 }
index a8b9f1fd1e17f63573c74bdf8c06616c1abd7481..afe058b24e6e07c83d61f1a524b30e03340d6369 100644 (file)
@@ -43,7 +43,6 @@ EXPORT_SYMBOL(__strncpy_user);
 EXPORT_SYMBOL(clear_page);
 EXPORT_SYMBOL(copy_page);
 
-EXPORT_SYMBOL(kernel_thread);
 EXPORT_SYMBOL(empty_zero_page);
 
 /*
index 09acf1b39905ced3f08164c213a6d2aed7f29cae..a7e40a7c821427cd27f6c7019411030ea00e33e8 100644 (file)
@@ -89,7 +89,7 @@ config BLK_DEV_INTEGRITY
 
 config BLK_DEV_THROTTLING
        bool "Block layer bio throttling support"
-       depends on BLK_CGROUP=y && EXPERIMENTAL
+       depends on BLK_CGROUP=y
        default n
        ---help---
        Block layer bio throttling support. It can be used to limit
index cafcd743118969daec377f52f09e41594d188347..d0b770391ad400ad0312049c84a2b522bf985bf1 100644 (file)
@@ -285,6 +285,13 @@ static void blkg_destroy_all(struct request_queue *q)
                blkg_destroy(blkg);
                spin_unlock(&blkcg->lock);
        }
+
+       /*
+        * root blkg is destroyed.  Just clear the pointer since
+        * root_rl does not take reference on root blkg.
+        */
+       q->root_blkg = NULL;
+       q->root_rl.blkg = NULL;
 }
 
 static void blkg_rcu_free(struct rcu_head *rcu_head)
@@ -326,6 +333,9 @@ struct request_list *__blk_queue_next_rl(struct request_list *rl,
         */
        if (rl == &q->root_rl) {
                ent = &q->blkg_list;
+               /* There are no more block groups, hence no request lists */
+               if (list_empty(ent))
+                       return NULL;
        } else {
                blkg = container_of(rl, struct blkcg_gq, rl);
                ent = &blkg->q_node;
index a33870b1847bb70c6ef1937f7bef4e93bdf9c980..3c95c4d6e31afe057ebabeda36868682e8188329 100644 (file)
@@ -2868,7 +2868,8 @@ static int plug_rq_cmp(void *priv, struct list_head *a, struct list_head *b)
        struct request *rqa = container_of(a, struct request, queuelist);
        struct request *rqb = container_of(b, struct request, queuelist);
 
-       return !(rqa->q <= rqb->q);
+       return !(rqa->q < rqb->q ||
+               (rqa->q == rqb->q && blk_rq_pos(rqa) < blk_rq_pos(rqb)));
 }
 
 /*
index 671d4d6d14df106b3b0278364340ef3290d7a185..7bdd61b867c899901ed846ed5a229bc6ab31653b 100644 (file)
@@ -137,13 +137,18 @@ static void cryptd_queue_worker(struct work_struct *work)
        struct crypto_async_request *req, *backlog;
 
        cpu_queue = container_of(work, struct cryptd_cpu_queue, work);
-       /* Only handle one request at a time to avoid hogging crypto
-        * workqueue. preempt_disable/enable is used to prevent
-        * being preempted by cryptd_enqueue_request() */
+       /*
+        * Only handle one request at a time to avoid hogging crypto workqueue.
+        * preempt_disable/enable is used to prevent being preempted by
+        * cryptd_enqueue_request(). local_bh_disable/enable is used to prevent
+        * cryptd_enqueue_request() being accessed from software interrupts.
+        */
+       local_bh_disable();
        preempt_disable();
        backlog = crypto_get_backlog(&cpu_queue->queue);
        req = crypto_dequeue_request(&cpu_queue->queue);
        preempt_enable();
+       local_bh_enable();
 
        if (!req)
                return;
index f94d4c818fc74dc9a076e8f67fe98d7bc6620a61..0230cb6cbb3a18eda2fd323763d6594205c0ed7f 100644 (file)
@@ -1345,12 +1345,15 @@ static int
 acpi_video_bus_get_devices(struct acpi_video_bus *video,
                           struct acpi_device *device)
 {
-       int status;
+       int status = 0;
        struct acpi_device *dev;
 
-       status = acpi_video_device_enumerate(video);
-       if (status)
-               return status;
+       /*
+        * There are systems where video module known to work fine regardless
+        * of broken _DOD and ignoring returned value here doesn't cause
+        * any issues later.
+        */
+       acpi_video_device_enumerate(video);
 
        list_for_each_entry(dev, &device->children, node) {
 
index 8727e9c5eea47dd78170e091635f31d29fc7cb52..72c776f2a1f528db39398a0983ae86730ebf24c1 100644 (file)
@@ -83,9 +83,16 @@ EXPORT_SYMBOL_GPL(platform_get_resource);
  */
 int platform_get_irq(struct platform_device *dev, unsigned int num)
 {
+#ifdef CONFIG_SPARC
+       /* sparc does not have irqs represented as IORESOURCE_IRQ resources */
+       if (!dev || num >= dev->archdata.num_irqs)
+               return -ENXIO;
+       return dev->archdata.irqs[num];
+#else
        struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);
 
        return r ? r->start : -ENXIO;
+#endif
 }
 EXPORT_SYMBOL_GPL(platform_get_irq);
 
index f529407db93ff74dbfa8b9dad13324815467fad2..824e09c4d0d7d1bcd83a00b87e37e1ca0115d5fb 100644 (file)
@@ -131,6 +131,7 @@ config BLK_CPQ_DA
 config BLK_CPQ_CISS_DA
        tristate "Compaq Smart Array 5xxx support"
        depends on PCI
+       select CHECK_SIGNATURE
        help
          This is the driver for Compaq Smart Array 5xxx controllers.
          Everyone using these boards should say Y here.
@@ -166,8 +167,8 @@ config BLK_DEV_DAC960
          module will be called DAC960.
 
 config BLK_DEV_UMEM
-       tristate "Micro Memory MM5415 Battery Backed RAM support (EXPERIMENTAL)"
-       depends on PCI && EXPERIMENTAL
+       tristate "Micro Memory MM5415 Battery Backed RAM support"
+       depends on PCI
        ---help---
          Saying Y here will include support for the MM5415 family of
          battery backed (Non-volatile) RAM cards.
@@ -430,8 +431,8 @@ config CDROM_PKTCDVD_BUFFERS
          a disc is opened for writing.
 
 config CDROM_PKTCDVD_WCACHE
-       bool "Enable write caching (EXPERIMENTAL)"
-       depends on CDROM_PKTCDVD && EXPERIMENTAL
+       bool "Enable write caching"
+       depends on CDROM_PKTCDVD
        help
          If enabled, write caching will be set for the CD-R/W device. For now
          this option is dangerous unless the CD-RW media is known good, as we
@@ -508,8 +509,8 @@ config XEN_BLKDEV_BACKEND
 
 
 config VIRTIO_BLK
-       tristate "Virtio block driver (EXPERIMENTAL)"
-       depends on EXPERIMENTAL && VIRTIO
+       tristate "Virtio block driver"
+       depends on VIRTIO
        ---help---
          This is the virtual block driver for virtio.  It can be used with
           lguest or QEMU based VMMs (like KVM or Xen).  Say Y or M.
@@ -528,7 +529,7 @@ config BLK_DEV_HD
 
 config BLK_DEV_RBD
        tristate "Rados block device (RBD)"
-       depends on INET && EXPERIMENTAL && BLOCK
+       depends on INET && BLOCK
        select CEPH_LIB
        select LIBCRC32C
        select CRYPTO_AES
index b0f553b26d0f8d00f86f768f93aad27ebcb0529e..ca83f96756ad86b2a339971050b7378f9a9752d9 100644 (file)
@@ -5205,7 +5205,6 @@ static void cciss_shutdown(struct pci_dev *pdev)
                return;
        }
        /* write all data in the battery backed cache to disk */
-       memset(flush_buf, 0, 4);
        return_code = sendcmd_withirq(h, CCISS_CACHE_FLUSH, flush_buf,
                4, 0, CTLR_LUNID, TYPE_CMD);
        kfree(flush_buf);
index 17c675c522954cc39a210e431603aac2a3a2d946..1c49d7173966ae52754cd75776ff50fa48f30d60 100644 (file)
@@ -4109,12 +4109,19 @@ static struct platform_driver floppy_driver = {
 
 static struct platform_device floppy_device[N_DRIVE];
 
+static bool floppy_available(int drive)
+{
+       if (!(allowed_drive_mask & (1 << drive)))
+               return false;
+       if (fdc_state[FDC(drive)].version == FDC_NONE)
+               return false;
+       return true;
+}
+
 static struct kobject *floppy_find(dev_t dev, int *part, void *data)
 {
        int drive = (*part & 3) | ((*part & 0x80) >> 5);
-       if (drive >= N_DRIVE ||
-           !(allowed_drive_mask & (1 << drive)) ||
-           fdc_state[FDC(drive)].version == FDC_NONE)
+       if (drive >= N_DRIVE || !floppy_available(drive))
                return NULL;
        if (((*part >> 2) & 0x1f) >= ARRAY_SIZE(floppy_type))
                return NULL;
@@ -4124,8 +4131,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
 
 static int __init do_floppy_init(void)
 {
-       int i, unit, drive;
-       int err, dr;
+       int i, unit, drive, err;
 
        set_debugt();
        interruptjiffies = resultjiffies = jiffies;
@@ -4137,34 +4143,32 @@ static int __init do_floppy_init(void)
 
        raw_cmd = NULL;
 
-       for (dr = 0; dr < N_DRIVE; dr++) {
-               disks[dr] = alloc_disk(1);
-               if (!disks[dr]) {
-                       err = -ENOMEM;
-                       goto out_put_disk;
-               }
+       floppy_wq = alloc_ordered_workqueue("floppy", 0);
+       if (!floppy_wq)
+               return -ENOMEM;
 
-               floppy_wq = alloc_ordered_workqueue("floppy", 0);
-               if (!floppy_wq) {
+       for (drive = 0; drive < N_DRIVE; drive++) {
+               disks[drive] = alloc_disk(1);
+               if (!disks[drive]) {
                        err = -ENOMEM;
                        goto out_put_disk;
                }
 
-               disks[dr]->queue = blk_init_queue(do_fd_request, &floppy_lock);
-               if (!disks[dr]->queue) {
+               disks[drive]->queue = blk_init_queue(do_fd_request, &floppy_lock);
+               if (!disks[drive]->queue) {
                        err = -ENOMEM;
-                       goto out_destroy_workq;
+                       goto out_put_disk;
                }
 
-               blk_queue_max_hw_sectors(disks[dr]->queue, 64);
-               disks[dr]->major = FLOPPY_MAJOR;
-               disks[dr]->first_minor = TOMINOR(dr);
-               disks[dr]->fops = &floppy_fops;
-               sprintf(disks[dr]->disk_name, "fd%d", dr);
+               blk_queue_max_hw_sectors(disks[drive]->queue, 64);
+               disks[drive]->major = FLOPPY_MAJOR;
+               disks[drive]->first_minor = TOMINOR(drive);
+               disks[drive]->fops = &floppy_fops;
+               sprintf(disks[drive]->disk_name, "fd%d", drive);
 
-               init_timer(&motor_off_timer[dr]);
-               motor_off_timer[dr].data = dr;
-               motor_off_timer[dr].function = motor_off_callback;
+               init_timer(&motor_off_timer[drive]);
+               motor_off_timer[drive].data = drive;
+               motor_off_timer[drive].function = motor_off_callback;
        }
 
        err = register_blkdev(FLOPPY_MAJOR, "fd");
@@ -4282,9 +4286,7 @@ static int __init do_floppy_init(void)
        }
 
        for (drive = 0; drive < N_DRIVE; drive++) {
-               if (!(allowed_drive_mask & (1 << drive)))
-                       continue;
-               if (fdc_state[FDC(drive)].version == FDC_NONE)
+               if (!floppy_available(drive))
                        continue;
 
                floppy_device[drive].name = floppy_device_name;
@@ -4293,7 +4295,7 @@ static int __init do_floppy_init(void)
 
                err = platform_device_register(&floppy_device[drive]);
                if (err)
-                       goto out_release_dma;
+                       goto out_remove_drives;
 
                err = device_create_file(&floppy_device[drive].dev,
                                         &dev_attr_cmos);
@@ -4311,29 +4313,34 @@ static int __init do_floppy_init(void)
 
 out_unreg_platform_dev:
        platform_device_unregister(&floppy_device[drive]);
+out_remove_drives:
+       while (drive--) {
+               if (floppy_available(drive)) {
+                       del_gendisk(disks[drive]);
+                       device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos);
+                       platform_device_unregister(&floppy_device[drive]);
+               }
+       }
 out_release_dma:
        if (atomic_read(&usage_count))
                floppy_release_irq_and_dma();
 out_unreg_region:
        blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);
        platform_driver_unregister(&floppy_driver);
-out_destroy_workq:
-       destroy_workqueue(floppy_wq);
 out_unreg_blkdev:
        unregister_blkdev(FLOPPY_MAJOR, "fd");
 out_put_disk:
-       while (dr--) {
-               del_timer_sync(&motor_off_timer[dr]);
-               if (disks[dr]->queue) {
-                       blk_cleanup_queue(disks[dr]->queue);
-                       /*
-                        * put_disk() is not paired with add_disk() and
-                        * will put queue reference one extra time. fix it.
-                        */
-                       disks[dr]->queue = NULL;
+       for (drive = 0; drive < N_DRIVE; drive++) {
+               if (!disks[drive])
+                       break;
+               if (disks[drive]->queue) {
+                       del_timer_sync(&motor_off_timer[drive]);
+                       blk_cleanup_queue(disks[drive]->queue);
+                       disks[drive]->queue = NULL;
                }
-               put_disk(disks[dr]);
+               put_disk(disks[drive]);
        }
+       destroy_workqueue(floppy_wq);
        return err;
 }
 
@@ -4551,8 +4558,7 @@ static void __exit floppy_module_exit(void)
        for (drive = 0; drive < N_DRIVE; drive++) {
                del_timer_sync(&motor_off_timer[drive]);
 
-               if ((allowed_drive_mask & (1 << drive)) &&
-                   fdc_state[FDC(drive)].version != FDC_NONE) {
+               if (floppy_available(drive)) {
                        del_gendisk(disks[drive]);
                        device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos);
                        platform_device_unregister(&floppy_device[drive]);
index e9d594fd12cbee408251c4ead03d1b71183ff7ae..54046e51160aef28e3ee733797fa453a0403a02a 100644 (file)
@@ -976,8 +976,21 @@ static int loop_clr_fd(struct loop_device *lo)
        if (lo->lo_state != Lo_bound)
                return -ENXIO;
 
-       if (lo->lo_refcnt > 1)  /* we needed one fd for the ioctl */
-               return -EBUSY;
+       /*
+        * If we've explicitly asked to tear down the loop device,
+        * and it has an elevated reference count, set it for auto-teardown when
+        * the last reference goes away. This stops $!~#$@ udev from
+        * preventing teardown because it decided that it needs to run blkid on
+        * the loopback device whenever they appear. xfstests is notorious for
+        * failing tests because blkid via udev races with a losetup
+        * <dev>/do something like mkfs/losetup -d <dev> causing the losetup -d
+        * command to fail with EBUSY.
+        */
+       if (lo->lo_refcnt > 1) {
+               lo->lo_flags |= LO_FLAGS_AUTOCLEAR;
+               mutex_unlock(&lo->lo_ctl_mutex);
+               return 0;
+       }
 
        if (filp == NULL)
                return -EINVAL;
index f946d31d6917e00aa0637df5d21cef35ebf82845..adc6f36564cf3c9f214ca37c9b3cf8faffbe6cf8 100644 (file)
@@ -2035,8 +2035,9 @@ static unsigned int implicit_sector(unsigned char command,
        }
        return rv;
 }
-
-static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout)
+static void mtip_set_timeout(struct driver_data *dd,
+                                       struct host_to_dev_fis *fis,
+                                       unsigned int *timeout, u8 erasemode)
 {
        switch (fis->command) {
        case ATA_CMD_DOWNLOAD_MICRO:
@@ -2044,7 +2045,10 @@ static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout)
                break;
        case ATA_CMD_SEC_ERASE_UNIT:
        case 0xFC:
-               *timeout = 240000; /* 4 minutes */
+               if (erasemode)
+                       *timeout = ((*(dd->port->identify + 90) * 2) * 60000);
+               else
+                       *timeout = ((*(dd->port->identify + 89) * 2) * 60000);
                break;
        case ATA_CMD_STANDBYNOW1:
                *timeout = 120000;  /* 2 minutes */
@@ -2087,6 +2091,7 @@ static int exec_drive_taskfile(struct driver_data *dd,
        unsigned int transfer_size;
        unsigned long task_file_data;
        int intotal = outtotal + req_task->out_size;
+       int erasemode = 0;
 
        taskout = req_task->out_size;
        taskin = req_task->in_size;
@@ -2212,7 +2217,13 @@ static int exec_drive_taskfile(struct driver_data *dd,
                fis.lba_hi,
                fis.device);
 
-       mtip_set_timeout(&fis, &timeout);
+       /* check for erase mode support during secure erase.*/
+       if ((fis.command == ATA_CMD_SEC_ERASE_UNIT)
+                                       && (outbuf[0] & MTIP_SEC_ERASE_MODE)) {
+               erasemode = 1;
+       }
+
+       mtip_set_timeout(dd, &fis, &timeout, erasemode);
 
        /* Determine the correct transfer size.*/
        if (force_single_sector)
index 18627a1d04c59eff34f7cdd2313555b10a75b283..5f4a917bd8bbcfe88283b3509e365a0faefbb3b5 100644 (file)
@@ -33,6 +33,9 @@
 /* offset of Device Control register in PCIe extended capabilites space */
 #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET  0x48
 
+/* check for erase mode support during secure erase */
+#define MTIP_SEC_ERASE_MODE     0x3
+
 /* # of times to retry timed out/failed IOs */
 #define MTIP_MAX_RETRIES       2
 
index 9ad3b5ec1dc1c521085db47a7928cc8cf1179701..9a54623e52d74ecc77953937bd923a9ecdb68d09 100644 (file)
@@ -158,8 +158,8 @@ struct xen_vbd {
        struct block_device     *bdev;
        /* Cached size parameter. */
        sector_t                size;
-       bool                    flush_support;
-       bool                    discard_secure;
+       unsigned int            flush_support:1;
+       unsigned int            discard_secure:1;
 };
 
 struct backend_info;
index 4f66171c668354b490f1284aec48278b8676bd84..f58434c2617cab4185b8c049804f1031f4226a6e 100644 (file)
@@ -105,11 +105,10 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid)
 {
        struct xen_blkif *blkif;
 
-       blkif = kmem_cache_alloc(xen_blkif_cachep, GFP_KERNEL);
+       blkif = kmem_cache_zalloc(xen_blkif_cachep, GFP_KERNEL);
        if (!blkif)
                return ERR_PTR(-ENOMEM);
 
-       memset(blkif, 0, sizeof(*blkif));
        blkif->domid = domid;
        spin_lock_init(&blkif->blk_ring_lock);
        atomic_set(&blkif->refcnt, 1);
@@ -196,7 +195,7 @@ static void xen_blkif_disconnect(struct xen_blkif *blkif)
        }
 }
 
-void xen_blkif_free(struct xen_blkif *blkif)
+static void xen_blkif_free(struct xen_blkif *blkif)
 {
        if (!atomic_dec_and_test(&blkif->refcnt))
                BUG();
@@ -257,7 +256,7 @@ static struct attribute_group xen_vbdstat_group = {
 VBD_SHOW(physical_device, "%x:%x\n", be->major, be->minor);
 VBD_SHOW(mode, "%s\n", be->mode);
 
-int xenvbd_sysfs_addif(struct xenbus_device *dev)
+static int xenvbd_sysfs_addif(struct xenbus_device *dev)
 {
        int error;
 
@@ -281,7 +280,7 @@ fail1:      device_remove_file(&dev->dev, &dev_attr_physical_device);
        return error;
 }
 
-void xenvbd_sysfs_delif(struct xenbus_device *dev)
+static void xenvbd_sysfs_delif(struct xenbus_device *dev)
 {
        sysfs_remove_group(&dev->dev.kobj, &xen_vbdstat_group);
        device_remove_file(&dev->dev, &dev_attr_mode);
index c8abce3d2d9c0618f2092c94398e3197d0396b27..ed0fade46aed279097f105d3b9c6208eb2b0fe46 100644 (file)
@@ -270,15 +270,10 @@ static int hci_uart_send_frame(struct sk_buff *skb)
  */
 static int hci_uart_tty_open(struct tty_struct *tty)
 {
-       struct hci_uart *hu = (void *) tty->disc_data;
+       struct hci_uart *hu;
 
        BT_DBG("tty %p", tty);
 
-       /* FIXME: This btw is bogus, nothing requires the old ldisc to clear
-          the pointer */
-       if (hu)
-               return -EEXIST;
-
        /* Error if the tty has no write op instead of leaving an exploitable
           hole */
        if (tty->ops->write == NULL)
index a5effd813abddbcdb6a0603148caa822b7dd36f6..45e467dcc8c886996966a2488c148b68d7f792b2 100644 (file)
@@ -27,8 +27,6 @@
 
 #include <asm/io.h>
 
-#include <plat/cpu.h>
-
 #define RNG_OUT_REG            0x00            /* Output register */
 #define RNG_STAT_REG           0x04            /* Status register
                                                        [0] = STAT_BUSY */
index c16a3a593ba48801e188aff6196e38cc02702621..e3ebb4fa2c3e5045c04f6b0b864a4499064fcbff 100644 (file)
@@ -5,7 +5,7 @@
  *  http://www.gnu.org/licenses/gpl.html
  *
  *  Maintainer:
- *  Andreas Herrmann <andreas.herrmann3@amd.com>
+ *  Andreas Herrmann <herrmann.der.user@googlemail.com>
  *
  *  Based on the powernow-k7.c module written by Dave Jones.
  *  (C) 2003 Dave Jones on behalf of SuSE Labs
index 093a8af59cbe46711fd0e750552598eb26f04d85..649a146e1382b61b3143493125eb79d38c63a894 100644 (file)
@@ -29,8 +29,7 @@
 #include <crypto/scatterwalk.h>
 #include <crypto/aes.h>
 
-#include <plat/cpu.h>
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 
 /* OMAP TRM gives bitfields as start:end, where start is the higher bit
    number. For example 7:0 */
@@ -941,11 +940,6 @@ static int __init omap_aes_mod_init(void)
 {
        pr_info("loading %s driver\n", "omap-aes");
 
-       if (!cpu_class_is_omap2() || omap_type() != OMAP2_DEVICE_TYPE_SEC) {
-               pr_err("Unsupported cpu\n");
-               return -ENODEV;
-       }
-
        return  platform_driver_register(&omap_aes_driver);
 }
 
index a3fd6fc504b136d8e44d4435bbeb5c833dd194b1..d76fe06b9417d64a733849f3b961d6d358ab6336 100644 (file)
@@ -37,8 +37,7 @@
 #include <crypto/hash.h>
 #include <crypto/internal/hash.h>
 
-#include <plat/cpu.h>
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 #include <mach/irqs.h>
 
 #define SHA_REG_DIGEST(x)              (0x00 + ((x) * 0x04))
@@ -1289,13 +1288,6 @@ static int __init omap_sham_mod_init(void)
 {
        pr_info("loading %s driver\n", "omap-sham");
 
-       if (!cpu_class_is_omap2() ||
-               (omap_type() != OMAP2_DEVICE_TYPE_SEC &&
-                       omap_type() != OMAP2_DEVICE_TYPE_EMU)) {
-               pr_err("Unsupported cpu\n");
-               return -ENODEV;
-       }
-
        return platform_driver_register(&omap_sham_driver);
 }
 
index 7d9554cc4976313c90604eacecf4b78227a860f7..dbf0e6f8de8a8c64d4b29b33b9c834ae3ab904c7 100644 (file)
@@ -29,7 +29,6 @@
 
 #include <asm/irq.h>
 #include <linux/platform_data/dma-imx.h>
-#include <mach/hardware.h>
 
 #include "dmaengine.h"
 #define IMXDMA_MAX_CHAN_DESCRIPTORS    16
@@ -167,6 +166,12 @@ struct imxdma_channel {
        int                             slot_2d;
 };
 
+enum imx_dma_type {
+       IMX1_DMA,
+       IMX21_DMA,
+       IMX27_DMA,
+};
+
 struct imxdma_engine {
        struct device                   *dev;
        struct device_dma_parameters    dma_parms;
@@ -177,7 +182,39 @@ struct imxdma_engine {
        spinlock_t                      lock;
        struct imx_dma_2d_config        slots_2d[IMX_DMA_2D_SLOTS];
        struct imxdma_channel           channel[IMX_DMA_CHANNELS];
+       enum imx_dma_type               devtype;
+};
+
+static struct platform_device_id imx_dma_devtype[] = {
+       {
+               .name = "imx1-dma",
+               .driver_data = IMX1_DMA,
+       }, {
+               .name = "imx21-dma",
+               .driver_data = IMX21_DMA,
+       }, {
+               .name = "imx27-dma",
+               .driver_data = IMX27_DMA,
+       }, {
+               /* sentinel */
+       }
 };
+MODULE_DEVICE_TABLE(platform, imx_dma_devtype);
+
+static inline int is_imx1_dma(struct imxdma_engine *imxdma)
+{
+       return imxdma->devtype == IMX1_DMA;
+}
+
+static inline int is_imx21_dma(struct imxdma_engine *imxdma)
+{
+       return imxdma->devtype == IMX21_DMA;
+}
+
+static inline int is_imx27_dma(struct imxdma_engine *imxdma)
+{
+       return imxdma->devtype == IMX27_DMA;
+}
 
 static struct imxdma_channel *to_imxdma_chan(struct dma_chan *chan)
 {
@@ -212,7 +249,9 @@ static unsigned imx_dmav1_readl(struct imxdma_engine *imxdma, unsigned offset)
 
 static int imxdma_hw_chain(struct imxdma_channel *imxdmac)
 {
-       if (cpu_is_mx27())
+       struct imxdma_engine *imxdma = imxdmac->imxdma;
+
+       if (is_imx27_dma(imxdma))
                return imxdmac->hw_chaining;
        else
                return 0;
@@ -267,7 +306,7 @@ static void imxdma_enable_hw(struct imxdma_desc *d)
        imx_dmav1_writel(imxdma, imx_dmav1_readl(imxdma, DMA_CCR(channel)) |
                         CCR_CEN | CCR_ACRPT, DMA_CCR(channel));
 
-       if ((cpu_is_mx21() || cpu_is_mx27()) &&
+       if (!is_imx1_dma(imxdma) &&
                        d->sg && imxdma_hw_chain(imxdmac)) {
                d->sg = sg_next(d->sg);
                if (d->sg) {
@@ -436,7 +475,7 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id)
        struct imxdma_engine *imxdma = dev_id;
        int i, disr;
 
-       if (cpu_is_mx21() || cpu_is_mx27())
+       if (!is_imx1_dma(imxdma))
                imxdma_err_handler(irq, dev_id);
 
        disr = imx_dmav1_readl(imxdma, DMA_DISR);
@@ -961,35 +1000,32 @@ static void imxdma_issue_pending(struct dma_chan *chan)
 static int __init imxdma_probe(struct platform_device *pdev)
        {
        struct imxdma_engine *imxdma;
+       struct resource *res;
        int ret, i;
+       int irq, irq_err;
 
-
-       imxdma = kzalloc(sizeof(*imxdma), GFP_KERNEL);
+       imxdma = devm_kzalloc(&pdev->dev, sizeof(*imxdma), GFP_KERNEL);
        if (!imxdma)
                return -ENOMEM;
 
-       if (cpu_is_mx1()) {
-               imxdma->base = MX1_IO_ADDRESS(MX1_DMA_BASE_ADDR);
-       } else if (cpu_is_mx21()) {
-               imxdma->base = MX21_IO_ADDRESS(MX21_DMA_BASE_ADDR);
-       } else if (cpu_is_mx27()) {
-               imxdma->base = MX27_IO_ADDRESS(MX27_DMA_BASE_ADDR);
-       } else {
-               kfree(imxdma);
-               return 0;
-       }
+       imxdma->devtype = pdev->id_entry->driver_data;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       imxdma->base = devm_request_and_ioremap(&pdev->dev, res);
+       if (!imxdma->base)
+               return -EADDRNOTAVAIL;
+
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0)
+               return irq;
 
        imxdma->dma_ipg = devm_clk_get(&pdev->dev, "ipg");
-       if (IS_ERR(imxdma->dma_ipg)) {
-               ret = PTR_ERR(imxdma->dma_ipg);
-               goto err_clk;
-       }
+       if (IS_ERR(imxdma->dma_ipg))
+               return PTR_ERR(imxdma->dma_ipg);
 
        imxdma->dma_ahb = devm_clk_get(&pdev->dev, "ahb");
-       if (IS_ERR(imxdma->dma_ahb)) {
-               ret = PTR_ERR(imxdma->dma_ahb);
-               goto err_clk;
-       }
+       if (IS_ERR(imxdma->dma_ahb))
+               return PTR_ERR(imxdma->dma_ahb);
 
        clk_prepare_enable(imxdma->dma_ipg);
        clk_prepare_enable(imxdma->dma_ahb);
@@ -997,18 +1033,25 @@ static int __init imxdma_probe(struct platform_device *pdev)
        /* reset DMA module */
        imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR);
 
-       if (cpu_is_mx1()) {
-               ret = request_irq(MX1_DMA_INT, dma_irq_handler, 0, "DMA", imxdma);
+       if (is_imx1_dma(imxdma)) {
+               ret = devm_request_irq(&pdev->dev, irq,
+                                      dma_irq_handler, 0, "DMA", imxdma);
                if (ret) {
                        dev_warn(imxdma->dev, "Can't register IRQ for DMA\n");
-                       goto err_enable;
+                       goto err;
+               }
+
+               irq_err = platform_get_irq(pdev, 1);
+               if (irq_err < 0) {
+                       ret = irq_err;
+                       goto err;
                }
 
-               ret = request_irq(MX1_DMA_ERR, imxdma_err_handler, 0, "DMA", imxdma);
+               ret = devm_request_irq(&pdev->dev, irq_err,
+                                      imxdma_err_handler, 0, "DMA", imxdma);
                if (ret) {
                        dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n");
-                       free_irq(MX1_DMA_INT, NULL);
-                       goto err_enable;
+                       goto err;
                }
        }
 
@@ -1038,14 +1081,14 @@ static int __init imxdma_probe(struct platform_device *pdev)
        for (i = 0; i < IMX_DMA_CHANNELS; i++) {
                struct imxdma_channel *imxdmac = &imxdma->channel[i];
 
-               if (cpu_is_mx21() || cpu_is_mx27()) {
-                       ret = request_irq(MX2x_INT_DMACH0 + i,
+               if (!is_imx1_dma(imxdma)) {
+                       ret = devm_request_irq(&pdev->dev, irq + i,
                                        dma_irq_handler, 0, "DMA", imxdma);
                        if (ret) {
                                dev_warn(imxdma->dev, "Can't register IRQ %d "
                                         "for DMA channel %d\n",
-                                        MX2x_INT_DMACH0 + i, i);
-                               goto err_init;
+                                        irq + i, i);
+                               goto err;
                        }
                        init_timer(&imxdmac->watchdog);
                        imxdmac->watchdog.function = &imxdma_watchdog;
@@ -1091,46 +1134,25 @@ static int __init imxdma_probe(struct platform_device *pdev)
        ret = dma_async_device_register(&imxdma->dma_device);
        if (ret) {
                dev_err(&pdev->dev, "unable to register\n");
-               goto err_init;
+               goto err;
        }
 
        return 0;
 
-err_init:
-
-       if (cpu_is_mx21() || cpu_is_mx27()) {
-               while (--i >= 0)
-                       free_irq(MX2x_INT_DMACH0 + i, NULL);
-       } else if cpu_is_mx1() {
-               free_irq(MX1_DMA_INT, NULL);
-               free_irq(MX1_DMA_ERR, NULL);
-       }
-err_enable:
+err:
        clk_disable_unprepare(imxdma->dma_ipg);
        clk_disable_unprepare(imxdma->dma_ahb);
-err_clk:
-       kfree(imxdma);
        return ret;
 }
 
 static int __exit imxdma_remove(struct platform_device *pdev)
 {
        struct imxdma_engine *imxdma = platform_get_drvdata(pdev);
-       int i;
 
         dma_async_device_unregister(&imxdma->dma_device);
 
-       if (cpu_is_mx21() || cpu_is_mx27()) {
-               for (i = 0; i < IMX_DMA_CHANNELS; i++)
-                       free_irq(MX2x_INT_DMACH0 + i, NULL);
-       } else if cpu_is_mx1() {
-               free_irq(MX1_DMA_INT, NULL);
-               free_irq(MX1_DMA_ERR, NULL);
-       }
-
        clk_disable_unprepare(imxdma->dma_ipg);
        clk_disable_unprepare(imxdma->dma_ahb);
-       kfree(imxdma);
 
         return 0;
 }
@@ -1139,6 +1161,7 @@ static struct platform_driver imxdma_driver = {
        .driver         = {
                .name   = "imx-dma",
        },
+       .id_table       = imx_dma_devtype,
        .remove         = __exit_p(imxdma_remove),
 };
 
index c099ca0846f49dc76dcc29342940b29498ba68f9..f082aa3a918c9afa82fa459849c96d63f81242b6 100644 (file)
@@ -40,7 +40,6 @@
 #include <asm/irq.h>
 #include <linux/platform_data/dma-imx-sdma.h>
 #include <linux/platform_data/dma-imx.h>
-#include <mach/hardware.h>
 
 #include "dmaengine.h"
 
index c7573e50aa14110118426c9d56c49cdb890cd651..65855373cee656888cc68739e622abd8ce10e59f 100644 (file)
@@ -22,8 +22,7 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/module.h>
-
-#include <mach/ipu.h>
+#include <linux/dma/ipu-dma.h>
 
 #include "../dmaengine.h"
 #include "ipu_intern.h"
index fa95bcc3de1f66b107a4cddf38e97d5fa68286b2..a5ee37d5320f9e94e4cdbf73a144a86216045078 100644 (file)
@@ -15,8 +15,7 @@
 #include <linux/irq.h>
 #include <linux/io.h>
 #include <linux/module.h>
-
-#include <mach/ipu.h>
+#include <linux/dma/ipu-dma.h>
 
 #include "ipu_intern.h"
 
index bb2d8e7029eb638c8d18f9ed3a9db01d795aef2c..7d35c237fbf13f6ae2bf7a44e330cf60f24ba8d2 100644 (file)
@@ -19,8 +19,7 @@
 
 #include "virt-dma.h"
 
-#include <plat/cpu.h>
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 
 struct omap_dmadev {
        struct dma_device ddev;
@@ -438,7 +437,7 @@ static struct dma_async_tx_descriptor *omap_dma_prep_dma_cyclic(
                omap_disable_dma_irq(c->dma_ch, OMAP_DMA_BLOCK_IRQ);
        }
 
-       if (!cpu_class_is_omap1()) {
+       if (dma_omap2plus()) {
                omap_set_dma_src_burst_mode(c->dma_ch, OMAP_DMA_DATA_BURST_16);
                omap_set_dma_dest_burst_mode(c->dma_ch, OMAP_DMA_DATA_BURST_16);
        }
index d055cee36942d5e7aea8535b5f8d77b4ab34fe09..f11d8e3b4041b780c8c9f9ec154c3f0878025ec6 100644 (file)
@@ -47,7 +47,7 @@ if GPIOLIB
 
 config OF_GPIO
        def_bool y
-       depends on OF && !SPARC
+       depends on OF
 
 config DEBUG_GPIO
        bool "Debug GPIO calls"
index ed3e55161bdc5bacbd0409a8a728f161872671c9..f05e54258ffb0a7c1b62eb54be11f2f8ed9486d8 100644 (file)
@@ -153,7 +153,7 @@ static int __devinit gen_74x164_probe(struct spi_device *spi)
        }
 
        chip->gpio_chip.ngpio = GEN_74X164_NUMBER_GPIOS * chip->registers;
-       chip->buffer = devm_kzalloc(&spi->dev, chip->gpio_chip.ngpio, GFP_KERNEL);
+       chip->buffer = devm_kzalloc(&spi->dev, chip->registers, GFP_KERNEL);
        if (!chip->buffer) {
                ret = -ENOMEM;
                goto exit_destroy;
index 7a874129e5d8f3634b68ea45d5d73a2a316f8bae..cf7afb9eb61ab02c4060532dbdd39e2c2c6e9561 100644 (file)
@@ -244,6 +244,8 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned pin,
        if (ret)
                return ret;
 
+       mvebu_gpio_set(chip, pin, value);
+
        spin_lock_irqsave(&mvchip->lock, flags);
        u = readl_relaxed(mvebu_gpioreg_io_conf(mvchip));
        u &= ~(1 << pin);
@@ -644,7 +646,7 @@ static int __devinit mvebu_gpio_probe(struct platform_device *pdev)
        ct->handler = handle_edge_irq;
        ct->chip.name = mvchip->chip.label;
 
-       irq_setup_generic_chip(gc, IRQ_MSK(ngpios), IRQ_GC_INIT_MASK_CACHE,
+       irq_setup_generic_chip(gc, IRQ_MSK(ngpios), 0,
                               IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE);
 
        /* Setup irq domain on top of the generic chip. */
index 94cbc842fbc3a1363de61b8b7d08f2e4b56daeaf..d335af1d4d858da39b2825fd9144c01e76f877e5 100644 (file)
@@ -251,6 +251,40 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
        }
 }
 
+/**
+ * _clear_gpio_debounce - clear debounce settings for a gpio
+ * @bank: the gpio bank we're acting upon
+ * @gpio: the gpio number on this @gpio
+ *
+ * If a gpio is using debounce, then clear the debounce enable bit and if
+ * this is the only gpio in this bank using debounce, then clear the debounce
+ * time too. The debounce clock will also be disabled when calling this function
+ * if this is the only gpio in the bank using debounce.
+ */
+static void _clear_gpio_debounce(struct gpio_bank *bank, unsigned gpio)
+{
+       u32 gpio_bit = GPIO_BIT(bank, gpio);
+
+       if (!bank->dbck_flag)
+               return;
+
+       if (!(bank->dbck_enable_mask & gpio_bit))
+               return;
+
+       bank->dbck_enable_mask &= ~gpio_bit;
+       bank->context.debounce_en &= ~gpio_bit;
+       __raw_writel(bank->context.debounce_en,
+                    bank->base + bank->regs->debounce_en);
+
+       if (!bank->dbck_enable_mask) {
+               bank->context.debounce = 0;
+               __raw_writel(bank->context.debounce, bank->base +
+                            bank->regs->debounce);
+               clk_disable(bank->dbck);
+               bank->dbck_enabled = false;
+       }
+}
+
 static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio,
                                                unsigned trigger)
 {
@@ -539,6 +573,7 @@ static void _reset_gpio(struct gpio_bank *bank, int gpio)
        _set_gpio_irqenable(bank, gpio, 0);
        _clear_gpio_irqstatus(bank, gpio);
        _set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE);
+       _clear_gpio_debounce(bank, gpio);
 }
 
 /* Use disable_irq_wake() and enable_irq_wake() functions from drivers */
index 031c6adf5b651542420ee819ad0810d537707222..1a3e2b9b4772f7e710c16dee60a48049a3ff5c6d 100644 (file)
@@ -116,7 +116,7 @@ static void timbgpio_irq_disable(struct irq_data *d)
        unsigned long flags;
 
        spin_lock_irqsave(&tgpio->lock, flags);
-       tgpio->last_ier &= ~(1 << offset);
+       tgpio->last_ier &= ~(1UL << offset);
        iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER);
        spin_unlock_irqrestore(&tgpio->lock, flags);
 }
@@ -128,7 +128,7 @@ static void timbgpio_irq_enable(struct irq_data *d)
        unsigned long flags;
 
        spin_lock_irqsave(&tgpio->lock, flags);
-       tgpio->last_ier |= 1 << offset;
+       tgpio->last_ier |= 1UL << offset;
        iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER);
        spin_unlock_irqrestore(&tgpio->lock, flags);
 }
index 5d6c71edc73911c7765a7530e65352fda2478845..1c8d9e3380e17276e17e8f009659954e58d05bd1 100644 (file)
@@ -623,9 +623,11 @@ static ssize_t export_store(struct class *class,
         */
 
        status = gpio_request(gpio, "sysfs");
-       if (status < 0)
+       if (status < 0) {
+               if (status == -EPROBE_DEFER)
+                       status = -ENODEV;
                goto done;
-
+       }
        status = gpio_export(gpio, true);
        if (status < 0)
                gpio_free(gpio);
@@ -1191,8 +1193,10 @@ int gpio_request(unsigned gpio, const char *label)
 
        spin_lock_irqsave(&gpio_lock, flags);
 
-       if (!gpio_is_valid(gpio))
+       if (!gpio_is_valid(gpio)) {
+               status = -EINVAL;
                goto done;
+       }
        desc = &gpio_desc[gpio];
        chip = desc->chip;
        if (chip == NULL)
index 7ef1b673e1be9ec2f82006ca3d8ea2519e13b231..133b4132983e35e366884301a443ff26f45a2a05 100644 (file)
@@ -121,6 +121,8 @@ int drm_open(struct inode *inode, struct file *filp)
        int minor_id = iminor(inode);
        struct drm_minor *minor;
        int retcode = 0;
+       int need_setup = 0;
+       struct address_space *old_mapping;
 
        minor = idr_find(&drm_minors_idr, minor_id);
        if (!minor)
@@ -132,23 +134,37 @@ int drm_open(struct inode *inode, struct file *filp)
        if (drm_device_is_unplugged(dev))
                return -ENODEV;
 
+       if (!dev->open_count++)
+               need_setup = 1;
+       mutex_lock(&dev->struct_mutex);
+       old_mapping = dev->dev_mapping;
+       if (old_mapping == NULL)
+               dev->dev_mapping = &inode->i_data;
+       /* ihold ensures nobody can remove inode with our i_data */
+       ihold(container_of(dev->dev_mapping, struct inode, i_data));
+       inode->i_mapping = dev->dev_mapping;
+       filp->f_mapping = dev->dev_mapping;
+       mutex_unlock(&dev->struct_mutex);
+
        retcode = drm_open_helper(inode, filp, dev);
-       if (!retcode) {
-               atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
-               if (!dev->open_count++)
-                       retcode = drm_setup(dev);
-       }
-       if (!retcode) {
-               mutex_lock(&dev->struct_mutex);
-               if (dev->dev_mapping == NULL)
-                       dev->dev_mapping = &inode->i_data;
-               /* ihold ensures nobody can remove inode with our i_data */
-               ihold(container_of(dev->dev_mapping, struct inode, i_data));
-               inode->i_mapping = dev->dev_mapping;
-               filp->f_mapping = dev->dev_mapping;
-               mutex_unlock(&dev->struct_mutex);
+       if (retcode)
+               goto err_undo;
+       atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
+       if (need_setup) {
+               retcode = drm_setup(dev);
+               if (retcode)
+                       goto err_undo;
        }
+       return 0;
 
+err_undo:
+       mutex_lock(&dev->struct_mutex);
+       filp->f_mapping = old_mapping;
+       inode->i_mapping = old_mapping;
+       iput(container_of(dev->dev_mapping, struct inode, i_data));
+       dev->dev_mapping = old_mapping;
+       mutex_unlock(&dev->struct_mutex);
+       dev->open_count--;
        return retcode;
 }
 EXPORT_SYMBOL(drm_open);
index 59a26e577b57f423077d5a2c86d75364f14b6838..fc345d4ebb03acea266bfb100b4661cebf970f69 100644 (file)
@@ -1,6 +1,6 @@
 config DRM_EXYNOS
        tristate "DRM Support for Samsung SoC EXYNOS Series"
-       depends on DRM && PLAT_SAMSUNG
+       depends on DRM && (PLAT_SAMSUNG || ARCH_MULTIPLATFORM)
        select DRM_KMS_HELPER
        select FB_CFB_FILLRECT
        select FB_CFB_COPYAREA
index 18c271862ca8468a8ce0d3d4b24d8a595d29ad44..0f68a28726739dd6b795ad066edb645799cfc6d2 100644 (file)
@@ -374,6 +374,7 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev,
        exynos_connector->encoder_id = encoder->base.id;
        exynos_connector->manager = manager;
        exynos_connector->dpms = DRM_MODE_DPMS_OFF;
+       connector->dpms = DRM_MODE_DPMS_OFF;
        connector->encoder = encoder;
 
        err = drm_mode_connector_attach_encoder(connector, encoder);
index e51503fbaf2bcbf19edbdf423638a725b5703a6e..241ad1eeec64d2097a4416bd76026723d384a215 100644 (file)
  * @manager: specific encoder has its own manager to control a hardware
  *     appropriately and we can access a hardware drawing on this manager.
  * @dpms: store the encoder dpms value.
+ * @updated: indicate whether overlay data updating is needed or not.
  */
 struct exynos_drm_encoder {
        struct drm_crtc                 *old_crtc;
        struct drm_encoder              drm_encoder;
        struct exynos_drm_manager       *manager;
-       int dpms;
+       int                             dpms;
+       bool                            updated;
 };
 
 static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode)
@@ -85,7 +87,9 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
        switch (mode) {
        case DRM_MODE_DPMS_ON:
                if (manager_ops && manager_ops->apply)
-                       manager_ops->apply(manager->dev);
+                       if (!exynos_encoder->updated)
+                               manager_ops->apply(manager->dev);
+
                exynos_drm_connector_power(encoder, mode);
                exynos_encoder->dpms = mode;
                break;
@@ -94,6 +98,7 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
        case DRM_MODE_DPMS_OFF:
                exynos_drm_connector_power(encoder, mode);
                exynos_encoder->dpms = mode;
+               exynos_encoder->updated = false;
                break;
        default:
                DRM_ERROR("unspecified mode %d\n", mode);
@@ -205,13 +210,22 @@ static void exynos_drm_encoder_prepare(struct drm_encoder *encoder)
 
 static void exynos_drm_encoder_commit(struct drm_encoder *encoder)
 {
-       struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);
+       struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
+       struct exynos_drm_manager *manager = exynos_encoder->manager;
        struct exynos_drm_manager_ops *manager_ops = manager->ops;
 
        DRM_DEBUG_KMS("%s\n", __FILE__);
 
        if (manager_ops && manager_ops->commit)
                manager_ops->commit(manager->dev);
+
+       /*
+        * this will avoid one issue that overlay data is updated to
+        * real hardware two times.
+        * And this variable will be used to check if the data was
+        * already updated or not by exynos_drm_encoder_dpms function.
+        */
+       exynos_encoder->updated = true;
 }
 
 static void exynos_drm_encoder_disable(struct drm_encoder *encoder)
@@ -400,19 +414,6 @@ void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data)
        if (manager_ops && manager_ops->dpms)
                manager_ops->dpms(manager->dev, mode);
 
-       /*
-        * set current mode to new one so that data aren't updated into
-        * registers by drm_helper_connector_dpms two times.
-        *
-        * in case that drm_crtc_helper_set_mode() is called,
-        * overlay_ops->commit() and manager_ops->commit() callbacks
-        * can be called two times, first at drm_crtc_helper_set_mode()
-        * and second at drm_helper_connector_dpms().
-        * so with this setting, when drm_helper_connector_dpms() is called
-        * encoder->funcs->dpms() will be ignored.
-        */
-       exynos_encoder->dpms = mode;
-
        /*
         * if this condition is ok then it means that the crtc is already
         * detached from encoder and last function for detaching is properly
index 614b2e9ac462c9c402226324d9b12d38b996af14..e7fbb823fd8e5fe2fe97845a1b42a3d84efd50be 100644 (file)
@@ -1142,7 +1142,7 @@ static int __devinit mixer_probe(struct platform_device *pdev)
                const struct of_device_id *match;
                match = of_match_node(of_match_ptr(mixer_match_types),
                                                          pdev->dev.of_node);
-               drv = match->data;
+               drv = (struct mixer_drv_data *)match->data;
        } else {
                drv = (struct mixer_drv_data *)
                        platform_get_device_id(pdev)->driver_data;
index c9bfd83dde64eb6d83cf181fb6c27b3cfcf0a038..61ae104dca8c0f5b9938f092b93f7eca70a06525 100644 (file)
@@ -1505,7 +1505,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
                goto put_gmch;
        }
 
-       i915_kick_out_firmware_fb(dev_priv);
+       if (drm_core_check_feature(dev, DRIVER_MODESET))
+               i915_kick_out_firmware_fb(dev_priv);
 
        pci_set_master(dev->pdev);
 
index f78061af70459d6f4e39c25e79d8ff722ccb7aa2..b726b478a4f5db604b6804ad679f7a887168705c 100644 (file)
@@ -729,7 +729,7 @@ void intel_crt_init(struct drm_device *dev)
 
        crt->base.type = INTEL_OUTPUT_ANALOG;
        crt->base.cloneable = true;
-       if (IS_HASWELL(dev))
+       if (IS_HASWELL(dev) || IS_I830(dev))
                crt->base.crtc_mask = (1 << 0);
        else
                crt->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
index 495625914e4a084f01f476d93524bed83db7ac42..d7bc817f51a024b803986e76fa492146632da66d 100644 (file)
@@ -341,9 +341,17 @@ static int intel_overlay_off(struct intel_overlay *overlay)
        intel_ring_emit(ring, flip_addr);
        intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
        /* turn overlay off */
-       intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_OFF);
-       intel_ring_emit(ring, flip_addr);
-       intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
+       if (IS_I830(dev)) {
+               /* Workaround: Don't disable the overlay fully, since otherwise
+                * it dies on the next OVERLAY_ON cmd. */
+               intel_ring_emit(ring, MI_NOOP);
+               intel_ring_emit(ring, MI_NOOP);
+               intel_ring_emit(ring, MI_NOOP);
+       } else {
+               intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_OFF);
+               intel_ring_emit(ring, flip_addr);
+               intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
+       }
        intel_ring_advance(ring);
 
        return intel_overlay_do_wait_request(overlay, intel_overlay_off_tail);
index e019b236986128bae46c61bf49180f7ec2502a0d..e2aacd329545a1ff05a68dd4218f571c5208a2aa 100644 (file)
@@ -435,7 +435,7 @@ int intel_panel_setup_backlight(struct drm_device *dev)
        props.type = BACKLIGHT_RAW;
        props.max_brightness = _intel_panel_get_max_backlight(dev);
        if (props.max_brightness == 0) {
-               DRM_ERROR("Failed to get maximum backlight value\n");
+               DRM_DEBUG_DRIVER("Failed to get maximum backlight value\n");
                return -ENODEV;
        }
        dev_priv->backlight =
index c01d97db0061d19be180f6dbcf9cecffd505aeb0..79d308da29ff8e67cc064b94a31500c0d614a0ad 100644 (file)
@@ -894,6 +894,45 @@ static void intel_sdvo_dump_hdmi_buf(struct intel_sdvo *intel_sdvo)
 }
 #endif
 
+static bool intel_sdvo_write_infoframe(struct intel_sdvo *intel_sdvo,
+                                      unsigned if_index, uint8_t tx_rate,
+                                      uint8_t *data, unsigned length)
+{
+       uint8_t set_buf_index[2] = { if_index, 0 };
+       uint8_t hbuf_size, tmp[8];
+       int i;
+
+       if (!intel_sdvo_set_value(intel_sdvo,
+                                 SDVO_CMD_SET_HBUF_INDEX,
+                                 set_buf_index, 2))
+               return false;
+
+       if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HBUF_INFO,
+                                 &hbuf_size, 1))
+               return false;
+
+       /* Buffer size is 0 based, hooray! */
+       hbuf_size++;
+
+       DRM_DEBUG_KMS("writing sdvo hbuf: %i, hbuf_size %i, hbuf_size: %i\n",
+                     if_index, length, hbuf_size);
+
+       for (i = 0; i < hbuf_size; i += 8) {
+               memset(tmp, 0, 8);
+               if (i < length)
+                       memcpy(tmp, data + i, min_t(unsigned, 8, length - i));
+
+               if (!intel_sdvo_set_value(intel_sdvo,
+                                         SDVO_CMD_SET_HBUF_DATA,
+                                         tmp, 8))
+                       return false;
+       }
+
+       return intel_sdvo_set_value(intel_sdvo,
+                                   SDVO_CMD_SET_HBUF_TXRATE,
+                                   &tx_rate, 1);
+}
+
 static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo)
 {
        struct dip_infoframe avi_if = {
@@ -901,11 +940,7 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo)
                .ver = DIP_VERSION_AVI,
                .len = DIP_LEN_AVI,
        };
-       uint8_t tx_rate = SDVO_HBUF_TX_VSYNC;
-       uint8_t set_buf_index[2] = { 1, 0 };
        uint8_t sdvo_data[4 + sizeof(avi_if.body.avi)];
-       uint64_t *data = (uint64_t *)sdvo_data;
-       unsigned i;
 
        intel_dip_infoframe_csum(&avi_if);
 
@@ -915,22 +950,9 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo)
        sdvo_data[3] = avi_if.checksum;
        memcpy(&sdvo_data[4], &avi_if.body, sizeof(avi_if.body.avi));
 
-       if (!intel_sdvo_set_value(intel_sdvo,
-                                 SDVO_CMD_SET_HBUF_INDEX,
-                                 set_buf_index, 2))
-               return false;
-
-       for (i = 0; i < sizeof(sdvo_data); i += 8) {
-               if (!intel_sdvo_set_value(intel_sdvo,
-                                         SDVO_CMD_SET_HBUF_DATA,
-                                         data, 8))
-                       return false;
-               data++;
-       }
-
-       return intel_sdvo_set_value(intel_sdvo,
-                                   SDVO_CMD_SET_HBUF_TXRATE,
-                                   &tx_rate, 1);
+       return intel_sdvo_write_infoframe(intel_sdvo, SDVO_HBUF_INDEX_AVI_IF,
+                                         SDVO_HBUF_TX_VSYNC,
+                                         sdvo_data, sizeof(sdvo_data));
 }
 
 static bool intel_sdvo_set_tv_format(struct intel_sdvo *intel_sdvo)
index 9d030142ee43476c89cf2769f0d8c75cf1697daa..770bdd6ecd9fb96b46365bbadd97ba3011c0ef96 100644 (file)
@@ -708,6 +708,8 @@ struct intel_sdvo_enhancements_arg {
 #define SDVO_CMD_SET_AUDIO_STAT                0x91
 #define SDVO_CMD_GET_AUDIO_STAT                0x92
 #define SDVO_CMD_SET_HBUF_INDEX                0x93
+  #define SDVO_HBUF_INDEX_ELD          0
+  #define SDVO_HBUF_INDEX_AVI_IF       1
 #define SDVO_CMD_GET_HBUF_INDEX                0x94
 #define SDVO_CMD_GET_HBUF_INFO         0x95
 #define SDVO_CMD_SET_HBUF_AV_SPLIT     0x96
index 4d6206448670154deaeed940e0eb44993024fea9..a6d3cd6490f7fa97f171dff724f73430364af89f 100644 (file)
@@ -218,13 +218,16 @@ nouveau_mm_init(struct nouveau_mm *mm, u32 offset, u32 length, u32 block)
        node = kzalloc(sizeof(*node), GFP_KERNEL);
        if (!node)
                return -ENOMEM;
-       node->offset = roundup(offset, mm->block_size);
-       node->length = rounddown(offset + length, mm->block_size) - node->offset;
+
+       if (length) {
+               node->offset  = roundup(offset, mm->block_size);
+               node->length  = rounddown(offset + length, mm->block_size);
+               node->length -= node->offset;
+       }
 
        list_add_tail(&node->nl_entry, &mm->nodes);
        list_add_tail(&node->fl_entry, &mm->free);
        mm->heap_nodes++;
-       mm->heap_size += length;
        return 0;
 }
 
index 16a9afb1060b72372ce4cd879870ec362dc9c0e8..05a909a17ceee67590195f0e9c60fd4a10857ed1 100644 (file)
@@ -22,6 +22,8 @@
  * Authors: Ben Skeggs
  */
 
+#include <subdev/bar.h>
+
 #include <engine/software.h>
 #include <engine/disp.h>
 
@@ -37,6 +39,7 @@ nv50_disp_sclass[] = {
 static void
 nv50_disp_intr_vblank(struct nv50_disp_priv *priv, int crtc)
 {
+       struct nouveau_bar *bar = nouveau_bar(priv);
        struct nouveau_disp *disp = &priv->base;
        struct nouveau_software_chan *chan, *temp;
        unsigned long flags;
@@ -46,18 +49,19 @@ nv50_disp_intr_vblank(struct nv50_disp_priv *priv, int crtc)
                if (chan->vblank.crtc != crtc)
                        continue;
 
-               nv_wr32(priv, 0x001704, chan->vblank.channel);
-               nv_wr32(priv, 0x001710, 0x80000000 | chan->vblank.ctxdma);
-
                if (nv_device(priv)->chipset == 0x50) {
+                       nv_wr32(priv, 0x001704, chan->vblank.channel);
+                       nv_wr32(priv, 0x001710, 0x80000000 | chan->vblank.ctxdma);
+                       bar->flush(bar);
                        nv_wr32(priv, 0x001570, chan->vblank.offset);
                        nv_wr32(priv, 0x001574, chan->vblank.value);
                } else {
-                       if (nv_device(priv)->chipset >= 0xc0) {
-                               nv_wr32(priv, 0x06000c,
-                                       upper_32_bits(chan->vblank.offset));
-                       }
-                       nv_wr32(priv, 0x060010, chan->vblank.offset);
+                       nv_wr32(priv, 0x001718, 0x80000000 | chan->vblank.channel);
+                       bar->flush(bar);
+                       nv_wr32(priv, 0x06000c,
+                               upper_32_bits(chan->vblank.offset));
+                       nv_wr32(priv, 0x060010,
+                               lower_32_bits(chan->vblank.offset));
                        nv_wr32(priv, 0x060014, chan->vblank.value);
                }
 
index 8d0021049ec09eeaf139b7797736965f52f8a7f2..425001204a89b6133648d6752fb362159fca4cef 100644 (file)
@@ -156,8 +156,8 @@ nv40_graph_context_ctor(struct nouveau_object *parent,
 static int
 nv40_graph_context_fini(struct nouveau_object *object, bool suspend)
 {
-       struct nv04_graph_priv *priv = (void *)object->engine;
-       struct nv04_graph_chan *chan = (void *)object;
+       struct nv40_graph_priv *priv = (void *)object->engine;
+       struct nv40_graph_chan *chan = (void *)object;
        u32 inst = 0x01000000 | nv_gpuobj(chan)->addr >> 4;
        int ret = 0;
 
index 12418574efeae389fa6fe3ee102379ae32b5fd19..f7c581ad1991b880b3abe6590f0250b68261a9d2 100644 (file)
@@ -38,7 +38,7 @@ struct nv40_mpeg_priv {
 };
 
 struct nv40_mpeg_chan {
-       struct nouveau_mpeg base;
+       struct nouveau_mpeg_chan base;
 };
 
 /*******************************************************************************
index 9ee9bf4028ca168800bc2c6fbcac96346aad9024..975137ba34a6faefb7d4121b8db2efd3464a28c6 100644 (file)
@@ -19,7 +19,6 @@ struct nouveau_mm {
 
        u32 block_size;
        int heap_nodes;
-       u32 heap_size;
 };
 
 int  nouveau_mm_init(struct nouveau_mm *, u32 offset, u32 length, u32 block);
index 27fb1af7a779b2a0add14ab0462cb060d6e4d8d7..5f570806143ad0fb35fcd67017acf07513b563e4 100644 (file)
@@ -219,13 +219,11 @@ nv50_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
                             ((priv->base.ram.size & 0x000000ff) << 32);
 
        tags = nv_rd32(priv, 0x100320);
-       if (tags) {
-               ret = nouveau_mm_init(&priv->base.tags, 0, tags, 1);
-               if (ret)
-                       return ret;
+       ret = nouveau_mm_init(&priv->base.tags, 0, tags, 1);
+       if (ret)
+               return ret;
 
-               nv_debug(priv, "%d compression tags\n", tags);
-       }
+       nv_debug(priv, "%d compression tags\n", tags);
 
        size = (priv->base.ram.size >> 12) - rsvd_head - rsvd_tail;
        switch (device->chipset) {
index 3d2c88310f982553380f19a7f89d5379a89a5d01..dbfc2abf0cfe1a98379a567fa8a7a90fcd409d5f 100644 (file)
@@ -292,7 +292,7 @@ nouveau_i2c_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
                case DCB_I2C_NVIO_BIT:
                        port->drive = info.drive & 0x0f;
                        if (device->card_type < NV_D0) {
-                               if (info.drive >= ARRAY_SIZE(nv50_i2c_port))
+                               if (port->drive >= ARRAY_SIZE(nv50_i2c_port))
                                        break;
                                port->drive = nv50_i2c_port[port->drive];
                                port->sense = port->drive;
index 49050d991e75a5c3610dfd36982113ca85c0dae3..9474cfca6e4ccde36379d3dfa3426317be005741 100644 (file)
@@ -67,7 +67,7 @@ nv41_vm_unmap(struct nouveau_gpuobj *pgt, u32 pte, u32 cnt)
 static void
 nv41_vm_flush(struct nouveau_vm *vm)
 {
-       struct nv04_vm_priv *priv = (void *)vm->vmm;
+       struct nv04_vmmgr_priv *priv = (void *)vm->vmm;
 
        mutex_lock(&nv_subdev(priv)->mutex);
        nv_wr32(priv, 0x100810, 0x00000022);
index 9a6e2cb282dc4e38612845f41f224c5e2aa9b083..d3595b23434ace439cc2087e871f636e86e59867 100644 (file)
@@ -355,7 +355,7 @@ nouveau_connector_detect_lvds(struct drm_connector *connector, bool force)
         * valid - it's not (rh#613284)
         */
        if (nv_encoder->dcb->lvdsconf.use_acpi_for_edid) {
-               if (!(nv_connector->edid = nouveau_acpi_edid(dev, connector))) {
+               if ((nv_connector->edid = nouveau_acpi_edid(dev, connector))) {
                        status = connector_status_connected;
                        goto out;
                }
index d2f8ffeed742c54ae5a3d85d2f806f41e66d3a9d..86124b131f4f31a2ca18e8c2416084ad6df1f585 100644 (file)
@@ -290,6 +290,7 @@ nouveau_display_create(struct drm_device *dev)
        struct nouveau_drm *drm = nouveau_drm(dev);
        struct nouveau_disp *pdisp = nouveau_disp(drm->device);
        struct nouveau_display *disp;
+       u32 pclass = dev->pdev->class >> 8;
        int ret, gen;
 
        disp = drm->display = kzalloc(sizeof(*disp), GFP_KERNEL);
@@ -360,23 +361,27 @@ nouveau_display_create(struct drm_device *dev)
        drm_kms_helper_poll_init(dev);
        drm_kms_helper_poll_disable(dev);
 
-       if (nv_device(drm->device)->card_type < NV_50)
-               ret = nv04_display_create(dev);
-       else
-       if (nv_device(drm->device)->card_type < NV_D0)
-               ret = nv50_display_create(dev);
-       else
-               ret = nvd0_display_create(dev);
-       if (ret)
-               goto disp_create_err;
-
-       if (dev->mode_config.num_crtc) {
-               ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
+       if (nouveau_modeset == 1 ||
+           (nouveau_modeset < 0 && pclass == PCI_CLASS_DISPLAY_VGA)) {
+               if (nv_device(drm->device)->card_type < NV_50)
+                       ret = nv04_display_create(dev);
+               else
+               if (nv_device(drm->device)->card_type < NV_D0)
+                       ret = nv50_display_create(dev);
+               else
+                       ret = nvd0_display_create(dev);
                if (ret)
-                       goto vblank_err;
+                       goto disp_create_err;
+
+               if (dev->mode_config.num_crtc) {
+                       ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
+                       if (ret)
+                               goto vblank_err;
+               }
+
+               nouveau_backlight_init(dev);
        }
 
-       nouveau_backlight_init(dev);
        return 0;
 
 vblank_err:
@@ -395,7 +400,8 @@ nouveau_display_destroy(struct drm_device *dev)
        nouveau_backlight_exit(dev);
        drm_vblank_cleanup(dev);
 
-       disp->dtor(dev);
+       if (disp->dtor)
+               disp->dtor(dev);
 
        drm_kms_helper_poll_fini(dev);
        drm_mode_config_cleanup(dev);
index ccae8c26ae2b34ecc25e8312ee6d57c0d14f06e3..0910125cbbc3be3cfa757f0976f3afea8cac6a21 100644 (file)
@@ -63,8 +63,9 @@ MODULE_PARM_DESC(noaccel, "disable kernel/abi16 acceleration");
 static int nouveau_noaccel = 0;
 module_param_named(noaccel, nouveau_noaccel, int, 0400);
 
-MODULE_PARM_DESC(modeset, "enable driver");
-static int nouveau_modeset = -1;
+MODULE_PARM_DESC(modeset, "enable driver (default: auto, "
+                         "0 = disabled, 1 = enabled, 2 = headless)");
+int nouveau_modeset = -1;
 module_param_named(modeset, nouveau_modeset, int, 0400);
 
 static struct drm_driver driver;
@@ -363,7 +364,8 @@ nouveau_drm_unload(struct drm_device *dev)
 
        nouveau_pm_fini(dev);
 
-       nouveau_display_fini(dev);
+       if (dev->mode_config.num_crtc)
+               nouveau_display_fini(dev);
        nouveau_display_destroy(dev);
 
        nouveau_irq_fini(dev);
@@ -403,13 +405,15 @@ nouveau_drm_suspend(struct pci_dev *pdev, pm_message_t pm_state)
            pm_state.event == PM_EVENT_PRETHAW)
                return 0;
 
-       NV_INFO(drm, "suspending fbcon...\n");
-       nouveau_fbcon_set_suspend(dev, 1);
+       if (dev->mode_config.num_crtc) {
+               NV_INFO(drm, "suspending fbcon...\n");
+               nouveau_fbcon_set_suspend(dev, 1);
 
-       NV_INFO(drm, "suspending display...\n");
-       ret = nouveau_display_suspend(dev);
-       if (ret)
-               return ret;
+               NV_INFO(drm, "suspending display...\n");
+               ret = nouveau_display_suspend(dev);
+               if (ret)
+                       return ret;
+       }
 
        NV_INFO(drm, "evicting buffers...\n");
        ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM);
@@ -445,8 +449,10 @@ fail_client:
                nouveau_client_init(&cli->base);
        }
 
-       NV_INFO(drm, "resuming display...\n");
-       nouveau_display_resume(dev);
+       if (dev->mode_config.num_crtc) {
+               NV_INFO(drm, "resuming display...\n");
+               nouveau_display_resume(dev);
+       }
        return ret;
 }
 
@@ -486,8 +492,10 @@ nouveau_drm_resume(struct pci_dev *pdev)
        nouveau_irq_postinstall(dev);
        nouveau_pm_resume(dev);
 
-       NV_INFO(drm, "resuming display...\n");
-       nouveau_display_resume(dev);
+       if (dev->mode_config.num_crtc) {
+               NV_INFO(drm, "resuming display...\n");
+               nouveau_display_resume(dev);
+       }
        return 0;
 }
 
@@ -662,9 +670,7 @@ nouveau_drm_init(void)
 #ifdef CONFIG_VGA_CONSOLE
                if (vgacon_text_force())
                        nouveau_modeset = 0;
-               else
 #endif
-                       nouveau_modeset = 1;
        }
 
        if (!nouveau_modeset)
index 819471217546b23cb867e3e583ed856d5d810ea2..a10169927086dfea6c826dac0378ae1d2c82ffb3 100644 (file)
@@ -141,4 +141,6 @@ int nouveau_drm_resume(struct pci_dev *);
                nv_info((cli), fmt, ##args);                                   \
 } while (0)
 
+extern int nouveau_modeset;
+
 #endif
index 9ca8afdb5549777c7a2b25e64de9b63f700260bc..1d8cb506a28ae5159ebe4c9df362f3f0d92d7758 100644 (file)
@@ -61,13 +61,15 @@ nouveau_irq_handler(DRM_IRQ_ARGS)
 
        nv_subdev(pmc)->intr(nv_subdev(pmc));
 
-       if (device->card_type >= NV_D0) {
-               if (nv_rd32(device, 0x000100) & 0x04000000)
-                       nvd0_display_intr(dev);
-       } else
-       if (device->card_type >= NV_50) {
-               if (nv_rd32(device, 0x000100) & 0x04000000)
-                       nv50_display_intr(dev);
+       if (dev->mode_config.num_crtc) {
+               if (device->card_type >= NV_D0) {
+                       if (nv_rd32(device, 0x000100) & 0x04000000)
+                               nvd0_display_intr(dev);
+               } else
+               if (device->card_type >= NV_50) {
+                       if (nv_rd32(device, 0x000100) & 0x04000000)
+                               nv50_display_intr(dev);
+               }
        }
 
        return IRQ_HANDLED;
index 347a3bd78d0486f1fed24f11d8183f9382d822dd..64f7020fb605dcaff92163aa161d174ad0d77a23 100644 (file)
@@ -220,7 +220,7 @@ out:
        NVWriteVgaCrtc(dev, 0, NV_CIO_CR_MODE_INDEX, saved_cr_mode);
 
        if (blue == 0x18) {
-               NV_INFO(drm, "Load detected on head A\n");
+               NV_DEBUG(drm, "Load detected on head A\n");
                return connector_status_connected;
        }
 
@@ -338,8 +338,8 @@ nv17_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector)
 
        if (nv17_dac_sample_load(encoder) &
            NV_PRAMDAC_TEST_CONTROL_SENSEB_ALLHI) {
-               NV_INFO(drm, "Load detected on output %c\n",
-                       '@' + ffs(dcb->or));
+               NV_DEBUG(drm, "Load detected on output %c\n",
+                        '@' + ffs(dcb->or));
                return connector_status_connected;
        } else {
                return connector_status_disconnected;
@@ -413,9 +413,9 @@ static void nv04_dac_commit(struct drm_encoder *encoder)
 
        helper->dpms(encoder, DRM_MODE_DPMS_ON);
 
-       NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n",
-               drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base),
-               nv_crtc->index, '@' + ffs(nv_encoder->dcb->or));
+       NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n",
+                drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base),
+                nv_crtc->index, '@' + ffs(nv_encoder->dcb->or));
 }
 
 void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable)
@@ -461,8 +461,8 @@ static void nv04_dac_dpms(struct drm_encoder *encoder, int mode)
                return;
        nv_encoder->last_dpms = mode;
 
-       NV_INFO(drm, "Setting dpms mode %d on vga encoder (output %d)\n",
-                    mode, nv_encoder->dcb->index);
+       NV_DEBUG(drm, "Setting dpms mode %d on vga encoder (output %d)\n",
+                mode, nv_encoder->dcb->index);
 
        nv04_dac_update_dacclk(encoder, mode == DRM_MODE_DPMS_ON);
 }
index da55d7642c8cdd325ccca35bd8a1d1b1c1bda8f5..184cdf806761c0bc0cefb52af00a8799ae8e6393 100644 (file)
@@ -476,9 +476,9 @@ static void nv04_dfp_commit(struct drm_encoder *encoder)
 
        helper->dpms(encoder, DRM_MODE_DPMS_ON);
 
-       NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n",
-               drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base),
-               nv_crtc->index, '@' + ffs(nv_encoder->dcb->or));
+       NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n",
+                drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base),
+                nv_crtc->index, '@' + ffs(nv_encoder->dcb->or));
 }
 
 static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode)
@@ -520,8 +520,8 @@ static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode)
                return;
        nv_encoder->last_dpms = mode;
 
-       NV_INFO(drm, "Setting dpms mode %d on lvds encoder (output %d)\n",
-                    mode, nv_encoder->dcb->index);
+       NV_DEBUG(drm, "Setting dpms mode %d on lvds encoder (output %d)\n",
+                mode, nv_encoder->dcb->index);
 
        if (was_powersaving && is_powersaving_dpms(mode))
                return;
@@ -565,8 +565,8 @@ static void nv04_tmds_dpms(struct drm_encoder *encoder, int mode)
                return;
        nv_encoder->last_dpms = mode;
 
-       NV_INFO(drm, "Setting dpms mode %d on tmds encoder (output %d)\n",
-                    mode, nv_encoder->dcb->index);
+       NV_DEBUG(drm, "Setting dpms mode %d on tmds encoder (output %d)\n",
+                mode, nv_encoder->dcb->index);
 
        nv04_dfp_update_backlight(encoder, mode);
        nv04_dfp_update_fp_control(encoder, mode);
index 099fbeda6e2e18f85b7dedbc961582516729b50a..62e826a139b3bd4b08d00a0ca46e0efc59c62d63 100644 (file)
@@ -75,8 +75,8 @@ static void nv04_tv_dpms(struct drm_encoder *encoder, int mode)
        struct nv04_mode_state *state = &nv04_display(dev)->mode_reg;
        uint8_t crtc1A;
 
-       NV_INFO(drm, "Setting dpms mode %d on TV encoder (output %d)\n",
-               mode, nv_encoder->dcb->index);
+       NV_DEBUG(drm, "Setting dpms mode %d on TV encoder (output %d)\n",
+                mode, nv_encoder->dcb->index);
 
        state->pllsel &= ~(PLLSEL_TV_CRTC1_MASK | PLLSEL_TV_CRTC2_MASK);
 
@@ -167,9 +167,8 @@ static void nv04_tv_commit(struct drm_encoder *encoder)
 
        helper->dpms(encoder, DRM_MODE_DPMS_ON);
 
-       NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n",
-                     drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), nv_crtc->index,
-                     '@' + ffs(nv_encoder->dcb->or));
+       NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n",
+                drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), nv_crtc->index, '@' + ffs(nv_encoder->dcb->or));
 }
 
 static void nv04_tv_destroy(struct drm_encoder *encoder)
index 2e566e123e9e747e988f7482a3a5b827b7ca121f..3bce0299f64a664f9d1de78a6f452c907221694f 100644 (file)
@@ -1696,35 +1696,43 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc)
                        return ATOM_PPLL2;
                DRM_ERROR("unable to allocate a PPLL\n");
                return ATOM_PPLL_INVALID;
-       } else {
-               if (ASIC_IS_AVIVO(rdev)) {
-                       /* in DP mode, the DP ref clock can come from either PPLL
-                        * depending on the asic:
-                        * DCE3: PPLL1 or PPLL2
-                        */
-                       if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) {
-                               /* use the same PPLL for all DP monitors */
-                               pll = radeon_get_shared_dp_ppll(crtc);
-                               if (pll != ATOM_PPLL_INVALID)
-                                       return pll;
-                       } else {
-                               /* use the same PPLL for all monitors with the same clock */
-                               pll = radeon_get_shared_nondp_ppll(crtc);
-                               if (pll != ATOM_PPLL_INVALID)
-                                       return pll;
-                       }
-                       /* all other cases */
-                       pll_in_use = radeon_get_pll_use_mask(crtc);
+       } else if (ASIC_IS_AVIVO(rdev)) {
+               /* in DP mode, the DP ref clock can come from either PPLL
+                * depending on the asic:
+                * DCE3: PPLL1 or PPLL2
+                */
+               if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) {
+                       /* use the same PPLL for all DP monitors */
+                       pll = radeon_get_shared_dp_ppll(crtc);
+                       if (pll != ATOM_PPLL_INVALID)
+                               return pll;
+               } else {
+                       /* use the same PPLL for all monitors with the same clock */
+                       pll = radeon_get_shared_nondp_ppll(crtc);
+                       if (pll != ATOM_PPLL_INVALID)
+                               return pll;
+               }
+               /* all other cases */
+               pll_in_use = radeon_get_pll_use_mask(crtc);
+               /* the order shouldn't matter here, but we probably
+                * need this until we have atomic modeset
+                */
+               if (rdev->flags & RADEON_IS_IGP) {
                        if (!(pll_in_use & (1 << ATOM_PPLL1)))
                                return ATOM_PPLL1;
                        if (!(pll_in_use & (1 << ATOM_PPLL2)))
                                return ATOM_PPLL2;
-                       DRM_ERROR("unable to allocate a PPLL\n");
-                       return ATOM_PPLL_INVALID;
                } else {
-                       /* on pre-R5xx asics, the crtc to pll mapping is hardcoded */
-                       return radeon_crtc->crtc_id;
+                       if (!(pll_in_use & (1 << ATOM_PPLL2)))
+                               return ATOM_PPLL2;
+                       if (!(pll_in_use & (1 << ATOM_PPLL1)))
+                               return ATOM_PPLL1;
                }
+               DRM_ERROR("unable to allocate a PPLL\n");
+               return ATOM_PPLL_INVALID;
+       } else {
+               /* on pre-R5xx asics, the crtc to pll mapping is hardcoded */
+               return radeon_crtc->crtc_id;
        }
 }
 
index 14313ad43b7680f28b322b913997cf653242bb07..af31f829f4a8bd6910b8e19ec5bff001b660d3e6 100644 (file)
@@ -1372,7 +1372,7 @@ void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *s
        WREG32(BIF_FB_EN, FB_READ_EN | FB_WRITE_EN);
 
        for (i = 0; i < rdev->num_crtc; i++) {
-               if (save->crtc_enabled) {
+               if (save->crtc_enabled[i]) {
                        if (ASIC_IS_DCE6(rdev)) {
                                tmp = RREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i]);
                                tmp |= EVERGREEN_CRTC_BLANK_DATA_EN;
index 30271b641913f3eeee72dcdc7db7146217c86109..c042e497e4507eaebfd91bb477acbc7520f0143d 100644 (file)
@@ -264,7 +264,7 @@ static int evergreen_surface_check_2d(struct radeon_cs_parser *p,
        /* macro tile width & height */
        palign = (8 * surf->bankw * track->npipes) * surf->mtilea;
        halign = (8 * surf->bankh * surf->nbanks) / surf->mtilea;
-       mtileb = (palign / 8) * (halign / 8) * tileb;;
+       mtileb = (palign / 8) * (halign / 8) * tileb;
        mtile_pr = surf->nbx / palign;
        mtile_ps = (mtile_pr * surf->nby) / halign;
        surf->layer_size = mtile_ps * mtileb * slice_pt;
@@ -2725,6 +2725,9 @@ static bool evergreen_vm_reg_valid(u32 reg)
        /* check config regs */
        switch (reg) {
        case GRBM_GFX_INDEX:
+       case CP_STRMOUT_CNTL:
+       case CP_COHER_CNTL:
+       case CP_COHER_SIZE:
        case VGT_VTX_VECT_EJECT_REG:
        case VGT_CACHE_INVALIDATION:
        case VGT_GS_VERTEX_REUSE:
index df542f1a5dfbf38198d6bfbe329fd6964eacf352..2bc0f6a1b428ab8151b2a7fa57d5f7848ab0dda6 100644 (file)
 #define                FB_READ_EN                                      (1 << 0)
 #define                FB_WRITE_EN                                     (1 << 1)
 
+#define        CP_STRMOUT_CNTL                                 0x84FC
+
+#define        CP_COHER_CNTL                                   0x85F0
+#define        CP_COHER_SIZE                                   0x85F4
 #define        CP_COHER_BASE                                   0x85F8
 #define        CP_STALLED_STAT1                        0x8674
 #define        CP_STALLED_STAT2                        0x8678
index 37f6a907aea49c7b1ff3c57628cb281d737d2e69..15f5ded65e0c290e431a73d4d2c950c9fd9d2687 100644 (file)
@@ -352,9 +352,9 @@ static int radeon_atpx_switchto(enum vga_switcheroo_client_id id)
 }
 
 /**
- * radeon_atpx_switchto - switch to the requested GPU
+ * radeon_atpx_power_state - power down/up the requested GPU
  *
- * @id: GPU to switch to
+ * @id: GPU to power down/up
  * @state: requested power state (0 = off, 1 = on)
  *
  * Execute the necessary ATPX function to power down/up the discrete GPU
index 67cfc1795ecdd4560ac720cc85b0e5a17335a507..b884c362a8c2c0770c02ecb09100d1f9440b55ab 100644 (file)
@@ -941,7 +941,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
        struct drm_mode_object *obj;
        int i;
        enum drm_connector_status ret = connector_status_disconnected;
-       bool dret = false;
+       bool dret = false, broken_edid = false;
 
        if (!force && radeon_check_hpd_status_unchanged(connector))
                return connector->status;
@@ -965,6 +965,9 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
                                ret = connector_status_disconnected;
                                DRM_ERROR("%s: detected RS690 floating bus bug, stopping ddc detect\n", drm_get_connector_name(connector));
                                radeon_connector->ddc_bus = NULL;
+                       } else {
+                               ret = connector_status_connected;
+                               broken_edid = true; /* defer use_digital to later */
                        }
                } else {
                        radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL);
@@ -1047,13 +1050,24 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
 
                        encoder_funcs = encoder->helper_private;
                        if (encoder_funcs->detect) {
-                               if (ret != connector_status_connected) {
-                                       ret = encoder_funcs->detect(encoder, connector);
-                                       if (ret == connector_status_connected) {
-                                               radeon_connector->use_digital = false;
+                               if (!broken_edid) {
+                                       if (ret != connector_status_connected) {
+                                               /* deal with analog monitors without DDC */
+                                               ret = encoder_funcs->detect(encoder, connector);
+                                               if (ret == connector_status_connected) {
+                                                       radeon_connector->use_digital = false;
+                                               }
+                                               if (ret != connector_status_disconnected)
+                                                       radeon_connector->detected_by_load = true;
                                        }
-                                       if (ret != connector_status_disconnected)
-                                               radeon_connector->detected_by_load = true;
+                               } else {
+                                       enum drm_connector_status lret;
+                                       /* assume digital unless load detected otherwise */
+                                       radeon_connector->use_digital = true;
+                                       lret = encoder_funcs->detect(encoder, connector);
+                                       DRM_DEBUG_KMS("load_detect %x returned: %x\n",encoder->encoder_type,lret);
+                                       if (lret == connector_status_connected)
+                                               radeon_connector->use_digital = false;
                                }
                                break;
                        }
index 5677a424b58535e2bffb0422856e9385182b649c..6857cb4efb768c932f23d4645c3969fd9c792f18 100644 (file)
@@ -295,6 +295,7 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
        struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
        struct drm_device *dev = crtc->dev;
        struct radeon_device *rdev = dev->dev_private;
+       uint32_t crtc_ext_cntl = 0;
        uint32_t mask;
 
        if (radeon_crtc->crtc_id)
@@ -307,6 +308,16 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
                        RADEON_CRTC_VSYNC_DIS |
                        RADEON_CRTC_HSYNC_DIS);
 
+       /*
+        * On all dual CRTC GPUs this bit controls the CRTC of the primary DAC.
+        * Therefore it is set in the DAC DMPS function.
+        * This is different for GPU's with a single CRTC but a primary and a
+        * TV DAC: here it controls the single CRTC no matter where it is
+        * routed. Therefore we set it here.
+        */
+       if (rdev->flags & RADEON_SINGLE_CRTC)
+               crtc_ext_cntl = RADEON_CRTC_CRT_ON;
+       
        switch (mode) {
        case DRM_MODE_DPMS_ON:
                radeon_crtc->enabled = true;
@@ -317,7 +328,7 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
                else {
                        WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_EN, ~(RADEON_CRTC_EN |
                                                                         RADEON_CRTC_DISP_REQ_EN_B));
-                       WREG32_P(RADEON_CRTC_EXT_CNTL, 0, ~mask);
+                       WREG32_P(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl, ~(mask | crtc_ext_cntl));
                }
                drm_vblank_post_modeset(dev, radeon_crtc->crtc_id);
                radeon_crtc_load_lut(crtc);
@@ -331,7 +342,7 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
                else {
                        WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_DISP_REQ_EN_B, ~(RADEON_CRTC_EN |
                                                                                    RADEON_CRTC_DISP_REQ_EN_B));
-                       WREG32_P(RADEON_CRTC_EXT_CNTL, mask, ~mask);
+                       WREG32_P(RADEON_CRTC_EXT_CNTL, mask, ~(mask | crtc_ext_cntl));
                }
                radeon_crtc->enabled = false;
                /* adjust pm to dpms changes AFTER disabling crtcs */
index 0063df9d166d70f5267003d24bc078093f2fdf9a..f5ba2241dacc6cfd2bb6b55fead51a7ae2c395e8 100644 (file)
@@ -537,7 +537,9 @@ static void radeon_legacy_primary_dac_dpms(struct drm_encoder *encoder, int mode
                break;
        }
 
-       WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl);
+       /* handled in radeon_crtc_dpms() */
+       if (!(rdev->flags & RADEON_SINGLE_CRTC))
+               WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl);
        WREG32(RADEON_DAC_CNTL, dac_cntl);
        WREG32(RADEON_DAC_MACRO_CNTL, dac_macro_cntl);
 
@@ -662,6 +664,8 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc
 
        if (ASIC_IS_R300(rdev))
                tmp |= (0x1b6 << RADEON_DAC_FORCE_DATA_SHIFT);
+       else if (ASIC_IS_RV100(rdev))
+               tmp |= (0x1ac << RADEON_DAC_FORCE_DATA_SHIFT);
        else
                tmp |= (0x180 << RADEON_DAC_FORCE_DATA_SHIFT);
 
@@ -671,6 +675,7 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc
        tmp |= RADEON_DAC_RANGE_CNTL_PS2 | RADEON_DAC_CMP_EN;
        WREG32(RADEON_DAC_CNTL, tmp);
 
+       tmp = dac_macro_cntl;
        tmp &= ~(RADEON_DAC_PDWN_R |
                 RADEON_DAC_PDWN_G |
                 RADEON_DAC_PDWN_B);
@@ -1092,7 +1097,8 @@ static void radeon_legacy_tv_dac_dpms(struct drm_encoder *encoder, int mode)
        } else {
                if (is_tv)
                        WREG32(RADEON_TV_MASTER_CNTL, tv_master_cntl);
-               else
+               /* handled in radeon_crtc_dpms() */
+               else if (!(rdev->flags & RADEON_SINGLE_CRTC))
                        WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl);
                WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl);
        }
@@ -1416,13 +1422,104 @@ static bool radeon_legacy_tv_detect(struct drm_encoder *encoder,
        return found;
 }
 
+static bool radeon_legacy_ext_dac_detect(struct drm_encoder *encoder,
+                                        struct drm_connector *connector)
+{
+       struct drm_device *dev = encoder->dev;
+       struct radeon_device *rdev = dev->dev_private;
+       uint32_t gpio_monid, fp2_gen_cntl, disp_output_cntl, crtc2_gen_cntl;
+       uint32_t disp_lin_trans_grph_a, disp_lin_trans_grph_b, disp_lin_trans_grph_c;
+       uint32_t disp_lin_trans_grph_d, disp_lin_trans_grph_e, disp_lin_trans_grph_f;
+       uint32_t tmp, crtc2_h_total_disp, crtc2_v_total_disp;
+       uint32_t crtc2_h_sync_strt_wid, crtc2_v_sync_strt_wid;
+       bool found = false;
+       int i;
+
+       /* save the regs we need */
+       gpio_monid = RREG32(RADEON_GPIO_MONID);
+       fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL);
+       disp_output_cntl = RREG32(RADEON_DISP_OUTPUT_CNTL);
+       crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL);
+       disp_lin_trans_grph_a = RREG32(RADEON_DISP_LIN_TRANS_GRPH_A);
+       disp_lin_trans_grph_b = RREG32(RADEON_DISP_LIN_TRANS_GRPH_B);
+       disp_lin_trans_grph_c = RREG32(RADEON_DISP_LIN_TRANS_GRPH_C);
+       disp_lin_trans_grph_d = RREG32(RADEON_DISP_LIN_TRANS_GRPH_D);
+       disp_lin_trans_grph_e = RREG32(RADEON_DISP_LIN_TRANS_GRPH_E);
+       disp_lin_trans_grph_f = RREG32(RADEON_DISP_LIN_TRANS_GRPH_F);
+       crtc2_h_total_disp = RREG32(RADEON_CRTC2_H_TOTAL_DISP);
+       crtc2_v_total_disp = RREG32(RADEON_CRTC2_V_TOTAL_DISP);
+       crtc2_h_sync_strt_wid = RREG32(RADEON_CRTC2_H_SYNC_STRT_WID);
+       crtc2_v_sync_strt_wid = RREG32(RADEON_CRTC2_V_SYNC_STRT_WID);
+
+       tmp = RREG32(RADEON_GPIO_MONID);
+       tmp &= ~RADEON_GPIO_A_0;
+       WREG32(RADEON_GPIO_MONID, tmp);
+
+       WREG32(RADEON_FP2_GEN_CNTL, (RADEON_FP2_ON |
+                                    RADEON_FP2_PANEL_FORMAT |
+                                    R200_FP2_SOURCE_SEL_TRANS_UNIT |
+                                    RADEON_FP2_DVO_EN |
+                                    R200_FP2_DVO_RATE_SEL_SDR));
+
+       WREG32(RADEON_DISP_OUTPUT_CNTL, (RADEON_DISP_DAC_SOURCE_RMX |
+                                        RADEON_DISP_TRANS_MATRIX_GRAPHICS));
+
+       WREG32(RADEON_CRTC2_GEN_CNTL, (RADEON_CRTC2_EN |
+                                      RADEON_CRTC2_DISP_REQ_EN_B));
+
+       WREG32(RADEON_DISP_LIN_TRANS_GRPH_A, 0x00000000);
+       WREG32(RADEON_DISP_LIN_TRANS_GRPH_B, 0x000003f0);
+       WREG32(RADEON_DISP_LIN_TRANS_GRPH_C, 0x00000000);
+       WREG32(RADEON_DISP_LIN_TRANS_GRPH_D, 0x000003f0);
+       WREG32(RADEON_DISP_LIN_TRANS_GRPH_E, 0x00000000);
+       WREG32(RADEON_DISP_LIN_TRANS_GRPH_F, 0x000003f0);
+
+       WREG32(RADEON_CRTC2_H_TOTAL_DISP, 0x01000008);
+       WREG32(RADEON_CRTC2_H_SYNC_STRT_WID, 0x00000800);
+       WREG32(RADEON_CRTC2_V_TOTAL_DISP, 0x00080001);
+       WREG32(RADEON_CRTC2_V_SYNC_STRT_WID, 0x00000080);
+
+       for (i = 0; i < 200; i++) {
+               tmp = RREG32(RADEON_GPIO_MONID);
+               if (tmp & RADEON_GPIO_Y_0)
+                       found = true;
+
+               if (found)
+                       break;
+
+               if (!drm_can_sleep())
+                       mdelay(1);
+               else
+                       msleep(1);
+       }
+
+       /* restore the regs we used */
+       WREG32(RADEON_DISP_LIN_TRANS_GRPH_A, disp_lin_trans_grph_a);
+       WREG32(RADEON_DISP_LIN_TRANS_GRPH_B, disp_lin_trans_grph_b);
+       WREG32(RADEON_DISP_LIN_TRANS_GRPH_C, disp_lin_trans_grph_c);
+       WREG32(RADEON_DISP_LIN_TRANS_GRPH_D, disp_lin_trans_grph_d);
+       WREG32(RADEON_DISP_LIN_TRANS_GRPH_E, disp_lin_trans_grph_e);
+       WREG32(RADEON_DISP_LIN_TRANS_GRPH_F, disp_lin_trans_grph_f);
+       WREG32(RADEON_CRTC2_H_TOTAL_DISP, crtc2_h_total_disp);
+       WREG32(RADEON_CRTC2_V_TOTAL_DISP, crtc2_v_total_disp);
+       WREG32(RADEON_CRTC2_H_SYNC_STRT_WID, crtc2_h_sync_strt_wid);
+       WREG32(RADEON_CRTC2_V_SYNC_STRT_WID, crtc2_v_sync_strt_wid);
+       WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl);
+       WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl);
+       WREG32(RADEON_FP2_GEN_CNTL, fp2_gen_cntl);
+       WREG32(RADEON_GPIO_MONID, gpio_monid);
+
+       return found;
+}
+
 static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder *encoder,
                                                             struct drm_connector *connector)
 {
        struct drm_device *dev = encoder->dev;
        struct radeon_device *rdev = dev->dev_private;
-       uint32_t crtc2_gen_cntl, tv_dac_cntl, dac_cntl2, dac_ext_cntl;
-       uint32_t disp_hw_debug, disp_output_cntl, gpiopad_a, pixclks_cntl, tmp;
+       uint32_t crtc2_gen_cntl = 0, tv_dac_cntl, dac_cntl2, dac_ext_cntl;
+       uint32_t gpiopad_a = 0, pixclks_cntl, tmp;
+       uint32_t disp_output_cntl = 0, disp_hw_debug = 0, crtc_ext_cntl = 0;
        enum drm_connector_status found = connector_status_disconnected;
        struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
        struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv;
@@ -1459,12 +1556,27 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder
                return connector_status_disconnected;
        }
 
+       /* R200 uses an external DAC for secondary DAC */
+       if (rdev->family == CHIP_R200) {
+               if (radeon_legacy_ext_dac_detect(encoder, connector))
+                       found = connector_status_connected;
+               return found;
+       }
+
        /* save the regs we need */
        pixclks_cntl = RREG32_PLL(RADEON_PIXCLKS_CNTL);
-       gpiopad_a = ASIC_IS_R300(rdev) ? RREG32(RADEON_GPIOPAD_A) : 0;
-       disp_output_cntl = ASIC_IS_R300(rdev) ? RREG32(RADEON_DISP_OUTPUT_CNTL) : 0;
-       disp_hw_debug = ASIC_IS_R300(rdev) ? 0 : RREG32(RADEON_DISP_HW_DEBUG);
-       crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL);
+
+       if (rdev->flags & RADEON_SINGLE_CRTC) {
+               crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL);
+       } else {
+               if (ASIC_IS_R300(rdev)) {
+                       gpiopad_a = RREG32(RADEON_GPIOPAD_A);
+                       disp_output_cntl = RREG32(RADEON_DISP_OUTPUT_CNTL);
+               } else {
+                       disp_hw_debug = RREG32(RADEON_DISP_HW_DEBUG);
+               }
+               crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL);
+       }
        tv_dac_cntl = RREG32(RADEON_TV_DAC_CNTL);
        dac_ext_cntl = RREG32(RADEON_DAC_EXT_CNTL);
        dac_cntl2 = RREG32(RADEON_DAC_CNTL2);
@@ -1473,22 +1585,24 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder
                               | RADEON_PIX2CLK_DAC_ALWAYS_ONb);
        WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp);
 
-       if (ASIC_IS_R300(rdev))
-               WREG32_P(RADEON_GPIOPAD_A, 1, ~1);
-
-       tmp = crtc2_gen_cntl & ~RADEON_CRTC2_PIX_WIDTH_MASK;
-       tmp |= RADEON_CRTC2_CRT2_ON |
-               (2 << RADEON_CRTC2_PIX_WIDTH_SHIFT);
-
-       WREG32(RADEON_CRTC2_GEN_CNTL, tmp);
-
-       if (ASIC_IS_R300(rdev)) {
-               tmp = disp_output_cntl & ~RADEON_DISP_TVDAC_SOURCE_MASK;
-               tmp |= RADEON_DISP_TVDAC_SOURCE_CRTC2;
-               WREG32(RADEON_DISP_OUTPUT_CNTL, tmp);
+       if (rdev->flags & RADEON_SINGLE_CRTC) {
+               tmp = crtc_ext_cntl | RADEON_CRTC_CRT_ON;
+               WREG32(RADEON_CRTC_EXT_CNTL, tmp);
        } else {
-               tmp = disp_hw_debug & ~RADEON_CRT2_DISP1_SEL;
-               WREG32(RADEON_DISP_HW_DEBUG, tmp);
+               tmp = crtc2_gen_cntl & ~RADEON_CRTC2_PIX_WIDTH_MASK;
+               tmp |= RADEON_CRTC2_CRT2_ON |
+                       (2 << RADEON_CRTC2_PIX_WIDTH_SHIFT);
+               WREG32(RADEON_CRTC2_GEN_CNTL, tmp);
+
+               if (ASIC_IS_R300(rdev)) {
+                       WREG32_P(RADEON_GPIOPAD_A, 1, ~1);
+                       tmp = disp_output_cntl & ~RADEON_DISP_TVDAC_SOURCE_MASK;
+                       tmp |= RADEON_DISP_TVDAC_SOURCE_CRTC2;
+                       WREG32(RADEON_DISP_OUTPUT_CNTL, tmp);
+               } else {
+                       tmp = disp_hw_debug & ~RADEON_CRT2_DISP1_SEL;
+                       WREG32(RADEON_DISP_HW_DEBUG, tmp);
+               }
        }
 
        tmp = RADEON_TV_DAC_NBLANK |
@@ -1530,14 +1644,19 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder
        WREG32(RADEON_DAC_CNTL2, dac_cntl2);
        WREG32(RADEON_DAC_EXT_CNTL, dac_ext_cntl);
        WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl);
-       WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl);
 
-       if (ASIC_IS_R300(rdev)) {
-               WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl);
-               WREG32_P(RADEON_GPIOPAD_A, gpiopad_a, ~1);
+       if (rdev->flags & RADEON_SINGLE_CRTC) {
+               WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl);
        } else {
-               WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug);
+               WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl);
+               if (ASIC_IS_R300(rdev)) {
+                       WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl);
+                       WREG32_P(RADEON_GPIOPAD_A, gpiopad_a, ~1);
+               } else {
+                       WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug);
+               }
        }
+
        WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl);
 
        return found;
index b0db712060fb3876dfc8f6b92c93acb04bee751a..4422d630b33bc4052ddfdc311ea37944f9d87051 100644 (file)
@@ -2474,6 +2474,7 @@ static bool si_vm_reg_valid(u32 reg)
        /* check config regs */
        switch (reg) {
        case GRBM_GFX_INDEX:
+       case CP_STRMOUT_CNTL:
        case VGT_VTX_VECT_EJECT_REG:
        case VGT_CACHE_INVALIDATION:
        case VGT_ESGS_RING_SIZE:
index 7d2a20e565771366a09124386a3ac513b66f8613..a8871afc5b4e6af2f13599bbed34a2cfd05eec36 100644 (file)
 #       define RDERR_INT_ENABLE                         (1 << 0)
 #       define GUI_IDLE_INT_ENABLE                      (1 << 19)
 
+#define        CP_STRMOUT_CNTL                                 0x84FC
 #define        SCRATCH_REG0                                    0x8500
 #define        SCRATCH_REG1                                    0x8504
 #define        SCRATCH_REG2                                    0x8508
index fccd361f7b50b4e4d4bd072afac3f32869da3da7..87aa5f5d3c88657b8c55055608a65baa271c4c94 100644 (file)
@@ -104,7 +104,7 @@ udl_fb_user_fb_create(struct drm_device *dev,
 
 int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr,
                     const char *front, char **urb_buf_ptr,
-                    u32 byte_offset, u32 byte_width,
+                    u32 byte_offset, u32 device_byte_offset, u32 byte_width,
                     int *ident_ptr, int *sent_ptr);
 
 int udl_dumb_create(struct drm_file *file_priv,
index 69a2b16f42a60284d2d8eecb8ae1fe01fe8e2ced..d4ab3beaada027825d6182a1330b79bd75d220d4 100644 (file)
@@ -114,9 +114,10 @@ static void udlfb_dpy_deferred_io(struct fb_info *info,
        list_for_each_entry(cur, &fbdefio->pagelist, lru) {
 
                if (udl_render_hline(dev, (ufbdev->ufb.base.bits_per_pixel / 8),
-                                 &urb, (char *) info->fix.smem_start,
-                                 &cmd, cur->index << PAGE_SHIFT,
-                                 PAGE_SIZE, &bytes_identical, &bytes_sent))
+                                    &urb, (char *) info->fix.smem_start,
+                                    &cmd, cur->index << PAGE_SHIFT,
+                                    cur->index << PAGE_SHIFT,
+                                    PAGE_SIZE, &bytes_identical, &bytes_sent))
                        goto error;
                bytes_rendered += PAGE_SIZE;
        }
@@ -187,10 +188,11 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
        for (i = y; i < y + height ; i++) {
                const int line_offset = fb->base.pitches[0] * i;
                const int byte_offset = line_offset + (x * bpp);
-
+               const int dev_byte_offset = (fb->base.width * bpp * i) + (x * bpp);
                if (udl_render_hline(dev, bpp, &urb,
                                     (char *) fb->obj->vmapping,
-                                    &cmd, byte_offset, width * bpp,
+                                    &cmd, byte_offset, dev_byte_offset,
+                                    width * bpp,
                                     &bytes_identical, &bytes_sent))
                        goto error;
        }
index dc095526ffb750124573b9c2a9e472a4bbe82101..142fee5f983f9aa36c8fff99b3ddaf4d4eba78cd 100644 (file)
@@ -213,11 +213,12 @@ static void udl_compress_hline16(
  */
 int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr,
                     const char *front, char **urb_buf_ptr,
-                    u32 byte_offset, u32 byte_width,
+                    u32 byte_offset, u32 device_byte_offset,
+                    u32 byte_width,
                     int *ident_ptr, int *sent_ptr)
 {
        const u8 *line_start, *line_end, *next_pixel;
-       u32 base16 = 0 + (byte_offset / bpp) * 2;
+       u32 base16 = 0 + (device_byte_offset / bpp) * 2;
        struct urb *urb = *urb_ptr;
        u8 *cmd = *urb_buf_ptr;
        u8 *cmd_end = (u8 *) urb->transfer_buffer + urb->transfer_buffer_length;
index 3ce68a2e312dbba2e588a3e52595b0d7f060ef44..d1498bfd78732ef519f50d6fea726d502cffd824 100644 (file)
@@ -306,7 +306,7 @@ void vmw_bo_pin(struct ttm_buffer_object *bo, bool pin)
 
        BUG_ON(!atomic_read(&bo->reserved));
        BUG_ON(old_mem_type != TTM_PL_VRAM &&
-              old_mem_type != VMW_PL_FLAG_GMR);
+              old_mem_type != VMW_PL_GMR);
 
        pl_flags = TTM_PL_FLAG_VRAM | VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED;
        if (pin)
index ed3c1e7ddde94cde6db31c1e09b3174364eb9d22..2dd185e42f2129c8492021050e8ba149890cfbfd 100644 (file)
@@ -1098,6 +1098,11 @@ static void vmw_pm_complete(struct device *kdev)
        struct drm_device *dev = pci_get_drvdata(pdev);
        struct vmw_private *dev_priv = vmw_priv(dev);
 
+       mutex_lock(&dev_priv->hw_mutex);
+       vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2);
+       (void) vmw_read(dev_priv, SVGA_REG_ID);
+       mutex_unlock(&dev_priv->hw_mutex);
+
        /**
         * Reclaim 3d reference held by fbdev and potentially
         * start fifo.
index 06ebdbb6ea0207f8d92d691d15c00434f4fab21a..fd7722aecf77929eea158263af6cc1b601287408 100644 (file)
@@ -522,6 +522,12 @@ static const struct hid_device_id apple_devices[] = {
                .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS),
                .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
+       { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI),
+               .driver_data = APPLE_HAS_FN },
+       { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO),
+               .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+       { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS),
+               .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
                .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
index bd3971bf31bf7bc4369911a648b02c8729a3004d..f4109fd657ff7a337761f9029969dde8ee71e3cc 100644 (file)
@@ -1532,6 +1532,9 @@ static const struct hid_device_id hid_have_special_driver[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
@@ -2139,6 +2142,9 @@ static const struct hid_device_id hid_mouse_ignore_list[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
        { }
index 269b50912a4ae9207d1d04f2e014b3c950f20324..9d7a42857ea190a9b9fbc12582582b8ae97ebd2a 100644 (file)
 #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI  0x0252
 #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO   0x0253
 #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS   0x0254
+#define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI  0x0259
+#define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO   0x025a
+#define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS   0x025b
 #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI  0x0249
 #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO   0x024a
 #define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS   0x024b
index 3acdcfcc17df24f696ed7b440f6a29540456e33e..f676c01bb4710e8b786d388fbd453f27d8220a68 100644 (file)
 #define MS_RDESC               0x08
 #define MS_NOGET               0x10
 #define MS_DUPLICATE_USAGES    0x20
+#define MS_RDESC_3K            0x40
 
-/*
- * Microsoft Wireless Desktop Receiver (Model 1028) has
- * 'Usage Min/Max' where it ought to have 'Physical Min/Max'
- */
 static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc,
                unsigned int *rsize)
 {
        unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
 
+       /*
+        * Microsoft Wireless Desktop Receiver (Model 1028) has
+        * 'Usage Min/Max' where it ought to have 'Physical Min/Max'
+        */
        if ((quirks & MS_RDESC) && *rsize == 571 && rdesc[557] == 0x19 &&
                        rdesc[559] == 0x29) {
                hid_info(hdev, "fixing up Microsoft Wireless Receiver Model 1028 report descriptor\n");
                rdesc[557] = 0x35;
                rdesc[559] = 0x45;
        }
+       /* the same as above (s/usage/physical/) */
+       if ((quirks & MS_RDESC_3K) && *rsize == 106 &&
+                       !memcmp((char []){ 0x19, 0x00, 0x29, 0xff },
+                               &rdesc[94], 4)) {
+               rdesc[94] = 0x35;
+               rdesc[96] = 0x45;
+       }
        return rdesc;
 }
 
@@ -192,7 +200,7 @@ static const struct hid_device_id ms_devices[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB),
                .driver_data = MS_PRESENTER },
        { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K),
-               .driver_data = MS_ERGONOMY },
+               .driver_data = MS_ERGONOMY | MS_RDESC_3K },
        { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0),
                .driver_data = MS_NOGET },
        { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500),
index 3eb02b94fc87c8a3bc903474db7c3b55efd5ead5..7867d69f0efe1cd734c57e7e4627eb9aaf7a367e 100644 (file)
@@ -210,8 +210,7 @@ static struct mt_class mt_classes[] = {
        },
        { .name = MT_CLS_GENERALTOUCH_PWT_TENFINGERS,
                .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
-                       MT_QUIRK_SLOT_IS_CONTACTNUMBER,
-               .maxcontacts = 10
+                       MT_QUIRK_SLOT_IS_CONTACTNUMBER
        },
 
        { .name = MT_CLS_FLATFROG,
@@ -421,11 +420,11 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
                         * contact max are global to the report */
                        td->last_field_index = field->index;
                        return -1;
-               }
                case HID_DG_TOUCH:
                        /* Legacy devices use TIPSWITCH and not TOUCH.
                         * Let's just ignore this field. */
                        return -1;
+               }
                /* let hid-input decide for the others */
                return 0;
 
index 17d15bb610d15ac4b544e11af3007cd5b6357fd8..7c47fc3f7b2b0b28f27021c75bb3b8d8f3771c4d 100644 (file)
@@ -42,7 +42,6 @@ static struct cdev hidraw_cdev;
 static struct class *hidraw_class;
 static struct hidraw *hidraw_table[HIDRAW_MAX_DEVICES];
 static DEFINE_MUTEX(minors_lock);
-static void drop_ref(struct hidraw *hid, int exists_bit);
 
 static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
@@ -114,7 +113,7 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer,
        __u8 *buf;
        int ret = 0;
 
-       if (!hidraw_table[minor] || !hidraw_table[minor]->exist) {
+       if (!hidraw_table[minor]) {
                ret = -ENODEV;
                goto out;
        }
@@ -262,7 +261,7 @@ static int hidraw_open(struct inode *inode, struct file *file)
        }
 
        mutex_lock(&minors_lock);
-       if (!hidraw_table[minor] || !hidraw_table[minor]->exist) {
+       if (!hidraw_table[minor]) {
                err = -ENODEV;
                goto out_unlock;
        }
@@ -299,12 +298,36 @@ out:
 static int hidraw_release(struct inode * inode, struct file * file)
 {
        unsigned int minor = iminor(inode);
+       struct hidraw *dev;
        struct hidraw_list *list = file->private_data;
+       int ret;
+       int i;
+
+       mutex_lock(&minors_lock);
+       if (!hidraw_table[minor]) {
+               ret = -ENODEV;
+               goto unlock;
+       }
 
-       drop_ref(hidraw_table[minor], 0);
        list_del(&list->node);
+       dev = hidraw_table[minor];
+       if (!--dev->open) {
+               if (list->hidraw->exist) {
+                       hid_hw_power(dev->hid, PM_HINT_NORMAL);
+                       hid_hw_close(dev->hid);
+               } else {
+                       kfree(list->hidraw);
+               }
+       }
+
+       for (i = 0; i < HIDRAW_BUFFER_SIZE; ++i)
+               kfree(list->buffer[i].value);
        kfree(list);
-       return 0;
+       ret = 0;
+unlock:
+       mutex_unlock(&minors_lock);
+
+       return ret;
 }
 
 static long hidraw_ioctl(struct file *file, unsigned int cmd,
@@ -506,7 +529,21 @@ EXPORT_SYMBOL_GPL(hidraw_connect);
 void hidraw_disconnect(struct hid_device *hid)
 {
        struct hidraw *hidraw = hid->hidraw;
-       drop_ref(hidraw, 1);
+
+       mutex_lock(&minors_lock);
+       hidraw->exist = 0;
+
+       device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
+
+       hidraw_table[hidraw->minor] = NULL;
+
+       if (hidraw->open) {
+               hid_hw_close(hid);
+               wake_up_interruptible(&hidraw->wait);
+       } else {
+               kfree(hidraw);
+       }
+       mutex_unlock(&minors_lock);
 }
 EXPORT_SYMBOL_GPL(hidraw_disconnect);
 
@@ -555,23 +592,3 @@ void hidraw_exit(void)
        unregister_chrdev_region(dev_id, HIDRAW_MAX_DEVICES);
 
 }
-
-static void drop_ref(struct hidraw *hidraw, int exists_bit)
-{
-       mutex_lock(&minors_lock);
-       if (exists_bit) {
-               hid_hw_close(hidraw->hid);
-               hidraw->exist = 0;
-               if (hidraw->open)
-                       wake_up_interruptible(&hidraw->wait);
-       } else {
-               --hidraw->open;
-       }
-
-       if (!hidraw->open && !hidraw->exist) {
-               device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
-               hidraw_table[hidraw->minor] = NULL;
-               kfree(hidraw);
-       }
-       mutex_unlock(&minors_lock);
-}
index a227be47149f473bfd6fc2d41a8de99f842056fd..520e5bf4f76d9f8cd1b16edf5610554fde103181 100644 (file)
@@ -32,7 +32,7 @@
  * ASB100-A supports pwm1, while plain ASB100 does not.  There is no known
  * way for the driver to tell which one is there.
  *
- * Chip        #vin    #fanin  #pwm    #temp   wchipid vendid  i2c     ISA
+ * Chip                #vin    #fanin  #pwm    #temp   wchipid vendid  i2c     ISA
  * asb100      7       3       1       4       0x31    0x0694  yes     no
  */
 
index 68ad7d2555124a45f2d9008374d973d4b6de3b04..4f4110407387fce21c4e58cdc76dfec6093b6183 100644 (file)
@@ -2,7 +2,7 @@
  * fam15h_power.c - AMD Family 15h processor power monitoring
  *
  * Copyright (c) 2011 Advanced Micro Devices, Inc.
- * Author: Andreas Herrmann <andreas.herrmann3@amd.com>
+ * Author: Andreas Herrmann <herrmann.der.user@googlemail.com>
  *
  *
  * This driver is free software; you can redistribute it and/or
@@ -28,7 +28,7 @@
 #include <asm/processor.h>
 
 MODULE_DESCRIPTION("AMD Family 15h CPU processor power monitor");
-MODULE_AUTHOR("Andreas Herrmann <andreas.herrmann3@amd.com>");
+MODULE_AUTHOR("Andreas Herrmann <herrmann.der.user@googlemail.com>");
 MODULE_LICENSE("GPL");
 
 /* D18F3 */
index 36509ae32083d2b3e48ec894768c504e1179577c..1381a2e3bbd4dc09dca9e74c87dd4ad2ce5ebc50 100644 (file)
@@ -630,7 +630,9 @@ static struct platform_driver gpio_fan_driver = {
        .driver = {
                .name   = "gpio-fan",
                .pm     = GPIO_FAN_PM,
+#ifdef CONFIG_OF_GPIO
                .of_match_table = of_match_ptr(of_gpio_fan_match),
+#endif
        },
 };
 
index 1821b7423d5b77ae5a9e6cdd2794a7e1b9a2c173..de3c7e04c3b5b21ae095f6f91308d1fb97eb6e64 100644 (file)
@@ -2083,6 +2083,7 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
        mutex_init(&data->lock);
        mutex_init(&data->update_lock);
        data->name = w83627ehf_device_names[sio_data->kind];
+       data->bank = 0xff;              /* Force initial bank selection */
        platform_set_drvdata(pdev, data);
 
        /* 627EHG and 627EHF have 10 voltage inputs; 627DHG and 667HG have 9 */
index 5b1a6a666441f242ac63f21d9b9359464ced3f97..af15899087095044c623b4ddf0aeadbb15ed8801 100644 (file)
@@ -25,7 +25,7 @@
 /*
  * Supports following chips:
  *
- * Chip        #vin    #fanin  #pwm    #temp   wchipid vendid  i2c     ISA
+ * Chip                #vin    #fanin  #pwm    #temp   wchipid vendid  i2c     ISA
  * w83627hf    9       3       2       3       0x20    0x5ca3  no      yes(LPC)
  * w83627thf   7       3       3       3       0x90    0x5ca3  no      yes(LPC)
  * w83637hf    7       3       3       3       0x80    0x5ca3  no      yes(LPC)
index 5a5046d94c3eee8288cf5871655fffa973d97977..20f11d31da407f5545af8b7082187c518721522a 100644 (file)
@@ -24,7 +24,7 @@
 /*
  * Supports following chips:
  *
- * Chip        #vin    #fanin  #pwm    #temp   wchipid vendid  i2c     ISA
+ * Chip                #vin    #fanin  #pwm    #temp   wchipid vendid  i2c     ISA
  * as99127f    7       3       0       3       0x31    0x12c3  yes     no
  * as99127f rev.2 (type_name = as99127f)       0x31    0x5ca3  yes     no
  * w83781d     7       3       0       3       0x10-1  0x5ca3  yes     yes
index 39ab7bcc616e7a9e8733ce9bbbcc7e3cf6b0b970..ed397c6451983473b9ca7d1dbac399194a746fb3 100644 (file)
@@ -22,7 +22,7 @@
 /*
  * Supports following chips:
  *
- * Chip        #vin    #fanin  #pwm    #temp   wchipid vendid  i2c     ISA
+ * Chip                #vin    #fanin  #pwm    #temp   wchipid vendid  i2c     ISA
  * w83791d     10      5       5       3       0x71    0x5ca3  yes     no
  *
  * The w83791d chip appears to be part way between the 83781d and the
index 053645279f381b453396053dfb71294346604717..301942d084534ef748f1917b1fa3dccde1b8beed 100644 (file)
@@ -31,7 +31,7 @@
 /*
  * Supports following chips:
  *
- * Chip        #vin    #fanin  #pwm    #temp   wchipid vendid  i2c     ISA
+ * Chip                #vin    #fanin  #pwm    #temp   wchipid vendid  i2c     ISA
  * w83792d     9       7       7       3       0x7a    0x5ca3  yes     no
  */
 
index f0e8286c3c70ed7c1c2a57a73b19cc06fec8a193..79710bcac2f724233746b9c416fd53384dd52e52 100644 (file)
@@ -20,7 +20,7 @@
 /*
  * Supports following chips:
  *
- * Chip        #vin    #fanin  #pwm    #temp   wchipid vendid  i2c     ISA
+ * Chip                #vin    #fanin  #pwm    #temp   wchipid vendid  i2c     ISA
  * w83l786ng   3       2       2       2       0x7b    0x5ca3  yes     no
  */
 
index beee6b2d361db458a1336a48bd13b5166d6d013c..1722f50f247385e0247c98e5dee91c97f18203ee 100644 (file)
@@ -8,6 +8,7 @@ obj-$(CONFIG_I2C_SMBUS)         += i2c-smbus.o
 obj-$(CONFIG_I2C_CHARDEV)      += i2c-dev.o
 obj-$(CONFIG_I2C_MUX)          += i2c-mux.o
 obj-y                          += algos/ busses/ muxes/
+obj-$(CONFIG_I2C_STUB)         += i2c-stub.o
 
 ccflags-$(CONFIG_I2C_DEBUG_CORE) := -DDEBUG
 CFLAGS_i2c-core.o := -Wno-deprecated-declarations
index 65dd599a02620211b8db7a1ef6bfd1d8f9cdda30..e9df4612b7ebc9710db24290b159b4bd77d5d625 100644 (file)
@@ -81,7 +81,6 @@ config I2C_I801
        tristate "Intel 82801 (ICH/PCH)"
        depends on PCI
        select CHECK_SIGNATURE if X86 && DMI
-       select GPIOLIB if I2C_MUX
        help
          If you say yes to this option, support will be included for the Intel
          801 family of mainboard I2C interfaces.  Specifically, the following
index 2d33d62952c112adfb62bde5f08a342a37466c78..395b516ffa08cddbf5fdc2cbc5e2c34a558e356c 100644 (file)
@@ -85,7 +85,6 @@ obj-$(CONFIG_I2C_ACORN)               += i2c-acorn.o
 obj-$(CONFIG_I2C_ELEKTOR)      += i2c-elektor.o
 obj-$(CONFIG_I2C_PCA_ISA)      += i2c-pca-isa.o
 obj-$(CONFIG_I2C_SIBYTE)       += i2c-sibyte.o
-obj-$(CONFIG_I2C_STUB)         += i2c-stub.o
 obj-$(CONFIG_SCx200_ACB)       += scx200_acb.o
 obj-$(CONFIG_SCx200_I2C)       += scx200_i2c.o
 
index 37793156bd936202a10362e7910d88708c4a9248..6abc00d59881c921e14ab460f8bb477995c4ea44 100644 (file)
@@ -82,7 +82,8 @@
 #include <linux/wait.h>
 #include <linux/err.h>
 
-#if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE
+#if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \
+               defined CONFIG_DMI
 #include <linux/gpio.h>
 #include <linux/i2c-mux-gpio.h>
 #include <linux/platform_device.h>
@@ -192,7 +193,8 @@ struct i801_priv {
        int len;
        u8 *data;
 
-#if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE
+#if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \
+               defined CONFIG_DMI
        const struct i801_mux_config *mux_drvdata;
        struct platform_device *mux_pdev;
 #endif
@@ -921,7 +923,8 @@ static void __init input_apanel_init(void) {}
 static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {}
 #endif /* CONFIG_X86 && CONFIG_DMI */
 
-#if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE
+#if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \
+               defined CONFIG_DMI
 static struct i801_mux_config i801_mux_config_asus_z8_d12 = {
        .gpio_chip = "gpio_ich",
        .values = { 0x02, 0x03 },
@@ -1059,7 +1062,7 @@ static unsigned int __devinit i801_get_adapter_class(struct i801_priv *priv)
 
        id = dmi_first_match(mux_dmi_table);
        if (id) {
-               /* Remove from branch classes from trunk */
+               /* Remove branch classes from trunk */
                mux_config = id->driver_data;
                for (i = 0; i < mux_config->n_values; i++)
                        class &= ~mux_config->classes[i];
index 2ef162d148cbacbc63269bf89774c81aba34983c..b9734747d61080ffa16be81eb7c996f5a163bece 100644 (file)
@@ -52,8 +52,6 @@
 #include <linux/of_device.h>
 #include <linux/of_i2c.h>
 #include <linux/pinctrl/consumer.h>
-
-#include <mach/hardware.h>
 #include <linux/platform_data/i2c-imx.h>
 
 /** Defines ********************************************************************
@@ -115,6 +113,11 @@ static u16 __initdata i2c_clk_div[50][2] = {
        { 3072, 0x1E }, { 3840, 0x1F }
 };
 
+enum imx_i2c_type {
+       IMX1_I2C,
+       IMX21_I2C,
+};
+
 struct imx_i2c_struct {
        struct i2c_adapter      adapter;
        struct clk              *clk;
@@ -124,13 +127,33 @@ struct imx_i2c_struct {
        unsigned int            disable_delay;
        int                     stopped;
        unsigned int            ifdr; /* IMX_I2C_IFDR */
+       enum imx_i2c_type       devtype;
+};
+
+static struct platform_device_id imx_i2c_devtype[] = {
+       {
+               .name = "imx1-i2c",
+               .driver_data = IMX1_I2C,
+       }, {
+               .name = "imx21-i2c",
+               .driver_data = IMX21_I2C,
+       }, {
+               /* sentinel */
+       }
 };
+MODULE_DEVICE_TABLE(platform, imx_i2c_devtype);
 
 static const struct of_device_id i2c_imx_dt_ids[] = {
-       { .compatible = "fsl,imx1-i2c", },
+       { .compatible = "fsl,imx1-i2c", .data = &imx_i2c_devtype[IMX1_I2C], },
+       { .compatible = "fsl,imx21-i2c", .data = &imx_i2c_devtype[IMX21_I2C], },
        { /* sentinel */ }
 };
 
+static inline int is_imx1_i2c(struct imx_i2c_struct *i2c_imx)
+{
+       return i2c_imx->devtype == IMX1_I2C;
+}
+
 /** Functions for IMX I2C adapter driver ***************************************
 *******************************************************************************/
 
@@ -223,7 +246,7 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
                temp &= ~(I2CR_MSTA | I2CR_MTX);
                writeb(temp, i2c_imx->base + IMX_I2C_I2CR);
        }
-       if (cpu_is_mx1()) {
+       if (is_imx1_i2c(i2c_imx)) {
                /*
                 * This delay caused by an i.MXL hardware bug.
                 * If no (or too short) delay, no "STOP" bit will be generated.
@@ -465,6 +488,8 @@ static struct i2c_algorithm i2c_imx_algo = {
 
 static int __init i2c_imx_probe(struct platform_device *pdev)
 {
+       const struct of_device_id *of_id = of_match_device(i2c_imx_dt_ids,
+                                                          &pdev->dev);
        struct imx_i2c_struct *i2c_imx;
        struct resource *res;
        struct imxi2c_platform_data *pdata = pdev->dev.platform_data;
@@ -497,6 +522,10 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
                return -ENOMEM;
        }
 
+       if (of_id)
+               pdev->id_entry = of_id->data;
+       i2c_imx->devtype = pdev->id_entry->driver_data;
+
        /* Setup i2c_imx driver structure */
        strlcpy(i2c_imx->adapter.name, pdev->name, sizeof(i2c_imx->adapter.name));
        i2c_imx->adapter.owner          = THIS_MODULE;
@@ -593,7 +622,8 @@ static struct platform_driver i2c_imx_driver = {
                .name   = DRIVER_NAME,
                .owner  = THIS_MODULE,
                .of_match_table = i2c_imx_dt_ids,
-       }
+       },
+       .id_table       = imx_i2c_devtype,
 };
 
 static int __init i2c_adap_imx_init(void)
index 1f58197062cfe120b8987236044afbeec5e397df..286ca191782098fe44f8a9c995b0015e2e3693ef 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Freescale MXS I2C bus driver
  *
- * Copyright (C) 2011 Wolfram Sang, Pengutronix e.K.
+ * Copyright (C) 2011-2012 Wolfram Sang, Pengutronix e.K.
  *
  * based on a (non-working) driver which was:
  *
 
 #define DRIVER_NAME "mxs-i2c"
 
-static bool use_pioqueue;
-module_param(use_pioqueue, bool, 0);
-MODULE_PARM_DESC(use_pioqueue, "Use PIOQUEUE mode for transfer instead of DMA");
-
 #define MXS_I2C_CTRL0          (0x00)
 #define MXS_I2C_CTRL0_SET      (0x04)
 
@@ -75,23 +71,6 @@ MODULE_PARM_DESC(use_pioqueue, "Use PIOQUEUE mode for transfer instead of DMA");
                                 MXS_I2C_CTRL1_SLAVE_STOP_IRQ | \
                                 MXS_I2C_CTRL1_SLAVE_IRQ)
 
-#define MXS_I2C_QUEUECTRL      (0x60)
-#define MXS_I2C_QUEUECTRL_SET  (0x64)
-#define MXS_I2C_QUEUECTRL_CLR  (0x68)
-
-#define MXS_I2C_QUEUECTRL_QUEUE_RUN            0x20
-#define MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE       0x04
-
-#define MXS_I2C_QUEUESTAT      (0x70)
-#define MXS_I2C_QUEUESTAT_RD_QUEUE_EMPTY        0x00002000
-#define MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK 0x0000001F
-
-#define MXS_I2C_QUEUECMD       (0x80)
-
-#define MXS_I2C_QUEUEDATA      (0x90)
-
-#define MXS_I2C_DATA           (0xa0)
-
 
 #define MXS_CMD_I2C_SELECT     (MXS_I2C_CTRL0_RETAIN_CLOCK |   \
                                 MXS_I2C_CTRL0_PRE_SEND_START | \
@@ -153,7 +132,6 @@ struct mxs_i2c_dev {
        const struct mxs_i2c_speed_config *speed;
 
        /* DMA support components */
-       bool                            dma_mode;
        int                             dma_channel;
        struct dma_chan                 *dmach;
        struct mxs_dma_data             dma_data;
@@ -172,99 +150,6 @@ static void mxs_i2c_reset(struct mxs_i2c_dev *i2c)
        writel(i2c->speed->timing2, i2c->regs + MXS_I2C_TIMING2);
 
        writel(MXS_I2C_IRQ_MASK << 8, i2c->regs + MXS_I2C_CTRL1_SET);
-       if (i2c->dma_mode)
-               writel(MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE,
-                       i2c->regs + MXS_I2C_QUEUECTRL_CLR);
-       else
-               writel(MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE,
-                       i2c->regs + MXS_I2C_QUEUECTRL_SET);
-}
-
-static void mxs_i2c_pioq_setup_read(struct mxs_i2c_dev *i2c, u8 addr, int len,
-                                       int flags)
-{
-       u32 data;
-
-       writel(MXS_CMD_I2C_SELECT, i2c->regs + MXS_I2C_QUEUECMD);
-
-       data = (addr << 1) | I2C_SMBUS_READ;
-       writel(data, i2c->regs + MXS_I2C_DATA);
-
-       data = MXS_CMD_I2C_READ | MXS_I2C_CTRL0_XFER_COUNT(len) | flags;
-       writel(data, i2c->regs + MXS_I2C_QUEUECMD);
-}
-
-static void mxs_i2c_pioq_setup_write(struct mxs_i2c_dev *i2c,
-                                   u8 addr, u8 *buf, int len, int flags)
-{
-       u32 data;
-       int i, shifts_left;
-
-       data = MXS_CMD_I2C_WRITE | MXS_I2C_CTRL0_XFER_COUNT(len + 1) | flags;
-       writel(data, i2c->regs + MXS_I2C_QUEUECMD);
-
-       /*
-        * We have to copy the slave address (u8) and buffer (arbitrary number
-        * of u8) into the data register (u32). To achieve that, the u8 are put
-        * into the MSBs of 'data' which is then shifted for the next u8. When
-        * appropriate, 'data' is written to MXS_I2C_DATA. So, the first u32
-        * looks like this:
-        *
-        *  3          2          1          0
-        * 10987654|32109876|54321098|76543210
-        * --------+--------+--------+--------
-        * buffer+2|buffer+1|buffer+0|slave_addr
-        */
-
-       data = ((addr << 1) | I2C_SMBUS_WRITE) << 24;
-
-       for (i = 0; i < len; i++) {
-               data >>= 8;
-               data |= buf[i] << 24;
-               if ((i & 3) == 2)
-                       writel(data, i2c->regs + MXS_I2C_DATA);
-       }
-
-       /* Write out the remaining bytes if any */
-       shifts_left = 24 - (i & 3) * 8;
-       if (shifts_left)
-               writel(data >> shifts_left, i2c->regs + MXS_I2C_DATA);
-}
-
-/*
- * TODO: should be replaceable with a waitqueue and RD_QUEUE_IRQ (setting the
- * rd_threshold to 1). Couldn't get this to work, though.
- */
-static int mxs_i2c_wait_for_data(struct mxs_i2c_dev *i2c)
-{
-       unsigned long timeout = jiffies + msecs_to_jiffies(1000);
-
-       while (readl(i2c->regs + MXS_I2C_QUEUESTAT)
-                       & MXS_I2C_QUEUESTAT_RD_QUEUE_EMPTY) {
-                       if (time_after(jiffies, timeout))
-                               return -ETIMEDOUT;
-                       cond_resched();
-       }
-
-       return 0;
-}
-
-static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf, int len)
-{
-       u32 uninitialized_var(data);
-       int i;
-
-       for (i = 0; i < len; i++) {
-               if ((i & 3) == 0) {
-                       if (mxs_i2c_wait_for_data(i2c))
-                               return -ETIMEDOUT;
-                       data = readl(i2c->regs + MXS_I2C_QUEUEDATA);
-               }
-               buf[i] = data & 0xff;
-               data >>= 8;
-       }
-
-       return 0;
 }
 
 static void mxs_i2c_dma_finish(struct mxs_i2c_dev *i2c)
@@ -432,39 +317,17 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg,
        init_completion(&i2c->cmd_complete);
        i2c->cmd_err = 0;
 
-       if (i2c->dma_mode) {
-               ret = mxs_i2c_dma_setup_xfer(adap, msg, flags);
-               if (ret)
-                       return ret;
-       } else {
-               if (msg->flags & I2C_M_RD) {
-                       mxs_i2c_pioq_setup_read(i2c, msg->addr,
-                                               msg->len, flags);
-               } else {
-                       mxs_i2c_pioq_setup_write(i2c, msg->addr, msg->buf,
-                                               msg->len, flags);
-               }
-
-               writel(MXS_I2C_QUEUECTRL_QUEUE_RUN,
-                       i2c->regs + MXS_I2C_QUEUECTRL_SET);
-       }
+       ret = mxs_i2c_dma_setup_xfer(adap, msg, flags);
+       if (ret)
+               return ret;
 
        ret = wait_for_completion_timeout(&i2c->cmd_complete,
                                                msecs_to_jiffies(1000));
        if (ret == 0)
                goto timeout;
 
-       if (!i2c->dma_mode && !i2c->cmd_err && (msg->flags & I2C_M_RD)) {
-               ret = mxs_i2c_finish_read(i2c, msg->buf, msg->len);
-               if (ret)
-                       goto timeout;
-       }
-
        if (i2c->cmd_err == -ENXIO)
                mxs_i2c_reset(i2c);
-       else
-               writel(MXS_I2C_QUEUECTRL_QUEUE_RUN,
-                               i2c->regs + MXS_I2C_QUEUECTRL_CLR);
 
        dev_dbg(i2c->dev, "Done with err=%d\n", i2c->cmd_err);
 
@@ -472,8 +335,7 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg,
 
 timeout:
        dev_dbg(i2c->dev, "Timeout!\n");
-       if (i2c->dma_mode)
-               mxs_i2c_dma_finish(i2c);
+       mxs_i2c_dma_finish(i2c);
        mxs_i2c_reset(i2c);
        return -ETIMEDOUT;
 }
@@ -502,7 +364,6 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id)
 {
        struct mxs_i2c_dev *i2c = dev_id;
        u32 stat = readl(i2c->regs + MXS_I2C_CTRL1) & MXS_I2C_IRQ_MASK;
-       bool is_last_cmd;
 
        if (!stat)
                return IRQ_NONE;
@@ -515,14 +376,6 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id)
                /* MXS_I2C_CTRL1_OVERSIZE_XFER_TERM_IRQ is only for slaves */
                i2c->cmd_err = -EIO;
 
-       if (!i2c->dma_mode) {
-               is_last_cmd = (readl(i2c->regs + MXS_I2C_QUEUESTAT) &
-                       MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK) == 0;
-
-               if (is_last_cmd || i2c->cmd_err)
-                       complete(&i2c->cmd_complete);
-       }
-
        writel(stat, i2c->regs + MXS_I2C_CTRL1_CLR);
 
        return IRQ_HANDLED;
@@ -555,15 +408,6 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c)
        struct device_node *node = dev->of_node;
        int ret;
 
-       /*
-        * The MXS I2C DMA mode is prefered and enabled by default.
-        * The PIO mode is still supported, but should be used only
-        * for debuging purposes etc.
-        */
-       i2c->dma_mode = !use_pioqueue;
-       if (!i2c->dma_mode)
-               dev_info(dev, "Using PIOQUEUE mode for I2C transfers!\n");
-
        /*
         * TODO: This is a temporary solution and should be changed
         * to use generic DMA binding later when the helpers get in.
@@ -571,8 +415,8 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c)
        ret = of_property_read_u32(node, "fsl,i2c-dma-channel",
                                   &i2c->dma_channel);
        if (ret) {
-               dev_warn(dev, "Failed to get DMA channel, using PIOQUEUE!\n");
-               i2c->dma_mode = 0;
+               dev_err(dev, "Failed to get DMA channel!\n");
+               return -ENODEV;
        }
 
        ret = of_property_read_u32(node, "clock-frequency", &speed);
@@ -634,15 +478,13 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
        }
 
        /* Setup the DMA */
-       if (i2c->dma_mode) {
-               dma_cap_zero(mask);
-               dma_cap_set(DMA_SLAVE, mask);
-               i2c->dma_data.chan_irq = dmairq;
-               i2c->dmach = dma_request_channel(mask, mxs_i2c_dma_filter, i2c);
-               if (!i2c->dmach) {
-                       dev_err(dev, "Failed to request dma\n");
-                       return -ENODEV;
-               }
+       dma_cap_zero(mask);
+       dma_cap_set(DMA_SLAVE, mask);
+       i2c->dma_data.chan_irq = dmairq;
+       i2c->dmach = dma_request_channel(mask, mxs_i2c_dma_filter, i2c);
+       if (!i2c->dmach) {
+               dev_err(dev, "Failed to request dma\n");
+               return -ENODEV;
        }
 
        platform_set_drvdata(pdev, i2c);
index 698d7acb0f083c10ea2028ad895e58043105f44e..02c3115a2dfa11c0aecf5a5c7e6bc24566539c8b 100644 (file)
@@ -644,7 +644,11 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap,
 
        pm_runtime_get_sync(&dev->adev->dev);
 
-       clk_enable(dev->clk);
+       status = clk_prepare_enable(dev->clk);
+       if (status) {
+               dev_err(&dev->adev->dev, "can't prepare_enable clock\n");
+               goto out_clk;
+       }
 
        status = init_hw(dev);
        if (status)
@@ -671,7 +675,8 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap,
        }
 
 out:
-       clk_disable(dev->clk);
+       clk_disable_unprepare(dev->clk);
+out_clk:
        pm_runtime_put_sync(&dev->adev->dev);
 
        dev->busy = false;
index f981ac4e6783104ee8586e2631fc58f788d49be6..dcea77bf6f50ff2cc1c198e7850bbbe138128238 100644 (file)
@@ -742,7 +742,7 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
        }
 
        ret = devm_request_irq(&pdev->dev, i2c_dev->irq,
-                       tegra_i2c_isr, 0, pdev->name, i2c_dev);
+                       tegra_i2c_isr, 0, dev_name(&pdev->dev), i2c_dev);
        if (ret) {
                dev_err(&pdev->dev, "Failed to request irq %i\n", i2c_dev->irq);
                return ret;
similarity index 75%
rename from drivers/i2c/busses/i2c-stub.c
rename to drivers/i2c/i2c-stub.c
index b1b3447942c9efd42c30ed7a9e271f00268db127..d0a9c590c3cd4708937c924afe9f6759602948f0 100644 (file)
@@ -2,7 +2,7 @@
     i2c-stub.c - I2C/SMBus chip emulator
 
     Copyright (c) 2004 Mark M. Hoffman <mhoffman@lightlink.com>
-    Copyright (C) 2007 Jean Delvare <khali@linux-fr.org>
+    Copyright (C) 2007, 2012 Jean Delvare <khali@linux-fr.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
@@ -51,8 +51,8 @@ struct stub_chip {
 static struct stub_chip *stub_chips;
 
 /* Return negative errno on error. */
-static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags,
-       char read_write, u8 command, int size, union i2c_smbus_data * data)
+static s32 stub_xfer(struct i2c_adapter *adap, u16 addr, unsigned short flags,
+       char read_write, u8 command, int size, union i2c_smbus_data *data)
 {
        s32 ret;
        int i, len;
@@ -78,14 +78,14 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags,
        case I2C_SMBUS_BYTE:
                if (read_write == I2C_SMBUS_WRITE) {
                        chip->pointer = command;
-                       dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, "
-                                       "wrote 0x%02x.\n",
-                                       addr, command);
+                       dev_dbg(&adap->dev,
+                               "smbus byte - addr 0x%02x, wrote 0x%02x.\n",
+                               addr, command);
                } else {
                        data->byte = chip->words[chip->pointer++] & 0xff;
-                       dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, "
-                                       "read  0x%02x.\n",
-                                       addr, data->byte);
+                       dev_dbg(&adap->dev,
+                               "smbus byte - addr 0x%02x, read  0x%02x.\n",
+                               addr, data->byte);
                }
 
                ret = 0;
@@ -95,14 +95,14 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags,
                if (read_write == I2C_SMBUS_WRITE) {
                        chip->words[command] &= 0xff00;
                        chip->words[command] |= data->byte;
-                       dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, "
-                                       "wrote 0x%02x at 0x%02x.\n",
-                                       addr, data->byte, command);
+                       dev_dbg(&adap->dev,
+                               "smbus byte data - addr 0x%02x, wrote 0x%02x at 0x%02x.\n",
+                               addr, data->byte, command);
                } else {
                        data->byte = chip->words[command] & 0xff;
-                       dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, "
-                                       "read  0x%02x at 0x%02x.\n",
-                                       addr, data->byte, command);
+                       dev_dbg(&adap->dev,
+                               "smbus byte data - addr 0x%02x, read  0x%02x at 0x%02x.\n",
+                               addr, data->byte, command);
                }
                chip->pointer = command + 1;
 
@@ -112,14 +112,14 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags,
        case I2C_SMBUS_WORD_DATA:
                if (read_write == I2C_SMBUS_WRITE) {
                        chip->words[command] = data->word;
-                       dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, "
-                                       "wrote 0x%04x at 0x%02x.\n",
-                                       addr, data->word, command);
+                       dev_dbg(&adap->dev,
+                               "smbus word data - addr 0x%02x, wrote 0x%04x at 0x%02x.\n",
+                               addr, data->word, command);
                } else {
                        data->word = chip->words[command];
-                       dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, "
-                                       "read  0x%04x at 0x%02x.\n",
-                                       addr, data->word, command);
+                       dev_dbg(&adap->dev,
+                               "smbus word data - addr 0x%02x, read  0x%04x at 0x%02x.\n",
+                               addr, data->word, command);
                }
 
                ret = 0;
@@ -132,17 +132,17 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags,
                                chip->words[command + i] &= 0xff00;
                                chip->words[command + i] |= data->block[1 + i];
                        }
-                       dev_dbg(&adap->dev, "i2c block data - addr 0x%02x, "
-                                       "wrote %d bytes at 0x%02x.\n",
-                                       addr, len, command);
+                       dev_dbg(&adap->dev,
+                               "i2c block data - addr 0x%02x, wrote %d bytes at 0x%02x.\n",
+                               addr, len, command);
                } else {
                        for (i = 0; i < len; i++) {
                                data->block[1 + i] =
                                        chip->words[command + i] & 0xff;
                        }
-                       dev_dbg(&adap->dev, "i2c block data - addr 0x%02x, "
-                                       "read  %d bytes at 0x%02x.\n",
-                                       addr, len, command);
+                       dev_dbg(&adap->dev,
+                               "i2c block data - addr 0x%02x, read  %d bytes at 0x%02x.\n",
+                               addr, len, command);
                }
 
                ret = 0;
@@ -179,25 +179,24 @@ static int __init i2c_stub_init(void)
        int i, ret;
 
        if (!chip_addr[0]) {
-               printk(KERN_ERR "i2c-stub: Please specify a chip address\n");
+               pr_err("i2c-stub: Please specify a chip address\n");
                return -ENODEV;
        }
 
        for (i = 0; i < MAX_CHIPS && chip_addr[i]; i++) {
                if (chip_addr[i] < 0x03 || chip_addr[i] > 0x77) {
-                       printk(KERN_ERR "i2c-stub: Invalid chip address "
-                              "0x%02x\n", chip_addr[i]);
+                       pr_err("i2c-stub: Invalid chip address 0x%02x\n",
+                              chip_addr[i]);
                        return -EINVAL;
                }
 
-               printk(KERN_INFO "i2c-stub: Virtual chip at 0x%02x\n",
-                      chip_addr[i]);
+               pr_info("i2c-stub: Virtual chip at 0x%02x\n", chip_addr[i]);
        }
 
        /* Allocate memory for all chips at once */
        stub_chips = kzalloc(i * sizeof(struct stub_chip), GFP_KERNEL);
        if (!stub_chips) {
-               printk(KERN_ERR "i2c-stub: Out of memory\n");
+               pr_err("i2c-stub: Out of memory\n");
                return -ENOMEM;
        }
 
@@ -219,4 +218,3 @@ MODULE_LICENSE("GPL");
 
 module_init(i2c_stub_init);
 module_exit(i2c_stub_exit);
-
index b4b65af8612a3f03a79ea19422873cd777f39b76..de0874054e9faebde97690fdb23986d268cbf95d 100644 (file)
@@ -335,6 +335,7 @@ config KEYBOARD_LOCOMO
 config KEYBOARD_LPC32XX
        tristate "LPC32XX matrix key scanner support"
        depends on ARCH_LPC32XX && OF
+       select INPUT_MATRIXKMAP
        help
          Say Y here if you want to use NXP LPC32XX SoC key scanner interface,
          connected to a key matrix.
index 803ff6fe021ec001393a5a9844dd825cbcb6235d..cad9d5dd597330b2eaa523b046f33edddb3641bb 100644 (file)
@@ -368,6 +368,9 @@ static void pxa27x_keypad_config(struct pxa27x_keypad *keypad)
        unsigned int mask = 0, direct_key_num = 0;
        unsigned long kpc = 0;
 
+       /* clear pending interrupt bit */
+       keypad_readl(KPC);
+
        /* enable matrix keys with automatic scan */
        if (pdata->matrix_key_rows && pdata->matrix_key_cols) {
                kpc |= KPC_ASACT | KPC_MIE | KPC_ME | KPC_MS_ALL;
index 02ca8680ea5b8f68393cecc3925792fc74236614..6f7d99013031b66f16d2c4e25f06dd3c352a622c 100644 (file)
@@ -311,7 +311,6 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
        case XenbusStateReconfiguring:
        case XenbusStateReconfigured:
        case XenbusStateUnknown:
-       case XenbusStateClosed:
                break;
 
        case XenbusStateInitWait:
@@ -350,6 +349,10 @@ InitWait:
 
                break;
 
+       case XenbusStateClosed:
+               if (dev->state == XenbusStateClosed)
+                       break;
+               /* Missed the backend's CLOSING state -- fallthrough */
        case XenbusStateClosing:
                xenbus_frontend_closed(dev);
                break;
index 3a78f235fa3e70b8057b929a2c4e2e763141cd9f..2baff1b79a5596eb33eaaaa31577c193d80f099e 100644 (file)
 #define USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI   0x0262
 #define USB_DEVICE_ID_APPLE_WELLSPRING7_ISO    0x0263
 #define USB_DEVICE_ID_APPLE_WELLSPRING7_JIS    0x0264
+/* MacbookPro10,2 (unibody, October 2012) */
+#define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI  0x0259
+#define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO   0x025a
+#define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS   0x025b
 
 #define BCM5974_DEVICE(prod) {                                 \
        .match_flags = (USB_DEVICE_ID_MATCH_DEVICE |            \
@@ -137,6 +141,10 @@ static const struct usb_device_id bcm5974_table[] = {
        BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI),
        BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ISO),
        BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_JIS),
+       /* MacbookPro10,2 */
+       BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI),
+       BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO),
+       BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS),
        /* Terminating entry */
        {}
 };
@@ -379,6 +387,19 @@ static const struct bcm5974_config bcm5974_config_table[] = {
                { SN_COORD, -150, 6730 },
                { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
        },
+       {
+               USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI,
+               USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO,
+               USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS,
+               HAS_INTEGRATED_BUTTON,
+               0x84, sizeof(struct bt_data),
+               0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
+               { SN_PRESSURE, 0, 300 },
+               { SN_WIDTH, 0, 2048 },
+               { SN_COORD, -4750, 5280 },
+               { SN_COORD, -150, 6730 },
+               { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
+       },
        {}
 };
 
index 2c1e12bf2ab424e87f49ed14e57e9b9125aa9831..858ad446de91b338553d6577bb6d1ac886c1fbb5 100644 (file)
@@ -391,7 +391,7 @@ static int wacom_parse_hid(struct usb_interface *intf,
                                                        features->pktlen = WACOM_PKGLEN_TPC2FG;
                                                }
 
-                                               if (features->type == MTSCREEN || WACOM_24HDT)
+                                               if (features->type == MTSCREEN || features->type == WACOM_24HDT)
                                                        features->pktlen = WACOM_PKGLEN_MTOUCH;
 
                                                if (features->type == BAMBOO_PT) {
index aa6010131179588bb75ea3326843df499db7aaf1..0a67031ffc131a2559d6573d5c3cf65173edd9c6 100644 (file)
@@ -1518,6 +1518,9 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
 
                input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
                input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0);
+
+               __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
+
                wacom_setup_cintiq(wacom_wac);
                break;
 
index 1ba232cbc09d4e8744e1a827c3939ad7292e85a6..f7668b24c378aeed3b4ca4fc1c09d025255eccc1 100644 (file)
@@ -239,7 +239,7 @@ config TOUCHSCREEN_EETI
 
 config TOUCHSCREEN_EGALAX
        tristate "EETI eGalax multi-touch panel support"
-       depends on I2C
+       depends on I2C && OF
        help
          Say Y here to enable support for I2C connected EETI
          eGalax multi-touch panels.
index c1e3460f1195aed3953c0e09542c9718d8664421..13fa62fdfb0b4160f76484bd2aadc92151597ab8 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/slab.h>
 #include <linux/bitops.h>
 #include <linux/input/mt.h>
+#include <linux/of_gpio.h>
 
 /*
  * Mouse Mode: some panel may configure the controller to mouse mode,
@@ -122,9 +123,17 @@ static irqreturn_t egalax_ts_interrupt(int irq, void *dev_id)
 /* wake up controller by an falling edge of interrupt gpio.  */
 static int egalax_wake_up_device(struct i2c_client *client)
 {
-       int gpio = irq_to_gpio(client->irq);
+       struct device_node *np = client->dev.of_node;
+       int gpio;
        int ret;
 
+       if (!np)
+               return -ENODEV;
+
+       gpio = of_get_named_gpio(np, "wakeup-gpios", 0);
+       if (!gpio_is_valid(gpio))
+               return -ENODEV;
+
        ret = gpio_request(gpio, "egalax_irq");
        if (ret < 0) {
                dev_err(&client->dev,
@@ -181,7 +190,11 @@ static int __devinit egalax_ts_probe(struct i2c_client *client,
        ts->input_dev = input_dev;
 
        /* controller may be in sleep, wake it up. */
-       egalax_wake_up_device(client);
+       error = egalax_wake_up_device(client);
+       if (error) {
+               dev_err(&client->dev, "Failed to wake up the controller\n");
+               goto err_free_dev;
+       }
 
        ret = egalax_firmware_version(client);
        if (ret < 0) {
@@ -274,11 +287,17 @@ static int egalax_ts_resume(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(egalax_ts_pm_ops, egalax_ts_suspend, egalax_ts_resume);
 
+static struct of_device_id egalax_ts_dt_ids[] = {
+       { .compatible = "eeti,egalax_ts" },
+       { /* sentinel */ }
+};
+
 static struct i2c_driver egalax_ts_driver = {
        .driver = {
                .name   = "egalax_ts",
                .owner  = THIS_MODULE,
                .pm     = &egalax_ts_pm_ops,
+               .of_match_table = of_match_ptr(egalax_ts_dt_ids),
        },
        .id_table       = egalax_ts_id,
        .probe          = egalax_ts_probe,
index 63209aaa55f01f1baf65a8a1632c8c2ce4056870..eb96f168fb9d53c68032c172faec9d2652dcfa70 100644 (file)
@@ -107,7 +107,6 @@ static int tsc_connect(struct serio *serio, struct serio_driver *drv)
        __set_bit(BTN_TOUCH, input_dev->keybit);
        input_set_abs_params(ptsc->dev, ABS_X, 0, 0x3ff, 0, 0);
        input_set_abs_params(ptsc->dev, ABS_Y, 0, 0x3ff, 0, 0);
-       input_set_abs_params(ptsc->dev, ABS_PRESSURE, 0, 0, 0, 0);
 
        serio_set_drvdata(serio, ptsc);
 
index a233ed53913a67bb67150ce9d35abf6f8aa42297..86cd75a0e84da69469ef10b5712285f4ce4e84f2 100644 (file)
@@ -4,7 +4,7 @@
 
 menuconfig ISDN
        bool "ISDN support"
-       depends on NET
+       depends on NET && NETDEVICES
        depends on !S390 && !UML
        ---help---
          ISDN ("Integrated Services Digital Network", called RNIS in France)
index 2302fbe70ac62badd292a5e455a24042687f2b09..9c6650ea848ece07f2a369cbc0e7a17b26fc035b 100644 (file)
@@ -6,7 +6,7 @@ if ISDN_I4L
 
 config ISDN_PPP
        bool "Support synchronous PPP"
-       depends on INET && NETDEVICES
+       depends on INET
        select SLHC
        help
          Over digital connections such as ISDN, there is no need to
index 8c610fa6782b67925e4c286f651e044a37a53b62..e2a945ee9f05c558eec64ee6a18df91beee318c2 100644 (file)
@@ -1312,7 +1312,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
                        } else
                                return -EINVAL;
                        break;
-#ifdef CONFIG_NETDEVICES
                case IIOCNETGPN:
                        /* Get peer phone number of a connected
                         * isdn network interface */
@@ -1322,7 +1321,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
                                return isdn_net_getpeer(&phone, argp);
                        } else
                                return -EINVAL;
-#endif
                default:
                        return -EINVAL;
                }
@@ -1352,7 +1350,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
                case IIOCNETLCR:
                        printk(KERN_INFO "INFO: ISDN_ABC_LCR_SUPPORT not enabled\n");
                        return -ENODEV;
-#ifdef CONFIG_NETDEVICES
                case IIOCNETAIF:
                        /* Add a network-interface */
                        if (arg) {
@@ -1491,7 +1488,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
                                return -EFAULT;
                        return isdn_net_force_hangup(name);
                        break;
-#endif                          /* CONFIG_NETDEVICES */
                case IIOCSETVER:
                        dev->net_verbose = arg;
                        printk(KERN_INFO "isdn: Verbose-Level is %d\n", dev->net_verbose);
index 45135f69509c89e83b6cc7190f1f25972ae28076..5e7dc772f5deca223ea9142d073cc66785f54b27 100644 (file)
@@ -315,8 +315,11 @@ static int run(struct mddev *mddev)
        }
        conf->nfaults = 0;
 
-       rdev_for_each(rdev, mddev)
+       rdev_for_each(rdev, mddev) {
                conf->rdev = rdev;
+               disk_stack_limits(mddev->gendisk, rdev->bdev,
+                                 rdev->data_offset << 9);
+       }
 
        md_set_array_sectors(mddev, faulty_size(mddev, 0, 0));
        mddev->private = conf;
index 8034fbd6190ce647ec2feb6a281e4bb32b406f8e..636bae0405e8167edcec328e5759b3f949dd0876 100644 (file)
@@ -2710,7 +2710,7 @@ static struct r1conf *setup_conf(struct mddev *mddev)
                    || disk_idx < 0)
                        continue;
                if (test_bit(Replacement, &rdev->flags))
-                       disk = conf->mirrors + conf->raid_disks + disk_idx;
+                       disk = conf->mirrors + mddev->raid_disks + disk_idx;
                else
                        disk = conf->mirrors + disk_idx;
 
index 906ccbd0f7dcdc6710869c5b990f9375d020d370..d1295aff41739eea048f0e43513dfba6ade4c8f1 100644 (file)
@@ -1783,7 +1783,7 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev)
                clear_bit(Unmerged, &rdev->flags);
        }
        md_integrity_add_rdev(rdev, mddev);
-       if (blk_queue_discard(bdev_get_queue(rdev->bdev)))
+       if (mddev->queue && blk_queue_discard(bdev_get_queue(rdev->bdev)))
                queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
 
        print_conf(conf);
@@ -3613,11 +3613,14 @@ static int run(struct mddev *mddev)
                        discard_supported = true;
        }
 
-       if (discard_supported)
-               queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
-       else
-               queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
-
+       if (mddev->queue) {
+               if (discard_supported)
+                       queue_flag_set_unlocked(QUEUE_FLAG_DISCARD,
+                                               mddev->queue);
+               else
+                       queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD,
+                                                 mddev->queue);
+       }
        /* need to check that every block has at least one working mirror */
        if (!enough(conf, -1)) {
                printk(KERN_ERR "md/raid10:%s: not enough operational mirrors.\n",
index a3b1a34c896db9257000f6c1a3e8fb8bb7cd7df0..4b1becc86e54a77d6beea297b2128236992dd8bb 100644 (file)
@@ -45,8 +45,8 @@
 #include <media/v4l2-ioctl.h>
 
 #include <plat/cpu.h>
-#include <plat/dma.h>
-#include <plat/vrfb.h>
+#include <plat-omap/dma-omap.h>
+#include <video/omapvrfb.h>
 #include <video/omapdss.h>
 
 #include "omap_voutlib.h"
index 4be26abf6cea7a323ef0b15e7e1cedf3177ab916..8340445a0ee597dfe65566d8924a1bcc482e385f 100644 (file)
 #include <media/videobuf-dma-contig.h>
 #include <media/v4l2-device.h>
 
-#include <plat/dma.h>
-#include <plat/vrfb.h>
+#include <plat-omap/dma-omap.h>
+#include <video/omapvrfb.h>
 
 #include "omap_voutdef.h"
 #include "omap_voutlib.h"
 
+#define OMAP_DMA_NO_DEVICE     0
+
 /*
  * Function for allocating video buffers
  */
index 27a95d23b913493db67d20b90857e37f621fdd10..9ccfe1f475a4dce9ec07bae935c3bbdce447f7de 100644 (file)
@@ -12,7 +12,7 @@
 #define OMAP_VOUTDEF_H
 
 #include <video/omapdss.h>
-#include <plat/vrfb.h>
+#include <video/omapvrfb.h>
 
 #define YUYV_BPP        2
 #define RGB565_BPP      2
index d1a8dee5e1ca4720adb96fde8c87e6280187d862..e7f9c4292cc61b40190dee390731faa75c73f9d8 100644 (file)
@@ -34,6 +34,8 @@
 #include "ispreg.h"
 #include "isphist.h"
 
+#define OMAP24XX_DMA_NO_DEVICE         0
+
 #define HIST_CONFIG_DMA        1
 
 #define HIST_USING_DMA(hist) ((hist)->dma_ch >= 0)
index a6fe653eb237dc171c6aef71f31d62ddc1a30550..40f87cdd79944656580f7cc0ccca36d5db1db927 100644 (file)
@@ -30,7 +30,7 @@
 
 #include <linux/types.h>
 #include <linux/omap3isp.h>
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 #include <media/v4l2-event.h>
 
 #include "isp.h"
index a0b737fecf138e61413fca9ca6c36443b5b452f4..5bd40e6870cc36176ea787208f6a707403d86793 100644 (file)
@@ -36,7 +36,6 @@
 #include <media/v4l2-ioctl.h>
 #include <plat/iommu.h>
 #include <plat/iovmm.h>
-#include <plat/omap-pm.h>
 
 #include "ispvideo.h"
 #include "isp.h"
index 9fd9d1c5b218a5b51ff0522b9969db06e795706c..e575ae82771d5ffcefefc3950addf6d15fa73546 100644 (file)
@@ -41,7 +41,6 @@
 #include <linux/videodev2.h>
 
 #include <linux/platform_data/camera-mx2.h>
-#include <mach/hardware.h>
 
 #include <asm/dma.h>
 
 
 #define CSICR1                 0x00
 #define CSICR2                 0x04
-#define CSISR                  (cpu_is_mx27() ? 0x08 : 0x18)
+#define CSISR_IMX25            0x18
+#define CSISR_IMX27            0x08
 #define CSISTATFIFO            0x0c
 #define CSIRFIFO               0x10
 #define CSIRXCNT               0x14
-#define CSICR3                 (cpu_is_mx27() ? 0x1C : 0x08)
+#define CSICR3_IMX25           0x08
+#define CSICR3_IMX27           0x1c
 #define CSIDMASA_STATFIFO      0x20
 #define CSIDMATA_STATFIFO      0x24
 #define CSIDMASA_FB1           0x28
@@ -268,6 +269,11 @@ struct mx2_buffer {
        struct mx2_buf_internal         internal;
 };
 
+enum mx2_camera_type {
+       IMX25_CAMERA,
+       IMX27_CAMERA,
+};
+
 struct mx2_camera_dev {
        struct device           *dev;
        struct soc_camera_host  soc_host;
@@ -291,6 +297,9 @@ struct mx2_camera_dev {
        struct mx2_buffer       *fb2_active;
 
        u32                     csicr1;
+       u32                     reg_csisr;
+       u32                     reg_csicr3;
+       enum mx2_camera_type    devtype;
 
        struct mx2_buf_internal buf_discard[2];
        void                    *discard_buffer;
@@ -303,6 +312,29 @@ struct mx2_camera_dev {
        struct vb2_alloc_ctx    *alloc_ctx;
 };
 
+static struct platform_device_id mx2_camera_devtype[] = {
+       {
+               .name = "imx25-camera",
+               .driver_data = IMX25_CAMERA,
+       }, {
+               .name = "imx27-camera",
+               .driver_data = IMX27_CAMERA,
+       }, {
+               /* sentinel */
+       }
+};
+MODULE_DEVICE_TABLE(platform, mx2_camera_devtype);
+
+static inline int is_imx25_camera(struct mx2_camera_dev *pcdev)
+{
+       return pcdev->devtype == IMX25_CAMERA;
+}
+
+static inline int is_imx27_camera(struct mx2_camera_dev *pcdev)
+{
+       return pcdev->devtype == IMX27_CAMERA;
+}
+
 static struct mx2_buffer *mx2_ibuf_to_buf(struct mx2_buf_internal *int_buf)
 {
        return container_of(int_buf, struct mx2_buffer, internal);
@@ -434,9 +466,9 @@ static void mx2_camera_deactivate(struct mx2_camera_dev *pcdev)
 
        clk_disable_unprepare(pcdev->clk_csi);
        writel(0, pcdev->base_csi + CSICR1);
-       if (cpu_is_mx27()) {
+       if (is_imx27_camera(pcdev)) {
                writel(0, pcdev->base_emma + PRP_CNTL);
-       } else if (cpu_is_mx25()) {
+       } else if (is_imx25_camera(pcdev)) {
                spin_lock_irqsave(&pcdev->lock, flags);
                pcdev->fb1_active = NULL;
                pcdev->fb2_active = NULL;
@@ -466,7 +498,7 @@ static int mx2_camera_add_device(struct soc_camera_device *icd)
 
        csicr1 = CSICR1_MCLKEN;
 
-       if (cpu_is_mx27())
+       if (is_imx27_camera(pcdev))
                csicr1 |= CSICR1_PRP_IF_EN | CSICR1_FCC |
                        CSICR1_RXFF_LEVEL(0);
 
@@ -542,7 +574,7 @@ out:
 static irqreturn_t mx25_camera_irq(int irq_csi, void *data)
 {
        struct mx2_camera_dev *pcdev = data;
-       u32 status = readl(pcdev->base_csi + CSISR);
+       u32 status = readl(pcdev->base_csi + pcdev->reg_csisr);
 
        if (status & CSISR_DMA_TSF_FB1_INT)
                mx25_camera_frame_done(pcdev, 1, MX2_STATE_DONE);
@@ -551,7 +583,7 @@ static irqreturn_t mx25_camera_irq(int irq_csi, void *data)
 
        /* FIXME: handle CSISR_RFF_OR_INT */
 
-       writel(status, pcdev->base_csi + CSISR);
+       writel(status, pcdev->base_csi + pcdev->reg_csisr);
 
        return IRQ_HANDLED;
 }
@@ -636,7 +668,7 @@ static void mx2_videobuf_queue(struct vb2_buffer *vb)
        buf->state = MX2_STATE_QUEUED;
        list_add_tail(&buf->internal.queue, &pcdev->capture);
 
-       if (cpu_is_mx25()) {
+       if (is_imx25_camera(pcdev)) {
                u32 csicr3, dma_inten = 0;
 
                if (pcdev->fb1_active == NULL) {
@@ -655,20 +687,20 @@ static void mx2_videobuf_queue(struct vb2_buffer *vb)
                        list_del(&buf->internal.queue);
                        buf->state = MX2_STATE_ACTIVE;
 
-                       csicr3 = readl(pcdev->base_csi + CSICR3);
+                       csicr3 = readl(pcdev->base_csi + pcdev->reg_csicr3);
 
                        /* Reflash DMA */
                        writel(csicr3 | CSICR3_DMA_REFLASH_RFF,
-                                       pcdev->base_csi + CSICR3);
+                                       pcdev->base_csi + pcdev->reg_csicr3);
 
                        /* clear & enable interrupts */
-                       writel(dma_inten, pcdev->base_csi + CSISR);
+                       writel(dma_inten, pcdev->base_csi + pcdev->reg_csisr);
                        pcdev->csicr1 |= dma_inten;
                        writel(pcdev->csicr1, pcdev->base_csi + CSICR1);
 
                        /* enable DMA */
                        csicr3 |= CSICR3_DMA_REQ_EN_RFF | CSICR3_RXFF_LEVEL(1);
-                       writel(csicr3, pcdev->base_csi + CSICR3);
+                       writel(csicr3, pcdev->base_csi + pcdev->reg_csicr3);
                }
        }
 
@@ -712,7 +744,7 @@ static void mx2_videobuf_release(struct vb2_buffer *vb)
         */
 
        spin_lock_irqsave(&pcdev->lock, flags);
-       if (cpu_is_mx25() && buf->state == MX2_STATE_ACTIVE) {
+       if (is_imx25_camera(pcdev) && buf->state == MX2_STATE_ACTIVE) {
                if (pcdev->fb1_active == buf) {
                        pcdev->csicr1 &= ~CSICR1_FB1_DMA_INTEN;
                        writel(0, pcdev->base_csi + CSIDMASA_FB1);
@@ -835,7 +867,7 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count)
        unsigned long phys;
        int bytesperline;
 
-       if (cpu_is_mx27()) {
+       if (is_imx27_camera(pcdev)) {
                unsigned long flags;
                if (count < 2)
                        return -EINVAL;
@@ -930,7 +962,7 @@ static int mx2_stop_streaming(struct vb2_queue *q)
        void *b;
        u32 cntl;
 
-       if (cpu_is_mx27()) {
+       if (is_imx27_camera(pcdev)) {
                spin_lock_irqsave(&pcdev->lock, flags);
 
                cntl = readl(pcdev->base_emma + PRP_CNTL);
@@ -1082,11 +1114,11 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd)
        if (bytesperline < 0)
                return bytesperline;
 
-       if (cpu_is_mx27()) {
+       if (is_imx27_camera(pcdev)) {
                ret = mx27_camera_emma_prp_reset(pcdev);
                if (ret)
                        return ret;
-       } else if (cpu_is_mx25()) {
+       } else if (is_imx25_camera(pcdev)) {
                writel((bytesperline * icd->user_height) >> 2,
                                pcdev->base_csi + CSIRXCNT);
                writel((bytesperline << 16) | icd->user_height,
@@ -1392,7 +1424,7 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
        /* FIXME: implement MX27 limits */
 
        /* limit to MX25 hardware capabilities */
-       if (cpu_is_mx25()) {
+       if (is_imx25_camera(pcdev)) {
                if (xlate->host_fmt->bits_per_sample <= 8)
                        width_limit = 0xffff * 4;
                else
@@ -1726,6 +1758,20 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
                goto exit;
        }
 
+       pcdev->devtype = pdev->id_entry->driver_data;
+       switch (pcdev->devtype) {
+       case IMX25_CAMERA:
+               pcdev->reg_csisr = CSISR_IMX25;
+               pcdev->reg_csicr3 = CSICR3_IMX25;
+               break;
+       case IMX27_CAMERA:
+               pcdev->reg_csisr = CSISR_IMX27;
+               pcdev->reg_csicr3 = CSICR3_IMX27;
+               break;
+       default:
+               break;
+       }
+
        pcdev->clk_csi = devm_clk_get(&pdev->dev, "ahb");
        if (IS_ERR(pcdev->clk_csi)) {
                dev_err(&pdev->dev, "Could not get csi clock\n");
@@ -1763,7 +1809,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
        pcdev->dev = &pdev->dev;
        platform_set_drvdata(pdev, pcdev);
 
-       if (cpu_is_mx25()) {
+       if (is_imx25_camera(pcdev)) {
                err = devm_request_irq(&pdev->dev, irq_csi, mx25_camera_irq, 0,
                                       MX2_CAM_DRV_NAME, pcdev);
                if (err) {
@@ -1772,7 +1818,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
                }
        }
 
-       if (cpu_is_mx27()) {
+       if (is_imx27_camera(pcdev)) {
                err = mx27_camera_emma_init(pdev);
                if (err)
                        goto exit;
@@ -1789,7 +1835,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
        pcdev->soc_host.priv            = pcdev;
        pcdev->soc_host.v4l2_dev.dev    = &pdev->dev;
        pcdev->soc_host.nr              = pdev->id;
-       if (cpu_is_mx25())
+       if (is_imx25_camera(pcdev))
                pcdev->soc_host.capabilities = SOCAM_HOST_CAP_STRIDE;
 
        pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
@@ -1809,7 +1855,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
 exit_free_emma:
        vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx);
 eallocctx:
-       if (cpu_is_mx27()) {
+       if (is_imx27_camera(pcdev)) {
                clk_disable_unprepare(pcdev->clk_emma_ipg);
                clk_disable_unprepare(pcdev->clk_emma_ahb);
        }
@@ -1827,7 +1873,7 @@ static int __devexit mx2_camera_remove(struct platform_device *pdev)
 
        vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx);
 
-       if (cpu_is_mx27()) {
+       if (is_imx27_camera(pcdev)) {
                clk_disable_unprepare(pcdev->clk_emma_ipg);
                clk_disable_unprepare(pcdev->clk_emma_ahb);
        }
@@ -1841,6 +1887,7 @@ static struct platform_driver mx2_camera_driver = {
        .driver         = {
                .name   = MX2_CAM_DRV_NAME,
        },
+       .id_table       = mx2_camera_devtype,
        .remove         = __devexit_p(mx2_camera_remove),
 };
 
index 3557ac97e4303f4743330850a5144f43cb06cbd0..64d39b1b5582c96027208850e8a708e7e8c29c05 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/vmalloc.h>
 #include <linux/interrupt.h>
 #include <linux/sched.h>
+#include <linux/dma/ipu-dma.h>
 
 #include <media/v4l2-common.h>
 #include <media/v4l2-dev.h>
@@ -24,7 +25,6 @@
 #include <media/soc_camera.h>
 #include <media/soc_mediabus.h>
 
-#include <mach/ipu.h>
 #include <linux/platform_data/camera-mx3.h>
 #include <linux/platform_data/dma-imx.h>
 
index fa08c7695ccb05aa61d680d8bcf4f002516d2894..cae9ce6275e9f06cebe33ab1fcb89497a645618b 100644 (file)
 #include <media/videobuf-dma-contig.h>
 #include <media/videobuf-dma-sg.h>
 
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 
 
 #define DRIVER_NAME            "omap1-camera"
 #define DRIVER_VERSION         "0.0.2"
 
+#define OMAP_DMA_CAMERA_IF_RX          20
 
 /*
  * ---------------------------------------------------------------------------
index 546199e9ccc7268f1600a7bc89415b96b10566f2..82e6c1e282d5e6a72784f1fa57489553d4d82e9b 100644 (file)
@@ -28,7 +28,6 @@
 
 #include <plat/dmtimer.h>
 #include <plat/clock.h>
-#include <plat/omap-pm.h>
 
 #include <media/lirc.h>
 #include <media/lirc_dev.h>
index 55d589981412ec6b956566727ed05bbdbdb15982..998ce8cb3065a5a68dc2c09289e13e68826c341b 100644 (file)
 #include <linux/rtc.h>
 #include <linux/bcd.h>
 #include <linux/slab.h>
+#include <linux/mfd/menelaus.h>
 
 #include <asm/mach/irq.h>
 
 #include <asm/gpio.h>
-#include <plat/menelaus.h>
 
 #define DRIVER_NAME                    "menelaus"
 
index 23cec57c02ba9d7e995900ce5d66e1d4e3704bb7..cebfe0a68aa7666f0749412741f803d3867eb425 100644 (file)
 #include <linux/spinlock.h>
 #include <linux/gpio.h>
 #include <plat/cpu.h>
-#include <plat/usb.h>
+#include <linux/platform_device.h>
+#include <linux/platform_data/usb-omap.h>
 #include <linux/pm_runtime.h>
 
+#include "omap-usb.h"
+
 #define USBHS_DRIVER_NAME      "usbhs_omap"
 #define OMAP_EHCI_DEVICE       "ehci-omap"
 #define OMAP_OHCI_DEVICE       "ohci-omap3"
index 4b7757b8430195dbb8683cab2e21b3d3ca51b738..0db0dfa3d08c312c89d760e199e59692e3cf1550 100644 (file)
@@ -25,8 +25,8 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/err.h>
-#include <plat/usb.h>
 #include <linux/pm_runtime.h>
+#include <linux/platform_data/usb-omap.h>
 
 #define USBTLL_DRIVER_NAME     "usbhs_tll"
 
diff --git a/drivers/mfd/omap-usb.h b/drivers/mfd/omap-usb.h
new file mode 100644 (file)
index 0000000..972aa96
--- /dev/null
@@ -0,0 +1,2 @@
+extern int omap_tll_enable(void);
+extern int omap_tll_disable(void);
index 660bbc528862fc67915b79def806cf689d4ac755..4d50da618166e33c03856fe5845e780d785ece46 100644 (file)
@@ -208,7 +208,7 @@ static unsigned long exynos5250_dwmmc_caps[4] = {
        MMC_CAP_CMD23,
 };
 
-static struct dw_mci_drv_data exynos5250_drv_data = {
+static const struct dw_mci_drv_data exynos5250_drv_data = {
        .caps                   = exynos5250_dwmmc_caps,
        .init                   = dw_mci_exynos_priv_init,
        .setup_clock            = dw_mci_exynos_setup_clock,
@@ -220,14 +220,14 @@ static struct dw_mci_drv_data exynos5250_drv_data = {
 
 static const struct of_device_id dw_mci_exynos_match[] = {
        { .compatible = "samsung,exynos5250-dw-mshc",
-                       .data = (void *)&exynos5250_drv_data, },
+                       .data = &exynos5250_drv_data, },
        {},
 };
-MODULE_DEVICE_TABLE(of, dw_mci_pltfm_match);
+MODULE_DEVICE_TABLE(of, dw_mci_exynos_match);
 
 int dw_mci_exynos_probe(struct platform_device *pdev)
 {
-       struct dw_mci_drv_data *drv_data;
+       const struct dw_mci_drv_data *drv_data;
        const struct of_device_id *match;
 
        match = of_match_node(dw_mci_exynos_match, pdev->dev.of_node);
index c960ca7ffbe694fa367ff7ca88c83003b3da59a6..917936bee5d50514103fbe8501a2ee40c0a4db3a 100644 (file)
@@ -24,7 +24,7 @@
 #include "dw_mmc.h"
 
 int dw_mci_pltfm_register(struct platform_device *pdev,
-                               struct dw_mci_drv_data *drv_data)
+                               const struct dw_mci_drv_data *drv_data)
 {
        struct dw_mci *host;
        struct resource *regs;
@@ -50,8 +50,8 @@ int dw_mci_pltfm_register(struct platform_device *pdev,
        if (!host->regs)
                return -ENOMEM;
 
-       if (host->drv_data->init) {
-               ret = host->drv_data->init(host);
+       if (drv_data && drv_data->init) {
+               ret = drv_data->init(host);
                if (ret)
                        return ret;
        }
index 301f24541fc2f20f2b4c65b6cb7a8d05b1f53abe..2ac37b81de4d2774f3f468922284243090f16fd9 100644 (file)
@@ -13,7 +13,7 @@
 #define _DW_MMC_PLTFM_H_
 
 extern int dw_mci_pltfm_register(struct platform_device *pdev,
-                               struct dw_mci_drv_data *drv_data);
+                               const struct dw_mci_drv_data *drv_data);
 extern int __devexit dw_mci_pltfm_remove(struct platform_device *pdev);
 extern const struct dev_pm_ops dw_mci_pltfm_pmops;
 
index c2828f35c3b8812b4de12cb0fd4b75c28fa09bbf..c0667c8af2bd7c78502151e0f6e8a2c3f8e148bc 100644 (file)
@@ -232,6 +232,7 @@ static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
 {
        struct mmc_data *data;
        struct dw_mci_slot *slot = mmc_priv(mmc);
+       struct dw_mci_drv_data *drv_data = slot->host->drv_data;
        u32 cmdr;
        cmd->error = -EINPROGRESS;
 
@@ -261,8 +262,8 @@ static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
                        cmdr |= SDMMC_CMD_DAT_WR;
        }
 
-       if (slot->host->drv_data->prepare_command)
-               slot->host->drv_data->prepare_command(slot->host, &cmdr);
+       if (drv_data && drv_data->prepare_command)
+               drv_data->prepare_command(slot->host, &cmdr);
 
        return cmdr;
 }
@@ -434,7 +435,7 @@ static int dw_mci_idmac_init(struct dw_mci *host)
        return 0;
 }
 
-static struct dw_mci_dma_ops dw_mci_idmac_ops = {
+static const struct dw_mci_dma_ops dw_mci_idmac_ops = {
        .init = dw_mci_idmac_init,
        .start = dw_mci_idmac_start_dma,
        .stop = dw_mci_idmac_stop_dma,
@@ -772,6 +773,7 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq)
 static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 {
        struct dw_mci_slot *slot = mmc_priv(mmc);
+       struct dw_mci_drv_data *drv_data = slot->host->drv_data;
        u32 regs;
 
        /* set default 1 bit mode */
@@ -807,8 +809,8 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
                slot->clock = ios->clock;
        }
 
-       if (slot->host->drv_data->set_ios)
-               slot->host->drv_data->set_ios(slot->host, ios);
+       if (drv_data && drv_data->set_ios)
+               drv_data->set_ios(slot->host, ios);
 
        switch (ios->power_mode) {
        case MMC_POWER_UP:
@@ -1815,6 +1817,7 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
 {
        struct mmc_host *mmc;
        struct dw_mci_slot *slot;
+       struct dw_mci_drv_data *drv_data = host->drv_data;
        int ctrl_id, ret;
        u8 bus_width;
 
@@ -1854,8 +1857,8 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
        } else {
                ctrl_id = to_platform_device(host->dev)->id;
        }
-       if (host->drv_data && host->drv_data->caps)
-               mmc->caps |= host->drv_data->caps[ctrl_id];
+       if (drv_data && drv_data->caps)
+               mmc->caps |= drv_data->caps[ctrl_id];
 
        if (host->pdata->caps2)
                mmc->caps2 = host->pdata->caps2;
@@ -1867,10 +1870,10 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
        else
                bus_width = 1;
 
-       if (host->drv_data->setup_bus) {
+       if (drv_data && drv_data->setup_bus) {
                struct device_node *slot_np;
                slot_np = dw_mci_of_find_slot_node(host->dev, slot->id);
-               ret = host->drv_data->setup_bus(host, slot_np, bus_width);
+               ret = drv_data->setup_bus(host, slot_np, bus_width);
                if (ret)
                        goto err_setup_bus;
        }
@@ -1968,7 +1971,7 @@ static void dw_mci_init_dma(struct dw_mci *host)
        /* Determine which DMA interface to use */
 #ifdef CONFIG_MMC_DW_IDMAC
        host->dma_ops = &dw_mci_idmac_ops;
-       dev_info(&host->dev, "Using internal DMA controller.\n");
+       dev_info(host->dev, "Using internal DMA controller.\n");
 #endif
 
        if (!host->dma_ops)
@@ -2035,6 +2038,7 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
        struct dw_mci_board *pdata;
        struct device *dev = host->dev;
        struct device_node *np = dev->of_node;
+       struct dw_mci_drv_data *drv_data = host->drv_data;
        int idx, ret;
 
        pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
@@ -2062,8 +2066,8 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
 
        of_property_read_u32(np, "card-detect-delay", &pdata->detect_delay_ms);
 
-       if (host->drv_data->parse_dt) {
-               ret = host->drv_data->parse_dt(host);
+       if (drv_data && drv_data->parse_dt) {
+               ret = drv_data->parse_dt(host);
                if (ret)
                        return ERR_PTR(ret);
        }
@@ -2080,6 +2084,7 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
 
 int dw_mci_probe(struct dw_mci *host)
 {
+       struct dw_mci_drv_data *drv_data = host->drv_data;
        int width, i, ret = 0;
        u32 fifo_size;
        int init_slots = 0;
@@ -2127,8 +2132,8 @@ int dw_mci_probe(struct dw_mci *host)
        else
                host->bus_hz = clk_get_rate(host->ciu_clk);
 
-       if (host->drv_data->setup_clock) {
-               ret = host->drv_data->setup_clock(host);
+       if (drv_data && drv_data->setup_clock) {
+               ret = drv_data->setup_clock(host);
                if (ret) {
                        dev_err(host->dev,
                                "implementation specific clock setup failed\n");
@@ -2228,6 +2233,21 @@ int dw_mci_probe(struct dw_mci *host)
        else
                host->num_slots = ((mci_readl(host, HCON) >> 1) & 0x1F) + 1;
 
+       /*
+        * Enable interrupts for command done, data over, data empty, card det,
+        * receive ready and error such as transmit, receive timeout, crc error
+        */
+       mci_writel(host, RINTSTS, 0xFFFFFFFF);
+       mci_writel(host, INTMASK, SDMMC_INT_CMD_DONE | SDMMC_INT_DATA_OVER |
+                  SDMMC_INT_TXDR | SDMMC_INT_RXDR |
+                  DW_MCI_ERROR_FLAGS | SDMMC_INT_CD);
+       mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE); /* Enable mci interrupt */
+
+       dev_info(host->dev, "DW MMC controller at irq %d, "
+                "%d bit host data width, "
+                "%u deep fifo\n",
+                host->irq, width, fifo_size);
+
        /* We need at least one slot to succeed */
        for (i = 0; i < host->num_slots; i++) {
                ret = dw_mci_init_slot(host, i);
@@ -2257,20 +2277,6 @@ int dw_mci_probe(struct dw_mci *host)
        else
                host->data_offset = DATA_240A_OFFSET;
 
-       /*
-        * Enable interrupts for command done, data over, data empty, card det,
-        * receive ready and error such as transmit, receive timeout, crc error
-        */
-       mci_writel(host, RINTSTS, 0xFFFFFFFF);
-       mci_writel(host, INTMASK, SDMMC_INT_CMD_DONE | SDMMC_INT_DATA_OVER |
-                  SDMMC_INT_TXDR | SDMMC_INT_RXDR |
-                  DW_MCI_ERROR_FLAGS | SDMMC_INT_CD);
-       mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE); /* Enable mci interrupt */
-
-       dev_info(host->dev, "DW MMC controller at irq %d, "
-                "%d bit host data width, "
-                "%u deep fifo\n",
-                host->irq, width, fifo_size);
        if (host->quirks & DW_MCI_QUIRK_IDMAC_DTO)
                dev_info(host->dev, "Internal DMAC interrupt fix enabled.\n");
 
index 565c2e4fac75cecd8890ec2d9885ffb50cc23060..477f63bad5212ac66053186b6a376ed0b7088f96 100644 (file)
@@ -41,7 +41,6 @@
 #include <linux/platform_data/mmc-mxcmmc.h>
 
 #include <linux/platform_data/dma-imx.h>
-#include <mach/hardware.h>
 
 #define DRIVER_NAME "mxc-mmc"
 #define MXCMCI_TIMEOUT_MS 10000
 #define INT_WRITE_OP_DONE_EN           (1 << 1)
 #define INT_READ_OP_EN                 (1 << 0)
 
+enum mxcmci_type {
+       IMX21_MMC,
+       IMX31_MMC,
+};
+
 struct mxcmci_host {
        struct mmc_host         *mmc;
        struct resource         *res;
@@ -153,7 +157,26 @@ struct mxcmci_host {
        struct imx_dma_data     dma_data;
 
        struct timer_list       watchdog;
+       enum mxcmci_type        devtype;
+};
+
+static struct platform_device_id mxcmci_devtype[] = {
+       {
+               .name = "imx21-mmc",
+               .driver_data = IMX21_MMC,
+       }, {
+               .name = "imx31-mmc",
+               .driver_data = IMX31_MMC,
+       }, {
+               /* sentinel */
+       }
 };
+MODULE_DEVICE_TABLE(platform, mxcmci_devtype);
+
+static inline int is_imx31_mmc(struct mxcmci_host *host)
+{
+       return host->devtype == IMX31_MMC;
+}
 
 static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios);
 
@@ -843,6 +866,8 @@ static void mxcmci_enable_sdio_irq(struct mmc_host *mmc, int enable)
 
 static void mxcmci_init_card(struct mmc_host *host, struct mmc_card *card)
 {
+       struct mxcmci_host *mxcmci = mmc_priv(host);
+
        /*
         * MX3 SoCs have a silicon bug which corrupts CRC calculation of
         * multi-block transfers when connected SDIO peripheral doesn't
@@ -850,7 +875,7 @@ static void mxcmci_init_card(struct mmc_host *host, struct mmc_card *card)
         * One way to prevent this is to only allow 1-bit transfers.
         */
 
-       if (cpu_is_mx3() && card->type == MMC_TYPE_SDIO)
+       if (is_imx31_mmc(mxcmci) && card->type == MMC_TYPE_SDIO)
                host->caps &= ~MMC_CAP_4_BIT_DATA;
        else
                host->caps |= MMC_CAP_4_BIT_DATA;
@@ -948,6 +973,7 @@ static int mxcmci_probe(struct platform_device *pdev)
 
        host->mmc = mmc;
        host->pdata = pdev->dev.platform_data;
+       host->devtype = pdev->id_entry->driver_data;
        spin_lock_init(&host->lock);
 
        mxcmci_init_ocr(host);
@@ -1120,6 +1146,7 @@ static const struct dev_pm_ops mxcmci_pm_ops = {
 static struct platform_driver mxcmci_driver = {
        .probe          = mxcmci_probe,
        .remove         = mxcmci_remove,
+       .id_table       = mxcmci_devtype,
        .driver         = {
                .name           = DRIVER_NAME,
                .owner          = THIS_MODULE,
@@ -1134,4 +1161,4 @@ module_platform_driver(mxcmci_driver);
 MODULE_DESCRIPTION("i.MX Multimedia Card Interface Driver");
 MODULE_AUTHOR("Sascha Hauer, Pengutronix");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:imx-mmc");
+MODULE_ALIAS("platform:mxc-mmc");
index 48ad361613efb2ebaca728ac53f87a147e8beb45..ae115c01283b0c9a426bf8f73bb47e9f7741882f 100644 (file)
@@ -28,9 +28,8 @@
 #include <linux/clk.h>
 #include <linux/scatterlist.h>
 #include <linux/slab.h>
+#include <linux/platform_data/mmc-omap.h>
 
-#include <plat/mmc.h>
-#include <plat/dma.h>
 
 #define        OMAP_MMC_REG_CMD        0x00
 #define        OMAP_MMC_REG_ARGL       0x01
 #define        OMAP_MMC_STAT_CARD_BUSY         (1 <<  2)
 #define        OMAP_MMC_STAT_END_OF_CMD        (1 <<  0)
 
+#define mmc_omap7xx()  (host->features & MMC_OMAP7XX)
+#define mmc_omap15xx() (host->features & MMC_OMAP15XX)
+#define mmc_omap16xx() (host->features & MMC_OMAP16XX)
+#define MMC_OMAP1_MASK (MMC_OMAP7XX | MMC_OMAP15XX | MMC_OMAP16XX)
+#define mmc_omap1()    (host->features & MMC_OMAP1_MASK)
+#define mmc_omap2()    (!mmc_omap1())
+
 #define OMAP_MMC_REG(host, reg)                (OMAP_MMC_REG_##reg << (host)->reg_shift)
 #define OMAP_MMC_READ(host, reg)       __raw_readw((host)->virt_base + OMAP_MMC_REG(host, reg))
 #define OMAP_MMC_WRITE(host, reg, val) __raw_writew((val), (host)->virt_base + OMAP_MMC_REG(host, reg))
 #define OMAP_MMC_CMDTYPE_AC    2
 #define OMAP_MMC_CMDTYPE_ADTC  3
 
+#define OMAP_DMA_MMC_TX                21
+#define OMAP_DMA_MMC_RX                22
+#define OMAP_DMA_MMC2_TX       54
+#define OMAP_DMA_MMC2_RX       55
+
+#define OMAP24XX_DMA_MMC2_TX   47
+#define OMAP24XX_DMA_MMC2_RX   48
+#define OMAP24XX_DMA_MMC1_TX   61
+#define OMAP24XX_DMA_MMC1_RX   62
+
 
 #define DRIVER_NAME "mmci-omap"
 
@@ -147,6 +163,7 @@ struct mmc_omap_host {
        u32                     buffer_bytes_left;
        u32                     total_bytes_left;
 
+       unsigned                features;
        unsigned                use_dma:1;
        unsigned                brs_received:1, dma_done:1;
        unsigned                dma_in_use:1;
@@ -988,7 +1005,7 @@ mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req)
                 * blocksize is at least that large. Blocksize is
                 * usually 512 bytes; but not for some SD reads.
                 */
-               burst = cpu_is_omap15xx() ? 32 : 64;
+               burst = mmc_omap15xx() ? 32 : 64;
                if (burst > data->blksz)
                        burst = data->blksz;
 
@@ -1104,8 +1121,7 @@ static void mmc_omap_set_power(struct mmc_omap_slot *slot, int power_on,
        if (slot->pdata->set_power != NULL)
                slot->pdata->set_power(mmc_dev(slot->mmc), slot->id, power_on,
                                        vdd);
-
-       if (cpu_is_omap24xx()) {
+       if (mmc_omap2()) {
                u16 w;
 
                if (power_on) {
@@ -1239,7 +1255,7 @@ static int __devinit mmc_omap_new_slot(struct mmc_omap_host *host, int id)
        mmc->ops = &mmc_omap_ops;
        mmc->f_min = 400000;
 
-       if (cpu_class_is_omap2())
+       if (mmc_omap2())
                mmc->f_max = 48000000;
        else
                mmc->f_max = 24000000;
@@ -1359,6 +1375,7 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev)
        init_waitqueue_head(&host->slot_wq);
 
        host->pdata = pdata;
+       host->features = host->pdata->slots[0].features;
        host->dev = &pdev->dev;
        platform_set_drvdata(pdev, host);
 
@@ -1391,7 +1408,7 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev)
        host->dma_tx_burst = -1;
        host->dma_rx_burst = -1;
 
-       if (cpu_is_omap24xx())
+       if (mmc_omap2())
                sig = host->id == 0 ? OMAP24XX_DMA_MMC1_TX : OMAP24XX_DMA_MMC2_TX;
        else
                sig = host->id == 0 ? OMAP_DMA_MMC_TX : OMAP_DMA_MMC2_TX;
@@ -1407,7 +1424,7 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev)
                dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n",
                        sig);
 #endif
-       if (cpu_is_omap24xx())
+       if (mmc_omap2())
                sig = host->id == 0 ? OMAP24XX_DMA_MMC1_RX : OMAP24XX_DMA_MMC2_RX;
        else
                sig = host->id == 0 ? OMAP_DMA_MMC_RX : OMAP_DMA_MMC2_RX;
@@ -1435,7 +1452,7 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev)
        }
 
        host->nr_slots = pdata->nr_slots;
-       host->reg_shift = (cpu_is_omap7xx() ? 1 : 2);
+       host->reg_shift = (mmc_omap7xx() ? 1 : 2);
 
        host->mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0);
        if (!host->mmc_omap_wq)
index 54bfd0cc106b92280cd75818310d81aa56c48ccb..e7c185233b181c98e1f62c2ae92f39f8ea211fb2 100644 (file)
@@ -38,9 +38,7 @@
 #include <linux/gpio.h>
 #include <linux/regulator/consumer.h>
 #include <linux/pm_runtime.h>
-#include <mach/hardware.h>
-#include <plat/mmc.h>
-#include <plat/cpu.h>
+#include <linux/platform_data/mmc-omap.h>
 
 /* OMAP HSMMC Host Controller Registers */
 #define OMAP_HSMMC_SYSSTATUS   0x0014
@@ -178,7 +176,8 @@ struct omap_hsmmc_host {
 
 static int omap_hsmmc_card_detect(struct device *dev, int slot)
 {
-       struct omap_mmc_platform_data *mmc = dev->platform_data;
+       struct omap_hsmmc_host *host = dev_get_drvdata(dev);
+       struct omap_mmc_platform_data *mmc = host->pdata;
 
        /* NOTE: assumes card detect signal is active-low */
        return !gpio_get_value_cansleep(mmc->slots[0].switch_pin);
@@ -186,7 +185,8 @@ static int omap_hsmmc_card_detect(struct device *dev, int slot)
 
 static int omap_hsmmc_get_wp(struct device *dev, int slot)
 {
-       struct omap_mmc_platform_data *mmc = dev->platform_data;
+       struct omap_hsmmc_host *host = dev_get_drvdata(dev);
+       struct omap_mmc_platform_data *mmc = host->pdata;
 
        /* NOTE: assumes write protect signal is active-high */
        return gpio_get_value_cansleep(mmc->slots[0].gpio_wp);
@@ -194,7 +194,8 @@ static int omap_hsmmc_get_wp(struct device *dev, int slot)
 
 static int omap_hsmmc_get_cover_state(struct device *dev, int slot)
 {
-       struct omap_mmc_platform_data *mmc = dev->platform_data;
+       struct omap_hsmmc_host *host = dev_get_drvdata(dev);
+       struct omap_mmc_platform_data *mmc = host->pdata;
 
        /* NOTE: assumes card detect signal is active-low */
        return !gpio_get_value_cansleep(mmc->slots[0].switch_pin);
@@ -204,7 +205,8 @@ static int omap_hsmmc_get_cover_state(struct device *dev, int slot)
 
 static int omap_hsmmc_suspend_cdirq(struct device *dev, int slot)
 {
-       struct omap_mmc_platform_data *mmc = dev->platform_data;
+       struct omap_hsmmc_host *host = dev_get_drvdata(dev);
+       struct omap_mmc_platform_data *mmc = host->pdata;
 
        disable_irq(mmc->slots[0].card_detect_irq);
        return 0;
@@ -212,7 +214,8 @@ static int omap_hsmmc_suspend_cdirq(struct device *dev, int slot)
 
 static int omap_hsmmc_resume_cdirq(struct device *dev, int slot)
 {
-       struct omap_mmc_platform_data *mmc = dev->platform_data;
+       struct omap_hsmmc_host *host = dev_get_drvdata(dev);
+       struct omap_mmc_platform_data *mmc = host->pdata;
 
        enable_irq(mmc->slots[0].card_detect_irq);
        return 0;
@@ -2009,9 +2012,9 @@ static int __devexit omap_hsmmc_remove(struct platform_device *pdev)
                clk_put(host->dbclk);
        }
 
-       mmc_free_host(host->mmc);
+       omap_hsmmc_gpio_free(host->pdata);
        iounmap(host->base);
-       omap_hsmmc_gpio_free(pdev->dev.platform_data);
+       mmc_free_host(host->mmc);
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (res)
index 90140eb03e36a2766ffc40470271a0e63be34845..8fd50a211037126df4a4beea26dd6fc3aaa71c94 100644 (file)
@@ -19,6 +19,7 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <linux/err.h>
 #include <linux/io.h>
 #include <linux/clk.h>
 #include <linux/err.h>
@@ -84,30 +85,32 @@ static int __devinit sdhci_dove_probe(struct platform_device *pdev)
        struct sdhci_dove_priv *priv;
        int ret;
 
-       ret = sdhci_pltfm_register(pdev, &sdhci_dove_pdata);
-       if (ret)
-               goto sdhci_dove_register_fail;
-
        priv = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_dove_priv),
                            GFP_KERNEL);
        if (!priv) {
                dev_err(&pdev->dev, "unable to allocate private data");
-               ret = -ENOMEM;
-               goto sdhci_dove_allocate_fail;
+               return -ENOMEM;
        }
 
+       priv->clk = clk_get(&pdev->dev, NULL);
+       if (!IS_ERR(priv->clk))
+               clk_prepare_enable(priv->clk);
+
+       ret = sdhci_pltfm_register(pdev, &sdhci_dove_pdata);
+       if (ret)
+               goto sdhci_dove_register_fail;
+
        host = platform_get_drvdata(pdev);
        pltfm_host = sdhci_priv(host);
        pltfm_host->priv = priv;
 
-       priv->clk = clk_get(&pdev->dev, NULL);
-       if (!IS_ERR(priv->clk))
-               clk_prepare_enable(priv->clk);
        return 0;
 
-sdhci_dove_allocate_fail:
-       sdhci_pltfm_unregister(pdev);
 sdhci_dove_register_fail:
+       if (!IS_ERR(priv->clk)) {
+               clk_disable_unprepare(priv->clk);
+               clk_put(priv->clk);
+       }
        return ret;
 }
 
@@ -117,14 +120,13 @@ static int __devexit sdhci_dove_remove(struct platform_device *pdev)
        struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
        struct sdhci_dove_priv *priv = pltfm_host->priv;
 
-       if (priv->clk) {
-               if (!IS_ERR(priv->clk)) {
-                       clk_disable_unprepare(priv->clk);
-                       clk_put(priv->clk);
-               }
-               devm_kfree(&pdev->dev, priv->clk);
+       sdhci_pltfm_unregister(pdev);
+
+       if (!IS_ERR(priv->clk)) {
+               clk_disable_unprepare(priv->clk);
+               clk_put(priv->clk);
        }
-       return sdhci_pltfm_unregister(pdev);
+       return 0;
 }
 
 static const struct of_device_id sdhci_dove_of_match_table[] __devinitdata = {
index ae5fcbfa1eef5986ec832616ed1ad350106e64ef..63d219f57caebcd3a4cd0216ec17aca2500cb257 100644 (file)
@@ -169,6 +169,16 @@ static void esdhc_of_resume(struct sdhci_host *host)
 }
 #endif
 
+static void esdhc_of_platform_init(struct sdhci_host *host)
+{
+       u32 vvn;
+
+       vvn = in_be32(host->ioaddr + SDHCI_SLOT_INT_STATUS);
+       vvn = (vvn & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT;
+       if (vvn == VENDOR_V_22)
+               host->quirks2 |= SDHCI_QUIRK2_HOST_NO_CMD23;
+}
+
 static struct sdhci_ops sdhci_esdhc_ops = {
        .read_l = esdhc_readl,
        .read_w = esdhc_readw,
@@ -180,6 +190,7 @@ static struct sdhci_ops sdhci_esdhc_ops = {
        .enable_dma = esdhc_of_enable_dma,
        .get_max_clock = esdhc_of_get_max_clock,
        .get_min_clock = esdhc_of_get_min_clock,
+       .platform_init = esdhc_of_platform_init,
 #ifdef CONFIG_PM
        .platform_suspend = esdhc_of_suspend,
        .platform_resume = esdhc_of_resume,
index 4bb74b042a06483cb3cea750dac26f56c4ab68cd..04936f353ced53461a35545b22add0460c582d3a 100644 (file)
@@ -1196,7 +1196,7 @@ static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot(
                return ERR_PTR(-ENODEV);
        }
 
-       if (pci_resource_len(pdev, bar) != 0x100) {
+       if (pci_resource_len(pdev, bar) < 0x100) {
                dev_err(&pdev->dev, "Invalid iomem size. You may "
                        "experience problems.\n");
        }
index 65551a9709ccc86e893be96dfead3fe2919677e3..27164457f861dce37da3e12b00b399bf81b00e1e 100644 (file)
@@ -150,6 +150,13 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
                goto err_remap;
        }
 
+       /*
+        * Some platforms need to probe the controller to be able to
+        * determine which caps should be used.
+        */
+       if (host->ops && host->ops->platform_init)
+               host->ops->platform_init(host);
+
        platform_set_drvdata(pdev, host);
 
        return host;
index 2903949594c6a1d3168d5a021c82ebec795ed138..a54dd5d7a5f94b1b3e550e799ee95999c5e54df8 100644 (file)
@@ -211,8 +211,8 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock)
        if (ourhost->cur_clk != best_src) {
                struct clk *clk = ourhost->clk_bus[best_src];
 
-               clk_enable(clk);
-               clk_disable(ourhost->clk_bus[ourhost->cur_clk]);
+               clk_prepare_enable(clk);
+               clk_disable_unprepare(ourhost->clk_bus[ourhost->cur_clk]);
 
                /* turn clock off to card before changing clock source */
                writew(0, host->ioaddr + SDHCI_CLOCK_CONTROL);
@@ -607,7 +607,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
        }
 
        /* enable the local io clock and keep it running for the moment. */
-       clk_enable(sc->clk_io);
+       clk_prepare_enable(sc->clk_io);
 
        for (clks = 0, ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
                struct clk *clk;
@@ -638,7 +638,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
        }
 
 #ifndef CONFIG_PM_RUNTIME
-       clk_enable(sc->clk_bus[sc->cur_clk]);
+       clk_prepare_enable(sc->clk_bus[sc->cur_clk]);
 #endif
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -747,13 +747,14 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
                sdhci_s3c_setup_card_detect_gpio(sc);
 
 #ifdef CONFIG_PM_RUNTIME
-       clk_disable(sc->clk_io);
+       if (pdata->cd_type != S3C_SDHCI_CD_INTERNAL)
+               clk_disable_unprepare(sc->clk_io);
 #endif
        return 0;
 
  err_req_regs:
 #ifndef CONFIG_PM_RUNTIME
-       clk_disable(sc->clk_bus[sc->cur_clk]);
+       clk_disable_unprepare(sc->clk_bus[sc->cur_clk]);
 #endif
        for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
                if (sc->clk_bus[ptr]) {
@@ -762,7 +763,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
        }
 
  err_no_busclks:
-       clk_disable(sc->clk_io);
+       clk_disable_unprepare(sc->clk_io);
        clk_put(sc->clk_io);
 
  err_io_clk:
@@ -794,7 +795,8 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
                gpio_free(sc->ext_cd_gpio);
 
 #ifdef CONFIG_PM_RUNTIME
-       clk_enable(sc->clk_io);
+       if (pdata->cd_type != S3C_SDHCI_CD_INTERNAL)
+               clk_prepare_enable(sc->clk_io);
 #endif
        sdhci_remove_host(host, 1);
 
@@ -802,14 +804,14 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
        pm_runtime_disable(&pdev->dev);
 
 #ifndef CONFIG_PM_RUNTIME
-       clk_disable(sc->clk_bus[sc->cur_clk]);
+       clk_disable_unprepare(sc->clk_bus[sc->cur_clk]);
 #endif
        for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
                if (sc->clk_bus[ptr]) {
                        clk_put(sc->clk_bus[ptr]);
                }
        }
-       clk_disable(sc->clk_io);
+       clk_disable_unprepare(sc->clk_io);
        clk_put(sc->clk_io);
 
        if (pdev->dev.of_node) {
@@ -849,8 +851,8 @@ static int sdhci_s3c_runtime_suspend(struct device *dev)
 
        ret = sdhci_runtime_suspend_host(host);
 
-       clk_disable(ourhost->clk_bus[ourhost->cur_clk]);
-       clk_disable(busclk);
+       clk_disable_unprepare(ourhost->clk_bus[ourhost->cur_clk]);
+       clk_disable_unprepare(busclk);
        return ret;
 }
 
@@ -861,8 +863,8 @@ static int sdhci_s3c_runtime_resume(struct device *dev)
        struct clk *busclk = ourhost->clk_io;
        int ret;
 
-       clk_enable(busclk);
-       clk_enable(ourhost->clk_bus[ourhost->cur_clk]);
+       clk_prepare_enable(busclk);
+       clk_prepare_enable(ourhost->clk_bus[ourhost->cur_clk]);
        ret = sdhci_runtime_resume_host(host);
        return ret;
 }
index 7922adb4238625c1b4c9e1d489dea04a3d0e2353..c7851c0aabce52226d118d50bbe95fe61b4094c2 100644 (file)
@@ -1315,16 +1315,19 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
                 */
                if ((host->flags & SDHCI_NEEDS_RETUNING) &&
                    !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) {
-                       /* eMMC uses cmd21 while sd and sdio use cmd19 */
-                       tuning_opcode = mmc->card->type == MMC_TYPE_MMC ?
-                               MMC_SEND_TUNING_BLOCK_HS200 :
-                               MMC_SEND_TUNING_BLOCK;
-                       spin_unlock_irqrestore(&host->lock, flags);
-                       sdhci_execute_tuning(mmc, tuning_opcode);
-                       spin_lock_irqsave(&host->lock, flags);
-
-                       /* Restore original mmc_request structure */
-                       host->mrq = mrq;
+                       if (mmc->card) {
+                               /* eMMC uses cmd21 but sd and sdio use cmd19 */
+                               tuning_opcode =
+                                       mmc->card->type == MMC_TYPE_MMC ?
+                                       MMC_SEND_TUNING_BLOCK_HS200 :
+                                       MMC_SEND_TUNING_BLOCK;
+                               spin_unlock_irqrestore(&host->lock, flags);
+                               sdhci_execute_tuning(mmc, tuning_opcode);
+                               spin_lock_irqsave(&host->lock, flags);
+
+                               /* Restore original mmc_request structure */
+                               host->mrq = mrq;
+                       }
                }
 
                if (mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23))
@@ -2837,6 +2840,9 @@ int sdhci_add_host(struct sdhci_host *host)
        if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))
                mmc->caps |= MMC_CAP_4_BIT_DATA;
 
+       if (host->quirks2 & SDHCI_QUIRK2_HOST_NO_CMD23)
+               mmc->caps &= ~MMC_CAP_CMD23;
+
        if (caps[0] & SDHCI_CAN_DO_HISPD)
                mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
 
@@ -2846,9 +2852,12 @@ int sdhci_add_host(struct sdhci_host *host)
 
        /* If vqmmc regulator and no 1.8V signalling, then there's no UHS */
        host->vqmmc = regulator_get(mmc_dev(mmc), "vqmmc");
-       if (IS_ERR(host->vqmmc)) {
-               pr_info("%s: no vqmmc regulator found\n", mmc_hostname(mmc));
-               host->vqmmc = NULL;
+       if (IS_ERR_OR_NULL(host->vqmmc)) {
+               if (PTR_ERR(host->vqmmc) < 0) {
+                       pr_info("%s: no vqmmc regulator found\n",
+                               mmc_hostname(mmc));
+                       host->vqmmc = NULL;
+               }
        }
        else if (regulator_is_supported_voltage(host->vqmmc, 1800000, 1800000))
                regulator_enable(host->vqmmc);
@@ -2904,9 +2913,12 @@ int sdhci_add_host(struct sdhci_host *host)
        ocr_avail = 0;
 
        host->vmmc = regulator_get(mmc_dev(mmc), "vmmc");
-       if (IS_ERR(host->vmmc)) {
-               pr_info("%s: no vmmc regulator found\n", mmc_hostname(mmc));
-               host->vmmc = NULL;
+       if (IS_ERR_OR_NULL(host->vmmc)) {
+               if (PTR_ERR(host->vmmc) < 0) {
+                       pr_info("%s: no vmmc regulator found\n",
+                               mmc_hostname(mmc));
+                       host->vmmc = NULL;
+               }
        } else
                regulator_enable(host->vmmc);
 
index 97653ea8942ba82393f47b6291942e28c2435204..71a4a7ed46c5095653ce43e90ffd6754815f98da 100644 (file)
@@ -278,6 +278,7 @@ struct sdhci_ops {
        void    (*hw_reset)(struct sdhci_host *host);
        void    (*platform_suspend)(struct sdhci_host *host);
        void    (*platform_resume)(struct sdhci_host *host);
+       void    (*platform_init)(struct sdhci_host *host);
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
index 11d2bc3b51d578a357fd9b857084db1a89a91741..d25bc97dc5c60063bb609b22973e41790ced9762 100644 (file)
@@ -1466,9 +1466,9 @@ static int __devexit sh_mmcif_remove(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, NULL);
 
+       clk_disable(host->hclk);
        mmc_free_host(host->mmc);
        pm_runtime_put_sync(&pdev->dev);
-       clk_disable(host->hclk);
        pm_runtime_disable(&pdev->dev);
 
        return 0;
index 72e31d86030d9c2e2b7f9cb20302b4b7955877f0..022dcdc256fb68932634242ccff9d86d37dfcb74 100644 (file)
 
 #include <asm/mach/flash.h>
 #include <linux/platform_data/mtd-mxc_nand.h>
-#include <mach/hardware.h>
 
 #define DRIVER_NAME "mxc_nand"
 
-#define nfc_is_v21()           (cpu_is_mx25() || cpu_is_mx35())
-#define nfc_is_v1()            (cpu_is_mx31() || cpu_is_mx27() || cpu_is_mx21())
-#define nfc_is_v3_2a()         cpu_is_mx51()
-#define nfc_is_v3_2b()         cpu_is_mx53()
-
 /* Addresses for NFC registers */
 #define NFC_V1_V2_BUF_SIZE             (host->regs + 0x00)
 #define NFC_V1_V2_BUF_ADDR             (host->regs + 0x04)
@@ -1283,6 +1277,53 @@ static const struct mxc_nand_devtype_data imx53_nand_devtype_data = {
        .ppb_shift = 8,
 };
 
+static inline int is_imx21_nfc(struct mxc_nand_host *host)
+{
+       return host->devtype_data == &imx21_nand_devtype_data;
+}
+
+static inline int is_imx27_nfc(struct mxc_nand_host *host)
+{
+       return host->devtype_data == &imx27_nand_devtype_data;
+}
+
+static inline int is_imx25_nfc(struct mxc_nand_host *host)
+{
+       return host->devtype_data == &imx25_nand_devtype_data;
+}
+
+static inline int is_imx51_nfc(struct mxc_nand_host *host)
+{
+       return host->devtype_data == &imx51_nand_devtype_data;
+}
+
+static inline int is_imx53_nfc(struct mxc_nand_host *host)
+{
+       return host->devtype_data == &imx53_nand_devtype_data;
+}
+
+static struct platform_device_id mxcnd_devtype[] = {
+       {
+               .name = "imx21-nand",
+               .driver_data = (kernel_ulong_t) &imx21_nand_devtype_data,
+       }, {
+               .name = "imx27-nand",
+               .driver_data = (kernel_ulong_t) &imx27_nand_devtype_data,
+       }, {
+               .name = "imx25-nand",
+               .driver_data = (kernel_ulong_t) &imx25_nand_devtype_data,
+       }, {
+               .name = "imx51-nand",
+               .driver_data = (kernel_ulong_t) &imx51_nand_devtype_data,
+       }, {
+               .name = "imx53-nand",
+               .driver_data = (kernel_ulong_t) &imx53_nand_devtype_data,
+       }, {
+               /* sentinel */
+       }
+};
+MODULE_DEVICE_TABLE(platform, mxcnd_devtype);
+
 #ifdef CONFIG_OF_MTD
 static const struct of_device_id mxcnd_dt_ids[] = {
        {
@@ -1337,32 +1378,6 @@ static int __init mxcnd_probe_dt(struct mxc_nand_host *host)
 }
 #endif
 
-static int __init mxcnd_probe_pdata(struct mxc_nand_host *host)
-{
-       struct mxc_nand_platform_data *pdata = host->dev->platform_data;
-
-       if (!pdata)
-               return -ENODEV;
-
-       host->pdata = *pdata;
-
-       if (nfc_is_v1()) {
-               if (cpu_is_mx21())
-                       host->devtype_data = &imx21_nand_devtype_data;
-               else
-                       host->devtype_data = &imx27_nand_devtype_data;
-       } else if (nfc_is_v21()) {
-               host->devtype_data = &imx25_nand_devtype_data;
-       } else if (nfc_is_v3_2a()) {
-               host->devtype_data = &imx51_nand_devtype_data;
-       } else if (nfc_is_v3_2b()) {
-               host->devtype_data = &imx53_nand_devtype_data;
-       } else
-               BUG();
-
-       return 0;
-}
-
 static int __devinit mxcnd_probe(struct platform_device *pdev)
 {
        struct nand_chip *this;
@@ -1404,8 +1419,16 @@ static int __devinit mxcnd_probe(struct platform_device *pdev)
                return PTR_ERR(host->clk);
 
        err = mxcnd_probe_dt(host);
-       if (err > 0)
-               err = mxcnd_probe_pdata(host);
+       if (err > 0) {
+               struct mxc_nand_platform_data *pdata = pdev->dev.platform_data;
+               if (pdata) {
+                       host->pdata = *pdata;
+                       host->devtype_data = (struct mxc_nand_devtype_data *)
+                                               pdev->id_entry->driver_data;
+               } else {
+                       err = -ENODEV;
+               }
+       }
        if (err < 0)
                return err;
 
@@ -1494,7 +1517,7 @@ static int __devinit mxcnd_probe(struct platform_device *pdev)
        }
 
        /* first scan to find the device and get the page size */
-       if (nand_scan_ident(mtd, nfc_is_v21() ? 4 : 1, NULL)) {
+       if (nand_scan_ident(mtd, is_imx25_nfc(host) ? 4 : 1, NULL)) {
                err = -ENXIO;
                goto escan;
        }
@@ -1508,7 +1531,7 @@ static int __devinit mxcnd_probe(struct platform_device *pdev)
                this->ecc.layout = host->devtype_data->ecclayout_4k;
 
        if (this->ecc.mode == NAND_ECC_HW) {
-               if (nfc_is_v1())
+               if (is_imx21_nfc(host) || is_imx27_nfc(host))
                        this->ecc.strength = 1;
                else
                        this->ecc.strength = (host->eccsize == 4) ? 4 : 8;
@@ -1555,6 +1578,7 @@ static struct platform_driver mxcnd_driver = {
                   .owner = THIS_MODULE,
                   .of_match_table = of_match_ptr(mxcnd_dt_ids),
        },
+       .id_table = mxcnd_devtype,
        .probe = mxcnd_probe,
        .remove = __devexit_p(mxcnd_remove),
 };
index 5b3138620646af9b5b7c544529a3ae9250858745..5c8978e90240904b2e4642fcc9c8520a838b42da 100644 (file)
@@ -27,8 +27,7 @@
 #include <linux/bch.h>
 #endif
 
-#include <plat/dma.h>
-#include <plat/gpmc.h>
+#include <plat-omap/dma-omap.h>
 #include <linux/platform_data/mtd-nand-omap2.h>
 
 #define        DRIVER_NAME     "omap2-nand"
 #define        CS_MASK                         0x7
 #define        ENABLE_PREFETCH                 (0x1 << 7)
 #define        DMA_MPU_MODE_SHIFT              2
+#define        ECCSIZE0_SHIFT                  12
 #define        ECCSIZE1_SHIFT                  22
 #define        ECC1RESULTSIZE                  0x1
 #define        ECCCLEAR                        0x100
 #define        ECC1                            0x1
+#define        PREFETCH_FIFOTHRESHOLD_MAX      0x40
+#define        PREFETCH_FIFOTHRESHOLD(val)     ((val) << 8)
+#define        PREFETCH_STATUS_COUNT(val)      (val & 0x00003fff)
+#define        PREFETCH_STATUS_FIFO_CNT(val)   ((val >> 24) & 0x7F)
+#define        STATUS_BUFF_EMPTY               0x00000001
+
+#define OMAP24XX_DMA_GPMC              4
 
 /* oob info generated runtime depending on ecc algorithm and layout selected */
 static struct nand_ecclayout omap_oobinfo;
@@ -269,7 +276,7 @@ static void omap_write_buf8(struct mtd_info *mtd, const u_char *buf, int len)
                /* wait until buffer is available for write */
                do {
                        status = readl(info->reg.gpmc_status) &
-                                       GPMC_STATUS_BUFF_EMPTY;
+                                       STATUS_BUFF_EMPTY;
                } while (!status);
        }
 }
@@ -307,7 +314,7 @@ static void omap_write_buf16(struct mtd_info *mtd, const u_char * buf, int len)
                /* wait until buffer is available for write */
                do {
                        status = readl(info->reg.gpmc_status) &
-                                       GPMC_STATUS_BUFF_EMPTY;
+                                       STATUS_BUFF_EMPTY;
                } while (!status);
        }
 }
@@ -348,7 +355,7 @@ static void omap_read_buf_pref(struct mtd_info *mtd, u_char *buf, int len)
        } else {
                do {
                        r_count = readl(info->reg.gpmc_prefetch_status);
-                       r_count = GPMC_PREFETCH_STATUS_FIFO_CNT(r_count);
+                       r_count = PREFETCH_STATUS_FIFO_CNT(r_count);
                        r_count = r_count >> 2;
                        ioread32_rep(info->nand.IO_ADDR_R, p, r_count);
                        p += r_count;
@@ -395,7 +402,7 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
        } else {
                while (len) {
                        w_count = readl(info->reg.gpmc_prefetch_status);
-                       w_count = GPMC_PREFETCH_STATUS_FIFO_CNT(w_count);
+                       w_count = PREFETCH_STATUS_FIFO_CNT(w_count);
                        w_count = w_count >> 1;
                        for (i = 0; (i < w_count) && len; i++, len -= 2)
                                iowrite16(*p++, info->nand.IO_ADDR_W);
@@ -407,7 +414,7 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
                do {
                        cpu_relax();
                        val = readl(info->reg.gpmc_prefetch_status);
-                       val = GPMC_PREFETCH_STATUS_COUNT(val);
+                       val = PREFETCH_STATUS_COUNT(val);
                } while (val && (tim++ < limit));
 
                /* disable and stop the PFPW engine */
@@ -493,7 +500,7 @@ static inline int omap_nand_dma_transfer(struct mtd_info *mtd, void *addr,
        do {
                cpu_relax();
                val = readl(info->reg.gpmc_prefetch_status);
-               val = GPMC_PREFETCH_STATUS_COUNT(val);
+               val = PREFETCH_STATUS_COUNT(val);
        } while (val && (tim++ < limit));
 
        /* disable and stop the PFPW engine */
@@ -556,7 +563,7 @@ static irqreturn_t omap_nand_irq(int this_irq, void *dev)
        u32 bytes;
 
        bytes = readl(info->reg.gpmc_prefetch_status);
-       bytes = GPMC_PREFETCH_STATUS_FIFO_CNT(bytes);
+       bytes = PREFETCH_STATUS_FIFO_CNT(bytes);
        bytes = bytes  & 0xFFFC; /* io in multiple of 4 bytes */
        if (info->iomode == OMAP_NAND_IO_WRITE) { /* checks for write io */
                if (this_irq == info->gpmc_irq_count)
@@ -682,7 +689,7 @@ static void omap_write_buf_irq_pref(struct mtd_info *mtd,
        limit = (loops_per_jiffy *  msecs_to_jiffies(OMAP_NAND_TIMEOUT_MS));
        do {
                val = readl(info->reg.gpmc_prefetch_status);
-               val = GPMC_PREFETCH_STATUS_COUNT(val);
+               val = PREFETCH_STATUS_COUNT(val);
                cpu_relax();
        } while (val && (tim++ < limit));
 
@@ -996,7 +1003,7 @@ static int omap_wait(struct mtd_info *mtd, struct nand_chip *chip)
                cond_resched();
        }
 
-       status = gpmc_nand_read(info->gpmc_cs, GPMC_NAND_DATA);
+       status = readb(info->reg.gpmc_nand_data);
        return status;
 }
 
@@ -1029,19 +1036,45 @@ static int omap_dev_ready(struct mtd_info *mtd)
 static void omap3_enable_hwecc_bch(struct mtd_info *mtd, int mode)
 {
        int nerrors;
-       unsigned int dev_width;
+       unsigned int dev_width, nsectors;
        struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
                                                   mtd);
        struct nand_chip *chip = mtd->priv;
+       u32 val;
 
        nerrors = (info->nand.ecc.bytes == 13) ? 8 : 4;
        dev_width = (chip->options & NAND_BUSWIDTH_16) ? 1 : 0;
+       nsectors = 1;
        /*
         * Program GPMC to perform correction on one 512-byte sector at a time.
         * Using 4 sectors at a time (i.e. ecc.size = 2048) is also possible and
         * gives a slight (5%) performance gain (but requires additional code).
         */
-       (void)gpmc_enable_hwecc_bch(info->gpmc_cs, mode, dev_width, 1, nerrors);
+
+       writel(ECC1, info->reg.gpmc_ecc_control);
+
+       /*
+        * When using BCH, sector size is hardcoded to 512 bytes.
+        * Here we are using wrapping mode 6 both for reading and writing, with:
+        *  size0 = 0  (no additional protected byte in spare area)
+        *  size1 = 32 (skip 32 nibbles = 16 bytes per sector in spare area)
+        */
+       val = (32 << ECCSIZE1_SHIFT) | (0 << ECCSIZE0_SHIFT);
+       writel(val, info->reg.gpmc_ecc_size_config);
+
+       /* BCH configuration */
+       val = ((1                        << 16) | /* enable BCH */
+              (((nerrors == 8) ? 1 : 0) << 12) | /* 8 or 4 bits */
+              (0x06                     <<  8) | /* wrap mode = 6 */
+              (dev_width                <<  7) | /* bus width */
+              (((nsectors-1) & 0x7)     <<  4) | /* number of sectors */
+              (info->gpmc_cs            <<  1) | /* ECC CS */
+              (0x1));                            /* enable ECC */
+
+       writel(val, info->reg.gpmc_ecc_config);
+
+       /* clear ecc and enable bits */
+       writel(ECCCLEAR | ECC1, info->reg.gpmc_ecc_control);
 }
 
 /**
@@ -1055,7 +1088,32 @@ static int omap3_calculate_ecc_bch4(struct mtd_info *mtd, const u_char *dat,
 {
        struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
                                                   mtd);
-       return gpmc_calculate_ecc_bch4(info->gpmc_cs, dat, ecc_code);
+       unsigned long nsectors, val1, val2;
+       int i;
+
+       nsectors = ((readl(info->reg.gpmc_ecc_config) >> 4) & 0x7) + 1;
+
+       for (i = 0; i < nsectors; i++) {
+
+               /* Read hw-computed remainder */
+               val1 = readl(info->reg.gpmc_bch_result0[i]);
+               val2 = readl(info->reg.gpmc_bch_result1[i]);
+
+               /*
+                * Add constant polynomial to remainder, in order to get an ecc
+                * sequence of 0xFFs for a buffer filled with 0xFFs; and
+                * left-justify the resulting polynomial.
+                */
+               *ecc_code++ = 0x28 ^ ((val2 >> 12) & 0xFF);
+               *ecc_code++ = 0x13 ^ ((val2 >>  4) & 0xFF);
+               *ecc_code++ = 0xcc ^ (((val2 & 0xF) << 4)|((val1 >> 28) & 0xF));
+               *ecc_code++ = 0x39 ^ ((val1 >> 20) & 0xFF);
+               *ecc_code++ = 0x96 ^ ((val1 >> 12) & 0xFF);
+               *ecc_code++ = 0xac ^ ((val1 >> 4) & 0xFF);
+               *ecc_code++ = 0x7f ^ ((val1 & 0xF) << 4);
+       }
+
+       return 0;
 }
 
 /**
@@ -1069,7 +1127,39 @@ static int omap3_calculate_ecc_bch8(struct mtd_info *mtd, const u_char *dat,
 {
        struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
                                                   mtd);
-       return gpmc_calculate_ecc_bch8(info->gpmc_cs, dat, ecc_code);
+       unsigned long nsectors, val1, val2, val3, val4;
+       int i;
+
+       nsectors = ((readl(info->reg.gpmc_ecc_config) >> 4) & 0x7) + 1;
+
+       for (i = 0; i < nsectors; i++) {
+
+               /* Read hw-computed remainder */
+               val1 = readl(info->reg.gpmc_bch_result0[i]);
+               val2 = readl(info->reg.gpmc_bch_result1[i]);
+               val3 = readl(info->reg.gpmc_bch_result2[i]);
+               val4 = readl(info->reg.gpmc_bch_result3[i]);
+
+               /*
+                * Add constant polynomial to remainder, in order to get an ecc
+                * sequence of 0xFFs for a buffer filled with 0xFFs.
+                */
+               *ecc_code++ = 0xef ^ (val4 & 0xFF);
+               *ecc_code++ = 0x51 ^ ((val3 >> 24) & 0xFF);
+               *ecc_code++ = 0x2e ^ ((val3 >> 16) & 0xFF);
+               *ecc_code++ = 0x09 ^ ((val3 >> 8) & 0xFF);
+               *ecc_code++ = 0xed ^ (val3 & 0xFF);
+               *ecc_code++ = 0x93 ^ ((val2 >> 24) & 0xFF);
+               *ecc_code++ = 0x9a ^ ((val2 >> 16) & 0xFF);
+               *ecc_code++ = 0xc2 ^ ((val2 >> 8) & 0xFF);
+               *ecc_code++ = 0x97 ^ (val2 & 0xFF);
+               *ecc_code++ = 0x79 ^ ((val1 >> 24) & 0xFF);
+               *ecc_code++ = 0xe5 ^ ((val1 >> 16) & 0xFF);
+               *ecc_code++ = 0x24 ^ ((val1 >> 8) & 0xFF);
+               *ecc_code++ = 0xb5 ^ (val1 & 0xFF);
+       }
+
+       return 0;
 }
 
 /**
@@ -1125,7 +1215,7 @@ static void omap3_free_bch(struct mtd_info *mtd)
  */
 static int omap3_init_bch(struct mtd_info *mtd, int ecc_opt)
 {
-       int ret, max_errors;
+       int max_errors;
        struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
                                                   mtd);
 #ifdef CONFIG_MTD_NAND_OMAP_BCH8
@@ -1142,11 +1232,6 @@ static int omap3_init_bch(struct mtd_info *mtd, int ecc_opt)
                goto fail;
        }
 
-       /* initialize GPMC BCH engine */
-       ret = gpmc_init_hwecc_bch(info->gpmc_cs, 1, max_errors);
-       if (ret)
-               goto fail;
-
        /* software bch library is only used to detect and locate errors */
        info->bch = init_bch(13, max_errors, 0x201b /* hw polynomial */);
        if (!info->bch)
@@ -1513,7 +1598,7 @@ static int omap_nand_remove(struct platform_device *pdev)
        /* Release NAND device, its internal structures and partitions */
        nand_release(&info->mtd);
        iounmap(info->nand.IO_ADDR_R);
-       release_mem_region(info->phys_base, NAND_IO_SIZE);
+       release_mem_region(info->phys_base, info->mem_size);
        kfree(info);
        return 0;
 }
index 1961be985171ce1e11abb77c9c164373cb7d4cd2..99f96e19ebea8bd2b6704aa61c0f97da52dbb69b 100644 (file)
 #include <linux/regulator/consumer.h>
 
 #include <asm/mach/flash.h>
-#include <plat/gpmc.h>
 #include <linux/platform_data/mtd-onenand-omap2.h>
 #include <asm/gpio.h>
 
-#include <plat/dma.h>
-#include <plat/cpu.h>
+#include <plat-omap/dma-omap.h>
 
 #define DRIVER_NAME "omap2-onenand"
 
@@ -63,6 +61,7 @@ struct omap2_onenand {
        int freq;
        int (*setup)(void __iomem *base, int *freq_ptr);
        struct regulator *regulator;
+       u8 flags;
 };
 
 static void omap2_onenand_dma_cb(int lch, u16 ch_status, void *data)
@@ -155,7 +154,7 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state)
                if (!(syscfg & ONENAND_SYS_CFG1_IOBE)) {
                        syscfg |= ONENAND_SYS_CFG1_IOBE;
                        write_reg(c, syscfg, ONENAND_REG_SYS_CFG1);
-                       if (cpu_is_omap34xx())
+                       if (c->flags & ONENAND_IN_OMAP34XX)
                                /* Add a delay to let GPIO settle */
                                syscfg = read_reg(c, ONENAND_REG_SYS_CFG1);
                }
@@ -446,13 +445,19 @@ out_copy:
 
 #else
 
-int omap3_onenand_read_bufferram(struct mtd_info *mtd, int area,
-                                unsigned char *buffer, int offset,
-                                size_t count);
+static int omap3_onenand_read_bufferram(struct mtd_info *mtd, int area,
+                                       unsigned char *buffer, int offset,
+                                       size_t count)
+{
+       return -ENOSYS;
+}
 
-int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area,
-                                 const unsigned char *buffer,
-                                 int offset, size_t count);
+static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area,
+                                        const unsigned char *buffer,
+                                        int offset, size_t count)
+{
+       return -ENOSYS;
+}
 
 #endif
 
@@ -550,13 +555,19 @@ static int omap2_onenand_write_bufferram(struct mtd_info *mtd, int area,
 
 #else
 
-int omap2_onenand_read_bufferram(struct mtd_info *mtd, int area,
-                                unsigned char *buffer, int offset,
-                                size_t count);
+static int omap2_onenand_read_bufferram(struct mtd_info *mtd, int area,
+                                       unsigned char *buffer, int offset,
+                                       size_t count)
+{
+       return -ENOSYS;
+}
 
-int omap2_onenand_write_bufferram(struct mtd_info *mtd, int area,
-                                 const unsigned char *buffer,
-                                 int offset, size_t count);
+static int omap2_onenand_write_bufferram(struct mtd_info *mtd, int area,
+                                        const unsigned char *buffer,
+                                        int offset, size_t count)
+{
+       return -ENOSYS;
+}
 
 #endif
 
@@ -639,6 +650,7 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
 
        init_completion(&c->irq_done);
        init_completion(&c->dma_done);
+       c->flags = pdata->flags;
        c->gpmc_cs = pdata->cs;
        c->gpio_irq = pdata->gpio_irq;
        c->dma_channel = pdata->dma_channel;
@@ -729,7 +741,7 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
        this = &c->onenand;
        if (c->dma_channel >= 0) {
                this->wait = omap2_onenand_wait;
-               if (cpu_is_omap34xx()) {
+               if (c->flags & ONENAND_IN_OMAP34XX) {
                        this->read_bufferram = omap3_onenand_read_bufferram;
                        this->write_bufferram = omap3_onenand_write_bufferram;
                } else {
@@ -803,7 +815,6 @@ static int __devexit omap2_onenand_remove(struct platform_device *pdev)
        }
        iounmap(c->onenand.base);
        release_mem_region(c->phys_base, c->mem_size);
-       gpmc_cs_free(c->gpmc_cs);
        kfree(c);
 
        return 0;
index dc15d248443fd833ae17199a41f28ab6712b5d5c..ef8d2a080d17f4c61b8f28aa7e07bc54ed5c0abc 100644 (file)
@@ -1060,7 +1060,7 @@ static ssize_t bonding_store_primary(struct device *d,
                goto out;
        }
 
-       sscanf(buf, "%16s", ifname); /* IFNAMSIZ */
+       sscanf(buf, "%15s", ifname); /* IFNAMSIZ */
 
        /* check to see if we are clearing primary */
        if (!strlen(ifname) || buf[0] == '\n') {
@@ -1237,7 +1237,7 @@ static ssize_t bonding_store_active_slave(struct device *d,
                goto out;
        }
 
-       sscanf(buf, "%16s", ifname); /* IFNAMSIZ */
+       sscanf(buf, "%15s", ifname); /* IFNAMSIZ */
 
        /* check to see if we are clearing active */
        if (!strlen(ifname) || buf[0] == '\n') {
index c65295dded39aa5b1965a9dd07e00974863ca297..6e5bdd1a31d92c499c43fa40bc11a95bf7034bb7 100644 (file)
@@ -1702,7 +1702,7 @@ static int bnx2x_set_eee(struct net_device *dev, struct ethtool_eee *edata)
                                      SHMEM_EEE_ADV_STATUS_SHIFT);
        if ((advertised != (eee_cfg & SHMEM_EEE_ADV_STATUS_MASK))) {
                DP(BNX2X_MSG_ETHTOOL,
-                  "Direct manipulation of EEE advertisment is not supported\n");
+                  "Direct manipulation of EEE advertisement is not supported\n");
                return -EINVAL;
        }
 
index e2e45ee5df33fcc75c491c78643dfe406297aabb..f6cfdc6cf20ffd88f6f4472452f27f97067afe60 100644 (file)
 #define LINK_20GTFD            LINK_STATUS_SPEED_AND_DUPLEX_20GTFD
 #define LINK_20GXFD            LINK_STATUS_SPEED_AND_DUPLEX_20GXFD
 
-
+#define LINK_UPDATE_MASK \
+                       (LINK_STATUS_SPEED_AND_DUPLEX_MASK | \
+                        LINK_STATUS_LINK_UP | \
+                        LINK_STATUS_PHYSICAL_LINK_FLAG | \
+                        LINK_STATUS_AUTO_NEGOTIATE_COMPLETE | \
+                        LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK | \
+                        LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK | \
+                        LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK | \
+                        LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE | \
+                        LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE)
 
 #define SFP_EEPROM_CON_TYPE_ADDR               0x2
        #define SFP_EEPROM_CON_TYPE_VAL_LC      0x7
@@ -3295,6 +3304,21 @@ static void bnx2x_serdes_deassert(struct bnx2x *bp, u8 port)
               DEFAULT_PHY_DEV_ADDR);
 }
 
+static void bnx2x_xgxs_specific_func(struct bnx2x_phy *phy,
+                                    struct link_params *params,
+                                    u32 action)
+{
+       struct bnx2x *bp = params->bp;
+       switch (action) {
+       case PHY_INIT:
+               /* Set correct devad */
+               REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST + params->port*0x18, 0);
+               REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + params->port*0x18,
+                      phy->def_md_devad);
+               break;
+       }
+}
+
 static void bnx2x_xgxs_deassert(struct link_params *params)
 {
        struct bnx2x *bp = params->bp;
@@ -3309,10 +3333,8 @@ static void bnx2x_xgxs_deassert(struct link_params *params)
        REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_CLEAR, val);
        udelay(500);
        REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_SET, val);
-
-       REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST + port*0x18, 0);
-       REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + port*0x18,
-              params->phy[INT_PHY].def_md_devad);
+       bnx2x_xgxs_specific_func(&params->phy[INT_PHY], params,
+                                PHY_INIT);
 }
 
 static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy,
@@ -3545,14 +3567,11 @@ static void bnx2x_warpcore_set_lpi_passthrough(struct bnx2x_phy *phy,
 static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy,
                                        struct link_params *params,
                                        struct link_vars *vars) {
-       u16 val16 = 0, lane, i;
+       u16 lane, i, cl72_ctrl, an_adv = 0;
+       u16 ucode_ver;
        struct bnx2x *bp = params->bp;
        static struct bnx2x_reg_set reg_set[] = {
                {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7},
-               {MDIO_AN_DEVAD, MDIO_WC_REG_PAR_DET_10G_CTRL, 0},
-               {MDIO_WC_DEVAD, MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, 0},
-               {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL0, 0xff},
-               {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL1, 0x5555},
                {MDIO_PMA_DEVAD, MDIO_WC_REG_IEEE0BLK_AUTONEGNP, 0x0},
                {MDIO_WC_DEVAD, MDIO_WC_REG_RX66_CONTROL, 0x7415},
                {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_MISC2, 0x6190},
@@ -3565,12 +3584,19 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy,
                bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
                                 reg_set[i].val);
 
+       bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
+               MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, &cl72_ctrl);
+       cl72_ctrl &= 0xf8ff;
+       cl72_ctrl |= 0x3800;
+       bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
+               MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, cl72_ctrl);
+
        /* Check adding advertisement for 1G KX */
        if (((vars->line_speed == SPEED_AUTO_NEG) &&
             (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_1G)) ||
            (vars->line_speed == SPEED_1000)) {
                u32 addr = MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2;
-               val16 |= (1<<5);
+               an_adv |= (1<<5);
 
                /* Enable CL37 1G Parallel Detect */
                bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, addr, 0x1);
@@ -3580,11 +3606,14 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy,
             (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)) ||
            (vars->line_speed ==  SPEED_10000)) {
                /* Check adding advertisement for 10G KR */
-               val16 |= (1<<7);
+               an_adv |= (1<<7);
                /* Enable 10G Parallel Detect */
+               CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK,
+                                 MDIO_AER_BLOCK_AER_REG, 0);
+
                bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD,
                                 MDIO_WC_REG_PAR_DET_10G_CTRL, 1);
-
+               bnx2x_set_aer_mmd(params, phy);
                DP(NETIF_MSG_LINK, "Advertize 10G\n");
        }
 
@@ -3604,7 +3633,7 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy,
 
        /* Advertised speeds */
        bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD,
-                        MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, val16);
+                        MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, an_adv);
 
        /* Advertised and set FEC (Forward Error Correction) */
        bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD,
@@ -3628,9 +3657,10 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy,
        /* Set KR Autoneg Work-Around flag for Warpcore version older than D108
         */
        bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
-                       MDIO_WC_REG_UC_INFO_B1_VERSION, &val16);
-       if (val16 < 0xd108) {
-               DP(NETIF_MSG_LINK, "Enable AN KR work-around\n");
+                       MDIO_WC_REG_UC_INFO_B1_VERSION, &ucode_ver);
+       if (ucode_ver < 0xd108) {
+               DP(NETIF_MSG_LINK, "Enable AN KR work-around. WC ver:0x%x\n",
+                              ucode_ver);
                vars->rx_tx_asic_rst = MAX_KR_LINK_RETRY;
        }
        bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,
@@ -3651,21 +3681,16 @@ static void bnx2x_warpcore_set_10G_KR(struct bnx2x_phy *phy,
                                      struct link_vars *vars)
 {
        struct bnx2x *bp = params->bp;
-       u16 i;
+       u16 val16, i, lane;
        static struct bnx2x_reg_set reg_set[] = {
                /* Disable Autoneg */
                {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7},
-               {MDIO_AN_DEVAD, MDIO_WC_REG_PAR_DET_10G_CTRL, 0},
                {MDIO_WC_DEVAD, MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL,
                        0x3f00},
                {MDIO_AN_DEVAD, MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, 0},
                {MDIO_AN_DEVAD, MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x0},
                {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL3_UP1, 0x1},
                {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL5_MISC7, 0xa},
-               /* Disable CL36 PCS Tx */
-               {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL0, 0x0},
-               /* Double Wide Single Data Rate @ pll rate */
-               {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL1, 0xFFFF},
                /* Leave cl72 training enable, needed for KR */
                {MDIO_PMA_DEVAD,
                MDIO_WC_REG_PMD_IEEE9BLK_TENGBASE_KR_PMD_CONTROL_REGISTER_150,
@@ -3676,11 +3701,24 @@ static void bnx2x_warpcore_set_10G_KR(struct bnx2x_phy *phy,
                bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
                                 reg_set[i].val);
 
-       /* Leave CL72 enabled */
-       bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,
-                                MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL,
-                                0x3800);
+       lane = bnx2x_get_warpcore_lane(phy, params);
+       /* Global registers */
+       CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK,
+                         MDIO_AER_BLOCK_AER_REG, 0);
+       /* Disable CL36 PCS Tx */
+       bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
+                       MDIO_WC_REG_XGXSBLK1_LANECTRL0, &val16);
+       val16 &= ~(0x0011 << lane);
+       bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
+                        MDIO_WC_REG_XGXSBLK1_LANECTRL0, val16);
 
+       bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
+                       MDIO_WC_REG_XGXSBLK1_LANECTRL1, &val16);
+       val16 |= (0x0303 << (lane << 1));
+       bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
+                        MDIO_WC_REG_XGXSBLK1_LANECTRL1, val16);
+       /* Restore AER */
+       bnx2x_set_aer_mmd(params, phy);
        /* Set speed via PMA/PMD register */
        bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD,
                         MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x2040);
@@ -4303,7 +4341,7 @@ static void bnx2x_warpcore_link_reset(struct bnx2x_phy *phy,
                                      struct link_params *params)
 {
        struct bnx2x *bp = params->bp;
-       u16 val16;
+       u16 val16, lane;
        bnx2x_sfp_e3_set_transmitter(params, phy, 0);
        bnx2x_set_mdio_clk(bp, params->chip_id, params->port);
        bnx2x_set_aer_mmd(params, phy);
@@ -4340,6 +4378,30 @@ static void bnx2x_warpcore_link_reset(struct bnx2x_phy *phy,
                         MDIO_WC_REG_XGXSBLK1_LANECTRL2,
                         val16 & 0xff00);
 
+       lane = bnx2x_get_warpcore_lane(phy, params);
+       /* Disable CL36 PCS Tx */
+       bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
+                       MDIO_WC_REG_XGXSBLK1_LANECTRL0, &val16);
+       val16 |= (0x11 << lane);
+       if (phy->flags & FLAGS_WC_DUAL_MODE)
+               val16 |= (0x22 << lane);
+       bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
+                        MDIO_WC_REG_XGXSBLK1_LANECTRL0, val16);
+
+       bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
+                       MDIO_WC_REG_XGXSBLK1_LANECTRL1, &val16);
+       val16 &= ~(0x0303 << (lane << 1));
+       val16 |= (0x0101 << (lane << 1));
+       if (phy->flags & FLAGS_WC_DUAL_MODE) {
+               val16 &= ~(0x0c0c << (lane << 1));
+               val16 |= (0x0404 << (lane << 1));
+       }
+
+       bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
+                        MDIO_WC_REG_XGXSBLK1_LANECTRL1, val16);
+       /* Restore AER */
+       bnx2x_set_aer_mmd(params, phy);
+
 }
 
 static void bnx2x_set_warpcore_loopback(struct bnx2x_phy *phy,
@@ -6296,15 +6358,7 @@ static int bnx2x_update_link_down(struct link_params *params,
        vars->mac_type = MAC_TYPE_NONE;
 
        /* Update shared memory */
-       vars->link_status &= ~(LINK_STATUS_SPEED_AND_DUPLEX_MASK |
-                              LINK_STATUS_LINK_UP |
-                              LINK_STATUS_PHYSICAL_LINK_FLAG |
-                              LINK_STATUS_AUTO_NEGOTIATE_COMPLETE |
-                              LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK |
-                              LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK |
-                              LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK |
-                              LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE |
-                              LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE);
+       vars->link_status &= ~LINK_UPDATE_MASK;
        vars->line_speed = 0;
        bnx2x_update_mng(params, vars->link_status);
 
@@ -6452,6 +6506,7 @@ int bnx2x_link_update(struct link_params *params, struct link_vars *vars)
        u16 ext_phy_line_speed = 0, prev_line_speed = vars->line_speed;
        u8 active_external_phy = INT_PHY;
        vars->phy_flags &= ~PHY_HALF_OPEN_CONN_FLAG;
+       vars->link_status &= ~LINK_UPDATE_MASK;
        for (phy_index = INT_PHY; phy_index < params->num_phys;
              phy_index++) {
                phy_vars[phy_index].flow_ctrl = 0;
@@ -7579,7 +7634,7 @@ static void bnx2x_warpcore_power_module(struct link_params *params,
 static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy,
                                                 struct link_params *params,
                                                 u16 addr, u8 byte_cnt,
-                                                u8 *o_buf)
+                                                u8 *o_buf, u8 is_init)
 {
        int rc = 0;
        u8 i, j = 0, cnt = 0;
@@ -7596,10 +7651,10 @@ static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy,
        /* 4 byte aligned address */
        addr32 = addr & (~0x3);
        do {
-               if (cnt == I2C_WA_PWR_ITER) {
+               if ((!is_init) && (cnt == I2C_WA_PWR_ITER)) {
                        bnx2x_warpcore_power_module(params, phy, 0);
                        /* Note that 100us are not enough here */
-                       usleep_range(1000,1000);
+                       usleep_range(1000, 2000);
                        bnx2x_warpcore_power_module(params, phy, 1);
                }
                rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt,
@@ -7719,7 +7774,7 @@ int bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy,
        break;
        case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT:
                rc = bnx2x_warpcore_read_sfp_module_eeprom(phy, params, addr,
-                                                          byte_cnt, o_buf);
+                                                          byte_cnt, o_buf, 0);
        break;
        }
        return rc;
@@ -7923,6 +7978,7 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy,
 
 {
        u8 val;
+       int rc;
        struct bnx2x *bp = params->bp;
        u16 timeout;
        /* Initialization time after hot-plug may take up to 300ms for
@@ -7930,8 +7986,14 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy,
         */
 
        for (timeout = 0; timeout < 60; timeout++) {
-               if (bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, &val)
-                   == 0) {
+               if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT)
+                       rc = bnx2x_warpcore_read_sfp_module_eeprom(phy,
+                                                                  params, 1,
+                                                                  1, &val, 1);
+               else
+                       rc = bnx2x_read_sfp_module_eeprom(phy, params, 1, 1,
+                                                         &val);
+               if (rc == 0) {
                        DP(NETIF_MSG_LINK,
                           "SFP+ module initialization took %d ms\n",
                           timeout * 5);
@@ -7939,7 +8001,8 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy,
                }
                usleep_range(5000, 10000);
        }
-       return -EINVAL;
+       rc = bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, &val);
+       return rc;
 }
 
 static void bnx2x_8727_power_module(struct bnx2x *bp,
@@ -9878,7 +9941,7 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy,
                else
                        rc = bnx2x_8483x_disable_eee(phy, params, vars);
                if (rc) {
-                       DP(NETIF_MSG_LINK, "Failed to set EEE advertisment\n");
+                       DP(NETIF_MSG_LINK, "Failed to set EEE advertisement\n");
                        return rc;
                }
        } else {
@@ -10993,7 +11056,7 @@ static struct bnx2x_phy phy_xgxs = {
        .format_fw_ver  = (format_fw_ver_t)NULL,
        .hw_reset       = (hw_reset_t)NULL,
        .set_link_led   = (set_link_led_t)NULL,
-       .phy_specific_func = (phy_specific_func_t)NULL
+       .phy_specific_func = (phy_specific_func_t)bnx2x_xgxs_specific_func
 };
 static struct bnx2x_phy phy_warpcore = {
        .type           = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT,
@@ -11465,6 +11528,11 @@ static int bnx2x_populate_int_phy(struct bnx2x *bp, u32 shmem_base, u8 port,
                        phy->media_type = ETH_PHY_BASE_T;
                        break;
                case PORT_HW_CFG_NET_SERDES_IF_XFI:
+                       phy->supported &= (SUPPORTED_1000baseT_Full |
+                                          SUPPORTED_10000baseT_Full |
+                                          SUPPORTED_FIBRE |
+                                          SUPPORTED_Pause |
+                                          SUPPORTED_Asym_Pause);
                        phy->media_type = ETH_PHY_XFP_FIBER;
                        break;
                case PORT_HW_CFG_NET_SERDES_IF_SFI:
@@ -12919,7 +12987,7 @@ static u8 bnx2x_analyze_link_error(struct link_params *params,
                DP(NETIF_MSG_LINK, "Analyze TX Fault\n");
                break;
        default:
-               DP(NETIF_MSG_LINK, "Analyze UNKOWN\n");
+               DP(NETIF_MSG_LINK, "Analyze UNKNOWN\n");
        }
        DP(NETIF_MSG_LINK, "Link changed:[%x %x]->%x\n", vars->link_up,
           old_status, status);
index d5648fc666bdf6f663505bbb433abebac08dbd48..bd1fd3d87c24d3979f01a0e9864af9866c62b9aa 100644 (file)
@@ -6794,8 +6794,9 @@ static int bnx2x_init_hw_port(struct bnx2x *bp)
 
        bnx2x_init_block(bp, BLOCK_DORQ, init_phase);
 
+       bnx2x_init_block(bp, BLOCK_BRB1, init_phase);
+
        if (CHIP_IS_E1(bp) || CHIP_IS_E1H(bp)) {
-               bnx2x_init_block(bp, BLOCK_BRB1, init_phase);
 
                if (IS_MF(bp))
                        low = ((bp->flags & ONE_PORT_FLAG) ? 160 : 246);
@@ -11902,7 +11903,15 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
        /* disable FCOE L2 queue for E1x */
        if (CHIP_IS_E1x(bp))
                bp->flags |= NO_FCOE_FLAG;
-
+       /* disable FCOE for 57840 device, until FW supports it */
+       switch (ent->driver_data) {
+       case BCM57840_O:
+       case BCM57840_4_10:
+       case BCM57840_2_20:
+       case BCM57840_MFO:
+       case BCM57840_MF:
+               bp->flags |= NO_FCOE_FLAG;
+       }
 #endif
 
 
index c1cde11b0c6d5114e62ba400caab0195905ada3d..0df1284df497d8247fbf602d6578381099619d06 100644 (file)
@@ -3415,16 +3415,6 @@ static int adap_init0_config(struct adapter *adapter, int reset)
                         "mismatch: [fini] csum=%#x, computed csum=%#x\n",
                         finicsum, cfcsum);
 
-       /*
-        * If we're a pure NIC driver then disable all offloading facilities.
-        * This will allow the firmware to optimize aspects of the hardware
-        * configuration which will result in improved performance.
-        */
-       caps_cmd.ofldcaps = 0;
-       caps_cmd.iscsicaps = 0;
-       caps_cmd.rdmacaps = 0;
-       caps_cmd.fcoecaps = 0;
-
        /*
         * And now tell the firmware to use the configuration we just loaded.
         */
index 32eec15fe4c2cd8425f89661231797e96007c5b1..730ae2cfa49e34ee5d361d73ac437ff715d4e50d 100644 (file)
@@ -2519,6 +2519,7 @@ int t4_fw_bye(struct adapter *adap, unsigned int mbox)
 {
        struct fw_bye_cmd c;
 
+       memset(&c, 0, sizeof(c));
        INIT_CMD(c, BYE, WRITE);
        return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
 }
@@ -2535,6 +2536,7 @@ int t4_early_init(struct adapter *adap, unsigned int mbox)
 {
        struct fw_initialize_cmd c;
 
+       memset(&c, 0, sizeof(c));
        INIT_CMD(c, INITIALIZE, WRITE);
        return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
 }
@@ -2551,6 +2553,7 @@ int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset)
 {
        struct fw_reset_cmd c;
 
+       memset(&c, 0, sizeof(c));
        INIT_CMD(c, RESET, WRITE);
        c.val = htonl(reset);
        return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
@@ -2828,7 +2831,7 @@ int t4_fixup_host_params(struct adapter *adap, unsigned int page_size,
                     HOSTPAGESIZEPF7(sge_hps));
 
        t4_set_reg_field(adap, SGE_CONTROL,
-                        INGPADBOUNDARY(INGPADBOUNDARY_MASK) |
+                        INGPADBOUNDARY_MASK |
                         EGRSTATUSPAGESIZE_MASK,
                         INGPADBOUNDARY(fl_align_log - 5) |
                         EGRSTATUSPAGESIZE(stat_len != 64));
@@ -3278,6 +3281,7 @@ int t4_identify_port(struct adapter *adap, unsigned int mbox, unsigned int viid,
 {
        struct fw_vi_enable_cmd c;
 
+       memset(&c, 0, sizeof(c));
        c.op_to_viid = htonl(FW_CMD_OP(FW_VI_ENABLE_CMD) | FW_CMD_REQUEST |
                             FW_CMD_EXEC | FW_VI_ENABLE_CMD_VIID(viid));
        c.ien_to_len16 = htonl(FW_VI_ENABLE_CMD_LED | FW_LEN16(c));
index 1d03dcdd5e5686bb6e76cb71069607a44d8d4eb2..19ac096cb07b702fd988d53a224d03119c674e59 100644 (file)
@@ -1353,8 +1353,11 @@ static int gfar_restore(struct device *dev)
        struct gfar_private *priv = dev_get_drvdata(dev);
        struct net_device *ndev = priv->ndev;
 
-       if (!netif_running(ndev))
+       if (!netif_running(ndev)) {
+               netif_device_attach(ndev);
+
                return 0;
+       }
 
        gfar_init_bds(ndev);
        init_registers(ndev);
index 56b20d17d0e4c5577828040fddf8bd294868c84d..116f0e901bee2305324c4fa9035d19e6c5676b37 100644 (file)
@@ -2673,6 +2673,9 @@ static int ixgbe_get_ts_info(struct net_device *dev,
        case ixgbe_mac_X540:
        case ixgbe_mac_82599EB:
                info->so_timestamping =
+                       SOF_TIMESTAMPING_TX_SOFTWARE |
+                       SOF_TIMESTAMPING_RX_SOFTWARE |
+                       SOF_TIMESTAMPING_SOFTWARE |
                        SOF_TIMESTAMPING_TX_HARDWARE |
                        SOF_TIMESTAMPING_RX_HARDWARE |
                        SOF_TIMESTAMPING_RAW_HARDWARE;
index f8064df10cc4ca1d1c6bcf05b42858ae5c9071fc..92317e9c0f736821f605a4e3008b089b1ba9cb63 100644 (file)
@@ -1948,10 +1948,10 @@ jme_close(struct net_device *netdev)
 
        JME_NAPI_DISABLE(jme);
 
-       tasklet_disable(&jme->linkch_task);
-       tasklet_disable(&jme->txclean_task);
-       tasklet_disable(&jme->rxclean_task);
-       tasklet_disable(&jme->rxempty_task);
+       tasklet_kill(&jme->linkch_task);
+       tasklet_kill(&jme->txclean_task);
+       tasklet_kill(&jme->rxclean_task);
+       tasklet_kill(&jme->rxempty_task);
 
        jme_disable_rx_engine(jme);
        jme_disable_tx_engine(jme);
index 9b9c2ac5c4c214d65366782c05d6406a1859cb17..d19a143aa5a8690db119630228f40bd896d1f84f 100644 (file)
@@ -4026,7 +4026,7 @@ static void __devexit skge_remove(struct pci_dev *pdev)
        dev0 = hw->dev[0];
        unregister_netdev(dev0);
 
-       tasklet_disable(&hw->phy_task);
+       tasklet_kill(&hw->phy_task);
 
        spin_lock_irq(&hw->hw_lock);
        hw->intr_mask = 0;
index 318fee91c79dad0eeaa6673bd04adb68e43b6f63..e558edd1cb6c106d643f6b16413b67f26dfeb778 100644 (file)
@@ -5407,8 +5407,8 @@ static int netdev_close(struct net_device *dev)
                /* Delay for receive task to stop scheduling itself. */
                msleep(2000 / HZ);
 
-               tasklet_disable(&hw_priv->rx_tasklet);
-               tasklet_disable(&hw_priv->tx_tasklet);
+               tasklet_kill(&hw_priv->rx_tasklet);
+               tasklet_kill(&hw_priv->tx_tasklet);
                free_irq(dev->irq, hw_priv->dev);
 
                transmit_cleanup(hw_priv, 0);
index 53743f7a2ca9604d6f264de3a2e3c727556a0619..af8b4142088c3d6a9114fd8c218336f54fcbcc19 100644 (file)
@@ -1524,6 +1524,7 @@ static int lpc_eth_drv_remove(struct platform_device *pdev)
                                  pldat->dma_buff_base_p);
        free_irq(ndev->irq, ndev);
        iounmap(pldat->net_base);
+       mdiobus_unregister(pldat->mii_bus);
        mdiobus_free(pldat->mii_bus);
        clk_disable(pldat->clk);
        clk_put(pldat->clk);
index e7ff886e8047ac3d3a926e8c0384b3ec7568068b..927aa33d43497eae636a6d3b4a0e93e15fc93b27 100644 (file)
@@ -3827,6 +3827,8 @@ static void rtl_wol_suspend_quirk(struct rtl8169_private *tp)
        void __iomem *ioaddr = tp->mmio_addr;
 
        switch (tp->mac_version) {
+       case RTL_GIGA_MAC_VER_25:
+       case RTL_GIGA_MAC_VER_26:
        case RTL_GIGA_MAC_VER_29:
        case RTL_GIGA_MAC_VER_30:
        case RTL_GIGA_MAC_VER_32:
@@ -4519,6 +4521,9 @@ static void rtl_set_rx_mode(struct net_device *dev)
                mc_filter[1] = swab32(data);
        }
 
+       if (tp->mac_version == RTL_GIGA_MAC_VER_35)
+               mc_filter[1] = mc_filter[0] = 0xffffffff;
+
        RTL_W32(MAR0 + 4, mc_filter[1]);
        RTL_W32(MAR0 + 0, mc_filter[0]);
 
index 0793299bd39ec9489908a206b073c32e0e8b3923..1d04754a6637ad5b815db648ee3aa75a75a68485 100644 (file)
@@ -990,7 +990,7 @@ static int axienet_stop(struct net_device *ndev)
        axienet_setoptions(ndev, lp->options &
                           ~(XAE_OPTION_TXEN | XAE_OPTION_RXEN));
 
-       tasklet_disable(&lp->dma_err_tasklet);
+       tasklet_kill(&lp->dma_err_tasklet);
 
        free_irq(lp->tx_irq, ndev);
        free_irq(lp->rx_irq, ndev);
index daec9b05d168ca4f0f103f3638fcc3259e9ea304..6428fcbbdd4bf4f6967e7eb3fee32e97fceba566 100644 (file)
@@ -234,6 +234,7 @@ void free_mdio_bitbang(struct mii_bus *bus)
        struct mdiobb_ctrl *ctrl = bus->priv;
 
        module_put(ctrl->ops->owner);
+       mdiobus_unregister(bus);
        mdiobus_free(bus);
 }
 EXPORT_SYMBOL(free_mdio_bitbang);
index c81e278629ff8595b6e246878e805ed51874a5c7..08d55b6bf272bc5293a8a8d059d54d652aca27e1 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/usb/cdc.h>
 #include <linux/usb/usbnet.h>
 #include <linux/gfp.h>
+#include <linux/if_vlan.h>
 
 
 /*
@@ -92,7 +93,7 @@ static int eem_bind(struct usbnet *dev, struct usb_interface *intf)
 
        /* no jumbogram (16K) support for now */
 
-       dev->net->hard_header_len += EEM_HEAD + ETH_FCS_LEN;
+       dev->net->hard_header_len += EEM_HEAD + ETH_FCS_LEN + VLAN_HLEN;
        dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
 
        return 0;
index 7479a5761d0d6b35c9a275ae470e49dc959de366..3286166415b479969cf0624a522baf3b6a97eb73 100644 (file)
@@ -1344,6 +1344,7 @@ static struct sk_buff *smsc95xx_tx_fixup(struct usbnet *dev,
                } else {
                        u32 csum_preamble = smsc95xx_calc_csum_preamble(skb);
                        skb_push(skb, 4);
+                       cpu_to_le32s(&csum_preamble);
                        memcpy(skb->data, &csum_preamble, 4);
                }
        }
index cb04f900cc461990255cd788d92437ddc1ce4afa..edb81ed06950624a182ad1e298f2f54d142804e7 100644 (file)
@@ -359,10 +359,12 @@ static enum skb_state defer_bh(struct usbnet *dev, struct sk_buff *skb,
 void usbnet_defer_kevent (struct usbnet *dev, int work)
 {
        set_bit (work, &dev->flags);
-       if (!schedule_work (&dev->kevent))
-               netdev_err(dev->net, "kevent %d may have been dropped\n", work);
-       else
+       if (!schedule_work (&dev->kevent)) {
+               if (net_ratelimit())
+                       netdev_err(dev->net, "kevent %d may have been dropped\n", work);
+       } else {
                netdev_dbg(dev->net, "kevent %d scheduled\n", work);
+       }
 }
 EXPORT_SYMBOL_GPL(usbnet_defer_kevent);
 
index ce9d4f2c9776e08d1b543f18de8cb7100fe43a86..0ae1bcc6da730fecd4267f0076b3f3ef422ea7ce 100644 (file)
@@ -744,28 +744,43 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx,
 
        for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
                const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
+               u32 buf_size;
 
-               tbi = tq->buf_info + tq->tx_ring.next2fill;
-               tbi->map_type = VMXNET3_MAP_PAGE;
-               tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag,
-                                                0, skb_frag_size(frag),
-                                                DMA_TO_DEVICE);
+               buf_offset = 0;
+               len = skb_frag_size(frag);
+               while (len) {
+                       tbi = tq->buf_info + tq->tx_ring.next2fill;
+                       if (len < VMXNET3_MAX_TX_BUF_SIZE) {
+                               buf_size = len;
+                               dw2 |= len;
+                       } else {
+                               buf_size = VMXNET3_MAX_TX_BUF_SIZE;
+                               /* spec says that for TxDesc.len, 0 == 2^14 */
+                       }
+                       tbi->map_type = VMXNET3_MAP_PAGE;
+                       tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag,
+                                                        buf_offset, buf_size,
+                                                        DMA_TO_DEVICE);
 
-               tbi->len = skb_frag_size(frag);
+                       tbi->len = buf_size;
 
-               gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
-               BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
+                       gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
+                       BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
 
-               gdesc->txd.addr = cpu_to_le64(tbi->dma_addr);
-               gdesc->dword[2] = cpu_to_le32(dw2 | skb_frag_size(frag));
-               gdesc->dword[3] = 0;
+                       gdesc->txd.addr = cpu_to_le64(tbi->dma_addr);
+                       gdesc->dword[2] = cpu_to_le32(dw2);
+                       gdesc->dword[3] = 0;
 
-               dev_dbg(&adapter->netdev->dev,
-                       "txd[%u]: 0x%llu %u %u\n",
-                       tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr),
-                       le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]);
-               vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
-               dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
+                       dev_dbg(&adapter->netdev->dev,
+                               "txd[%u]: 0x%llu %u %u\n",
+                               tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr),
+                               le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]);
+                       vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
+                       dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
+
+                       len -= buf_size;
+                       buf_offset += buf_size;
+               }
        }
 
        ctx->eop_txd = gdesc;
@@ -886,6 +901,18 @@ vmxnet3_prepare_tso(struct sk_buff *skb,
        }
 }
 
+static int txd_estimate(const struct sk_buff *skb)
+{
+       int count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) + 1;
+       int i;
+
+       for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
+               const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
+
+               count += VMXNET3_TXD_NEEDED(skb_frag_size(frag));
+       }
+       return count;
+}
 
 /*
  * Transmits a pkt thru a given tq
@@ -914,9 +941,7 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
        union Vmxnet3_GenericDesc tempTxDesc;
 #endif
 
-       /* conservatively estimate # of descriptors to use */
-       count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) +
-               skb_shinfo(skb)->nr_frags + 1;
+       count = txd_estimate(skb);
 
        ctx.ipv4 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IP));
 
index 607976c001626a75afbf590411bf6ec1bbff26c0..7b4adde93c016b7e020306220e372524da9f5deb 100644 (file)
@@ -816,7 +816,7 @@ static void vxlan_cleanup(unsigned long arg)
                                = container_of(p, struct vxlan_fdb, hlist);
                        unsigned long timeout;
 
-                       if (f->state == NUD_PERMANENT)
+                       if (f->state & NUD_PERMANENT)
                                continue;
 
                        timeout = f->used + vxlan->age_interval * HZ;
index 378bd70256b2c7b8ad6358b2488919198dc42950..741918a2027b56ebe0f561d5175e8a129b8a3059 100644 (file)
@@ -312,6 +312,7 @@ static struct ath_buf *ath_tx_get_buffer(struct ath_softc *sc)
        }
 
        bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list);
+       bf->bf_next = NULL;
        list_del(&bf->list);
 
        spin_unlock_bh(&sc->tx.txbuflock);
@@ -393,7 +394,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
        u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0, seq_first;
        u32 ba[WME_BA_BMP_SIZE >> 5];
        int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0;
-       bool rc_update = true;
+       bool rc_update = true, isba;
        struct ieee80211_tx_rate rates[4];
        struct ath_frame_info *fi;
        int nframes;
@@ -437,13 +438,17 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
        tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK;
        tid = ATH_AN_2_TID(an, tidno);
        seq_first = tid->seq_start;
+       isba = ts->ts_flags & ATH9K_TX_BA;
 
        /*
         * The hardware occasionally sends a tx status for the wrong TID.
         * In this case, the BA status cannot be considered valid and all
         * subframes need to be retransmitted
+        *
+        * Only BlockAcks have a TID and therefore normal Acks cannot be
+        * checked
         */
-       if (tidno != ts->tid)
+       if (isba && tidno != ts->tid)
                txok = false;
 
        isaggr = bf_isaggr(bf);
@@ -1774,6 +1779,7 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
        list_add_tail(&bf->list, &bf_head);
        bf->bf_state.bf_type = 0;
 
+       bf->bf_next = NULL;
        bf->bf_lastbf = bf;
        ath_tx_fill_desc(sc, bf, txq, fi->framelen);
        ath_tx_txqaddbuf(sc, txq, &bf_head, false);
index 192251adf986c97579539025055f91c592f189bd..282eedec675ee17fae313655797716ad1617eec0 100644 (file)
@@ -382,7 +382,7 @@ static void cancel_transfers(struct b43legacy_pioqueue *queue)
 {
        struct b43legacy_pio_txpacket *packet, *tmp_packet;
 
-       tasklet_disable(&queue->txtask);
+       tasklet_kill(&queue->txtask);
 
        list_for_each_entry_safe(packet, tmp_packet, &queue->txrunning, list)
                free_txpacket(packet, 0);
index 01dc8891070c3729c37b08cce18506ab583c4761..59474ae0aec0d14e7dfc2639c19cf65b82b3b7ea 100644 (file)
@@ -2449,7 +2449,7 @@ static int rt2800_get_gain_calibration_delta(struct rt2x00_dev *rt2x00dev)
        /*
         * Check if temperature compensation is supported.
         */
-       if (tssi_bounds[4] == 0xff)
+       if (tssi_bounds[4] == 0xff || step == 0xff)
                return 0;
 
        /*
index 6241fd05bd4108cde7ff14366eb169a00cb80138..a543746fb354d99913cac3323b99b6f5aa71dbc9 100644 (file)
@@ -320,10 +320,7 @@ void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
                } else
                        next = dev->bus_list.next;
 
-               /* Run device routines with the device locked */
-               device_lock(&dev->dev);
                retval = cb(dev, userdata);
-               device_unlock(&dev->dev);
                if (retval)
                        break;
        }
index 94c6e2aa03d658defb5d30b0f2fbb1f8383cf9d0..6c94fc9489e709b2ad5f42817d8f29ef21c9a9b6 100644 (file)
@@ -398,6 +398,8 @@ static void pci_device_shutdown(struct device *dev)
        struct pci_dev *pci_dev = to_pci_dev(dev);
        struct pci_driver *drv = pci_dev->driver;
 
+       pm_runtime_resume(dev);
+
        if (drv && drv->shutdown)
                drv->shutdown(pci_dev);
        pci_msi_shutdown(pci_dev);
@@ -408,16 +410,6 @@ static void pci_device_shutdown(struct device *dev)
         * continue to do DMA
         */
        pci_disable_device(pci_dev);
-
-       /*
-        * Devices may be enabled to wake up by runtime PM, but they need not
-        * be supposed to wake up the system from its "power off" state (e.g.
-        * ACPI S5).  Therefore disable wakeup for all devices that aren't
-        * supposed to wake up the system at this point.  The state argument
-        * will be ignored by pci_enable_wake().
-        */
-       if (!device_may_wakeup(dev))
-               pci_enable_wake(pci_dev, PCI_UNKNOWN, false);
 }
 
 #ifdef CONFIG_PM
index 02d107b152818e948cc3e561d276bf24126ac997..f39378d9da1500056a90f4816f742e9e5ee9626f 100644 (file)
@@ -458,40 +458,6 @@ boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf)
 }
 struct device_attribute vga_attr = __ATTR_RO(boot_vga);
 
-static void
-pci_config_pm_runtime_get(struct pci_dev *pdev)
-{
-       struct device *dev = &pdev->dev;
-       struct device *parent = dev->parent;
-
-       if (parent)
-               pm_runtime_get_sync(parent);
-       pm_runtime_get_noresume(dev);
-       /*
-        * pdev->current_state is set to PCI_D3cold during suspending,
-        * so wait until suspending completes
-        */
-       pm_runtime_barrier(dev);
-       /*
-        * Only need to resume devices in D3cold, because config
-        * registers are still accessible for devices suspended but
-        * not in D3cold.
-        */
-       if (pdev->current_state == PCI_D3cold)
-               pm_runtime_resume(dev);
-}
-
-static void
-pci_config_pm_runtime_put(struct pci_dev *pdev)
-{
-       struct device *dev = &pdev->dev;
-       struct device *parent = dev->parent;
-
-       pm_runtime_put(dev);
-       if (parent)
-               pm_runtime_put_sync(parent);
-}
-
 static ssize_t
 pci_read_config(struct file *filp, struct kobject *kobj,
                struct bin_attribute *bin_attr,
index 54858838f09867f142886edcac6b4dab9c049531..aabf64798bda7d2ebdca2697f23c7e29bfbae620 100644 (file)
@@ -1858,6 +1858,38 @@ bool pci_dev_run_wake(struct pci_dev *dev)
 }
 EXPORT_SYMBOL_GPL(pci_dev_run_wake);
 
+void pci_config_pm_runtime_get(struct pci_dev *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct device *parent = dev->parent;
+
+       if (parent)
+               pm_runtime_get_sync(parent);
+       pm_runtime_get_noresume(dev);
+       /*
+        * pdev->current_state is set to PCI_D3cold during suspending,
+        * so wait until suspending completes
+        */
+       pm_runtime_barrier(dev);
+       /*
+        * Only need to resume devices in D3cold, because config
+        * registers are still accessible for devices suspended but
+        * not in D3cold.
+        */
+       if (pdev->current_state == PCI_D3cold)
+               pm_runtime_resume(dev);
+}
+
+void pci_config_pm_runtime_put(struct pci_dev *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct device *parent = dev->parent;
+
+       pm_runtime_put(dev);
+       if (parent)
+               pm_runtime_put_sync(parent);
+}
+
 /**
  * pci_pm_init - Initialize PM functions of given PCI device
  * @dev: PCI device to handle.
index bacbcba69cf386dd2971b8b94e6ddd383888b471..fd92aab9904b92a694dadf685291220121661905 100644 (file)
@@ -72,6 +72,8 @@ extern void pci_disable_enabled_device(struct pci_dev *dev);
 extern int pci_finish_runtime_suspend(struct pci_dev *dev);
 extern int __pci_pme_wakeup(struct pci_dev *dev, void *ign);
 extern void pci_wakeup_bus(struct pci_bus *bus);
+extern void pci_config_pm_runtime_get(struct pci_dev *dev);
+extern void pci_config_pm_runtime_put(struct pci_dev *dev);
 extern void pci_pm_init(struct pci_dev *dev);
 extern void platform_pci_wakeup_init(struct pci_dev *dev);
 extern void pci_allocate_cap_save_buffers(struct pci_dev *dev);
index 06bad96af415b052b4eb9a90d83f7c04c70b108a..af4e31cd3a3b6b1f895a36afaf4bb874b3e1fb66 100644 (file)
@@ -213,6 +213,7 @@ static int report_error_detected(struct pci_dev *dev, void *data)
        struct aer_broadcast_data *result_data;
        result_data = (struct aer_broadcast_data *) data;
 
+       device_lock(&dev->dev);
        dev->error_state = result_data->state;
 
        if (!dev->driver ||
@@ -231,12 +232,14 @@ static int report_error_detected(struct pci_dev *dev, void *data)
                                   dev->driver ?
                                   "no AER-aware driver" : "no driver");
                }
-               return 0;
+               goto out;
        }
 
        err_handler = dev->driver->err_handler;
        vote = err_handler->error_detected(dev, result_data->state);
        result_data->result = merge_result(result_data->result, vote);
+out:
+       device_unlock(&dev->dev);
        return 0;
 }
 
@@ -247,14 +250,17 @@ static int report_mmio_enabled(struct pci_dev *dev, void *data)
        struct aer_broadcast_data *result_data;
        result_data = (struct aer_broadcast_data *) data;
 
+       device_lock(&dev->dev);
        if (!dev->driver ||
                !dev->driver->err_handler ||
                !dev->driver->err_handler->mmio_enabled)
-               return 0;
+               goto out;
 
        err_handler = dev->driver->err_handler;
        vote = err_handler->mmio_enabled(dev);
        result_data->result = merge_result(result_data->result, vote);
+out:
+       device_unlock(&dev->dev);
        return 0;
 }
 
@@ -265,14 +271,17 @@ static int report_slot_reset(struct pci_dev *dev, void *data)
        struct aer_broadcast_data *result_data;
        result_data = (struct aer_broadcast_data *) data;
 
+       device_lock(&dev->dev);
        if (!dev->driver ||
                !dev->driver->err_handler ||
                !dev->driver->err_handler->slot_reset)
-               return 0;
+               goto out;
 
        err_handler = dev->driver->err_handler;
        vote = err_handler->slot_reset(dev);
        result_data->result = merge_result(result_data->result, vote);
+out:
+       device_unlock(&dev->dev);
        return 0;
 }
 
@@ -280,15 +289,18 @@ static int report_resume(struct pci_dev *dev, void *data)
 {
        const struct pci_error_handlers *err_handler;
 
+       device_lock(&dev->dev);
        dev->error_state = pci_channel_io_normal;
 
        if (!dev->driver ||
                !dev->driver->err_handler ||
                !dev->driver->err_handler->resume)
-               return 0;
+               goto out;
 
        err_handler = dev->driver->err_handler;
        err_handler->resume(dev);
+out:
+       device_unlock(&dev->dev);
        return 0;
 }
 
index d03a7a39b2d85e14baef54a8255e787094528229..ed129b4146246144de63db421ff04d28d5d7de27 100644 (file)
@@ -272,7 +272,8 @@ static int get_port_device_capability(struct pci_dev *dev)
        }
 
        /* Hot-Plug Capable */
-       if (cap_mask & PCIE_PORT_SERVICE_HP) {
+       if ((cap_mask & PCIE_PORT_SERVICE_HP) &&
+           dev->pcie_flags_reg & PCI_EXP_FLAGS_SLOT) {
                pcie_capability_read_dword(dev, PCI_EXP_SLTCAP, &reg32);
                if (reg32 & PCI_EXP_SLTCAP_HPC) {
                        services |= PCIE_PORT_SERVICE_HP;
index eb907a8faf2a9b6e325033005127b0b40904930a..9b8505ccc56d5ef87a09105f5847d19a441ec704 100644 (file)
@@ -76,6 +76,8 @@ proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *pp
        if (!access_ok(VERIFY_WRITE, buf, cnt))
                return -EINVAL;
 
+       pci_config_pm_runtime_get(dev);
+
        if ((pos & 1) && cnt) {
                unsigned char val;
                pci_user_read_config_byte(dev, pos, &val);
@@ -121,6 +123,8 @@ proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *pp
                cnt--;
        }
 
+       pci_config_pm_runtime_put(dev);
+
        *ppos = pos;
        return nbytes;
 }
@@ -146,6 +150,8 @@ proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, lof
        if (!access_ok(VERIFY_READ, buf, cnt))
                return -EINVAL;
 
+       pci_config_pm_runtime_get(dev);
+
        if ((pos & 1) && cnt) {
                unsigned char val;
                __get_user(val, buf);
@@ -191,6 +197,8 @@ proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, lof
                cnt--;
        }
 
+       pci_config_pm_runtime_put(dev);
+
        *ppos = pos;
        i_size_write(ino, dp->size);
        return nbytes;
index fa74efe82206bb0e24addf015ddddc8e379cd087..25c4b1993b3dc38c84f8813d2479d6ad653c0cc0 100644 (file)
@@ -25,7 +25,7 @@
 #include <asm/sizes.h>
 
 #include <mach/mux.h>
-#include <plat/tc.h>
+#include <mach/tc.h>
 
 
 /* NOTE:  don't expect this to support many I/O cards.  The 16xx chips have
index 7bf914df6e91a6129d23f5d12828b8228a8c2775..d96caefd914a90d2db11f05278f565a7e7cc79ee 100644 (file)
@@ -179,11 +179,13 @@ config PINCTRL_COH901
 
 config PINCTRL_SAMSUNG
        bool "Samsung pinctrl driver"
+       depends on OF && GPIOLIB
        select PINMUX
        select PINCONF
 
 config PINCTRL_EXYNOS4
        bool "Pinctrl driver data for Exynos4 SoC"
+       depends on OF && GPIOLIB
        select PINCTRL_SAMSUNG
 
 config PINCTRL_MVEBU
index 5d4f44f462f0962b26b955d877f3a0ceb0285c7a..b1fd6ee33c6ceed614e3a5ccf1cb096049069710 100644 (file)
@@ -244,7 +244,7 @@ static int spear_pinctrl_endisable(struct pinctrl_dev *pctldev,
                        else
                                temp = ~muxreg->val;
 
-                       val |= temp;
+                       val |= muxreg->mask & temp;
                        pmx_writel(pmx, val, muxreg->reg);
                }
        }
index d6cca8c81b92cf9cd9cb63f9d972965e46670249..0436fc7895d6226a8c0cd4943fad2201b03ad4b5 100644 (file)
@@ -25,8 +25,8 @@ static const struct pinctrl_pin_desc spear1310_pins[] = {
 };
 
 /* registers */
-#define PERIP_CFG                                      0x32C
-       #define MCIF_SEL_SHIFT                          3
+#define PERIP_CFG                                      0x3B0
+       #define MCIF_SEL_SHIFT                          5
        #define MCIF_SEL_SD                             (0x1 << MCIF_SEL_SHIFT)
        #define MCIF_SEL_CF                             (0x2 << MCIF_SEL_SHIFT)
        #define MCIF_SEL_XD                             (0x3 << MCIF_SEL_SHIFT)
@@ -164,6 +164,10 @@ static const struct pinctrl_pin_desc spear1310_pins[] = {
        #define PMX_SSP0_CS0_MASK                       (1 << 29)
        #define PMX_SSP0_CS1_2_MASK                     (1 << 30)
 
+#define PAD_DIRECTION_SEL_0                            0x65C
+#define PAD_DIRECTION_SEL_1                            0x660
+#define PAD_DIRECTION_SEL_2                            0x664
+
 /* combined macros */
 #define PMX_GMII_MASK          (PMX_GMIICLK_MASK |                     \
                                PMX_GMIICOL_CRS_XFERER_MIITXCLK_MASK |  \
@@ -237,6 +241,10 @@ static struct spear_muxreg i2c0_muxreg[] = {
                .reg = PAD_FUNCTION_EN_0,
                .mask = PMX_I2C0_MASK,
                .val = PMX_I2C0_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_I2C0_MASK,
+               .val = PMX_I2C0_MASK,
        },
 };
 
@@ -269,6 +277,10 @@ static struct spear_muxreg ssp0_muxreg[] = {
                .reg = PAD_FUNCTION_EN_0,
                .mask = PMX_SSP0_MASK,
                .val = PMX_SSP0_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_SSP0_MASK,
+               .val = PMX_SSP0_MASK,
        },
 };
 
@@ -294,6 +306,10 @@ static struct spear_muxreg ssp0_cs0_muxreg[] = {
                .reg = PAD_FUNCTION_EN_2,
                .mask = PMX_SSP0_CS0_MASK,
                .val = PMX_SSP0_CS0_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_2,
+               .mask = PMX_SSP0_CS0_MASK,
+               .val = PMX_SSP0_CS0_MASK,
        },
 };
 
@@ -319,6 +335,10 @@ static struct spear_muxreg ssp0_cs1_2_muxreg[] = {
                .reg = PAD_FUNCTION_EN_2,
                .mask = PMX_SSP0_CS1_2_MASK,
                .val = PMX_SSP0_CS1_2_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_2,
+               .mask = PMX_SSP0_CS1_2_MASK,
+               .val = PMX_SSP0_CS1_2_MASK,
        },
 };
 
@@ -352,6 +372,10 @@ static struct spear_muxreg i2s0_muxreg[] = {
                .reg = PAD_FUNCTION_EN_0,
                .mask = PMX_I2S0_MASK,
                .val = PMX_I2S0_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_I2S0_MASK,
+               .val = PMX_I2S0_MASK,
        },
 };
 
@@ -384,6 +408,10 @@ static struct spear_muxreg i2s1_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_I2S1_MASK,
                .val = PMX_I2S1_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_I2S1_MASK,
+               .val = PMX_I2S1_MASK,
        },
 };
 
@@ -418,6 +446,10 @@ static struct spear_muxreg clcd_muxreg[] = {
                .reg = PAD_FUNCTION_EN_0,
                .mask = PMX_CLCD1_MASK,
                .val = PMX_CLCD1_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_CLCD1_MASK,
+               .val = PMX_CLCD1_MASK,
        },
 };
 
@@ -443,6 +475,10 @@ static struct spear_muxreg clcd_high_res_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_CLCD2_MASK,
                .val = PMX_CLCD2_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_CLCD2_MASK,
+               .val = PMX_CLCD2_MASK,
        },
 };
 
@@ -461,7 +497,7 @@ static struct spear_pingroup clcd_high_res_pingroup = {
        .nmodemuxs = ARRAY_SIZE(clcd_high_res_modemux),
 };
 
-static const char *const clcd_grps[] = { "clcd_grp", "clcd_high_res" };
+static const char *const clcd_grps[] = { "clcd_grp", "clcd_high_res_grp" };
 static struct spear_function clcd_function = {
        .name = "clcd",
        .groups = clcd_grps,
@@ -479,6 +515,14 @@ static struct spear_muxreg arm_gpio_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_EGPIO_1_GRP_MASK,
                .val = PMX_EGPIO_1_GRP_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_EGPIO_0_GRP_MASK,
+               .val = PMX_EGPIO_0_GRP_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_EGPIO_1_GRP_MASK,
+               .val = PMX_EGPIO_1_GRP_MASK,
        },
 };
 
@@ -511,6 +555,10 @@ static struct spear_muxreg smi_2_chips_muxreg[] = {
                .reg = PAD_FUNCTION_EN_0,
                .mask = PMX_SMI_MASK,
                .val = PMX_SMI_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_SMI_MASK,
+               .val = PMX_SMI_MASK,
        },
 };
 
@@ -539,6 +587,14 @@ static struct spear_muxreg smi_4_chips_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_SMINCS2_MASK | PMX_SMINCS3_MASK,
                .val = PMX_SMINCS2_MASK | PMX_SMINCS3_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_SMI_MASK,
+               .val = PMX_SMI_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_SMINCS2_MASK | PMX_SMINCS3_MASK,
+               .val = PMX_SMINCS2_MASK | PMX_SMINCS3_MASK,
        },
 };
 
@@ -573,6 +629,10 @@ static struct spear_muxreg gmii_muxreg[] = {
                .reg = PAD_FUNCTION_EN_0,
                .mask = PMX_GMII_MASK,
                .val = PMX_GMII_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_GMII_MASK,
+               .val = PMX_GMII_MASK,
        },
 };
 
@@ -615,6 +675,18 @@ static struct spear_muxreg rgmii_muxreg[] = {
                .reg = PAD_FUNCTION_EN_2,
                .mask = PMX_RGMII_REG2_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_RGMII_REG0_MASK,
+               .val = PMX_RGMII_REG0_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_RGMII_REG1_MASK,
+               .val = PMX_RGMII_REG1_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_2,
+               .mask = PMX_RGMII_REG2_MASK,
+               .val = PMX_RGMII_REG2_MASK,
        },
 };
 
@@ -649,6 +721,10 @@ static struct spear_muxreg smii_0_1_2_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_SMII_0_1_2_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_SMII_0_1_2_MASK,
+               .val = PMX_SMII_0_1_2_MASK,
        },
 };
 
@@ -681,6 +757,10 @@ static struct spear_muxreg ras_mii_txclk_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_NFCE2_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_NFCE2_MASK,
+               .val = PMX_NFCE2_MASK,
        },
 };
 
@@ -721,6 +801,14 @@ static struct spear_muxreg nand_8bit_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_NAND8BIT_1_MASK,
                .val = PMX_NAND8BIT_1_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_NAND8BIT_0_MASK,
+               .val = PMX_NAND8BIT_0_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_NAND8BIT_1_MASK,
+               .val = PMX_NAND8BIT_1_MASK,
        },
 };
 
@@ -747,6 +835,10 @@ static struct spear_muxreg nand_16bit_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_NAND16BIT_1_MASK,
                .val = PMX_NAND16BIT_1_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_NAND16BIT_1_MASK,
+               .val = PMX_NAND16BIT_1_MASK,
        },
 };
 
@@ -772,6 +864,10 @@ static struct spear_muxreg nand_4_chips_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_NAND_4CHIPS_MASK,
                .val = PMX_NAND_4CHIPS_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_NAND_4CHIPS_MASK,
+               .val = PMX_NAND_4CHIPS_MASK,
        },
 };
 
@@ -833,6 +929,10 @@ static struct spear_muxreg keyboard_rowcol6_8_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_KBD_ROWCOL68_MASK,
                .val = PMX_KBD_ROWCOL68_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_KBD_ROWCOL68_MASK,
+               .val = PMX_KBD_ROWCOL68_MASK,
        },
 };
 
@@ -866,6 +966,10 @@ static struct spear_muxreg uart0_muxreg[] = {
                .reg = PAD_FUNCTION_EN_0,
                .mask = PMX_UART0_MASK,
                .val = PMX_UART0_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_UART0_MASK,
+               .val = PMX_UART0_MASK,
        },
 };
 
@@ -891,6 +995,10 @@ static struct spear_muxreg uart0_modem_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_UART0_MODEM_MASK,
                .val = PMX_UART0_MODEM_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_UART0_MODEM_MASK,
+               .val = PMX_UART0_MODEM_MASK,
        },
 };
 
@@ -923,6 +1031,10 @@ static struct spear_muxreg gpt0_tmr0_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_GPT0_TMR0_MASK,
                .val = PMX_GPT0_TMR0_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_GPT0_TMR0_MASK,
+               .val = PMX_GPT0_TMR0_MASK,
        },
 };
 
@@ -948,6 +1060,10 @@ static struct spear_muxreg gpt0_tmr1_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_GPT0_TMR1_MASK,
                .val = PMX_GPT0_TMR1_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_GPT0_TMR1_MASK,
+               .val = PMX_GPT0_TMR1_MASK,
        },
 };
 
@@ -980,6 +1096,10 @@ static struct spear_muxreg gpt1_tmr0_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_GPT1_TMR0_MASK,
                .val = PMX_GPT1_TMR0_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_GPT1_TMR0_MASK,
+               .val = PMX_GPT1_TMR0_MASK,
        },
 };
 
@@ -1005,6 +1125,10 @@ static struct spear_muxreg gpt1_tmr1_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_GPT1_TMR1_MASK,
                .val = PMX_GPT1_TMR1_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_GPT1_TMR1_MASK,
+               .val = PMX_GPT1_TMR1_MASK,
        },
 };
 
@@ -1049,6 +1173,20 @@ static const unsigned mcif_pins[] = { 86, 87, 88, 89, 90, 91, 92, 93, 213, 214,
                .reg = PAD_FUNCTION_EN_2,                       \
                .mask = PMX_MCIFALL_2_MASK,                     \
                .val = PMX_MCIFALL_2_MASK,                      \
+       }, {                                                    \
+               .reg = PAD_DIRECTION_SEL_0,                     \
+               .mask = PMX_MCI_DATA8_15_MASK,                  \
+               .val = PMX_MCI_DATA8_15_MASK,                   \
+       }, {                                                    \
+               .reg = PAD_DIRECTION_SEL_1,                     \
+               .mask = PMX_MCIFALL_1_MASK | PMX_NFWPRT1_MASK | \
+                       PMX_NFWPRT2_MASK,                       \
+               .val = PMX_MCIFALL_1_MASK | PMX_NFWPRT1_MASK |  \
+                       PMX_NFWPRT2_MASK,                       \
+       }, {                                                    \
+               .reg = PAD_DIRECTION_SEL_2,                     \
+               .mask = PMX_MCIFALL_2_MASK,                     \
+               .val = PMX_MCIFALL_2_MASK,                      \
        }
 
 /* sdhci device */
@@ -1154,6 +1292,10 @@ static struct spear_muxreg touch_xy_muxreg[] = {
                .reg = PAD_FUNCTION_EN_2,
                .mask = PMX_TOUCH_XY_MASK,
                .val = PMX_TOUCH_XY_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_2,
+               .mask = PMX_TOUCH_XY_MASK,
+               .val = PMX_TOUCH_XY_MASK,
        },
 };
 
@@ -1187,6 +1329,10 @@ static struct spear_muxreg uart1_dis_i2c_muxreg[] = {
                .reg = PAD_FUNCTION_EN_0,
                .mask = PMX_I2C0_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_I2C0_MASK,
+               .val = PMX_I2C0_MASK,
        },
 };
 
@@ -1213,6 +1359,12 @@ static struct spear_muxreg uart1_dis_sd_muxreg[] = {
                .mask = PMX_MCIDATA1_MASK |
                        PMX_MCIDATA2_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_MCIDATA1_MASK |
+                       PMX_MCIDATA2_MASK,
+               .val = PMX_MCIDATA1_MASK |
+                       PMX_MCIDATA2_MASK,
        },
 };
 
@@ -1246,6 +1398,10 @@ static struct spear_muxreg uart2_3_muxreg[] = {
                .reg = PAD_FUNCTION_EN_0,
                .mask = PMX_I2S0_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_I2S0_MASK,
+               .val = PMX_I2S0_MASK,
        },
 };
 
@@ -1278,6 +1434,10 @@ static struct spear_muxreg uart4_muxreg[] = {
                .reg = PAD_FUNCTION_EN_0,
                .mask = PMX_I2S0_MASK | PMX_CLCD1_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_I2S0_MASK | PMX_CLCD1_MASK,
+               .val = PMX_I2S0_MASK | PMX_CLCD1_MASK,
        },
 };
 
@@ -1310,6 +1470,10 @@ static struct spear_muxreg uart5_muxreg[] = {
                .reg = PAD_FUNCTION_EN_0,
                .mask = PMX_CLCD1_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_CLCD1_MASK,
+               .val = PMX_CLCD1_MASK,
        },
 };
 
@@ -1344,6 +1508,10 @@ static struct spear_muxreg rs485_0_1_tdm_0_1_muxreg[] = {
                .reg = PAD_FUNCTION_EN_0,
                .mask = PMX_CLCD1_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_CLCD1_MASK,
+               .val = PMX_CLCD1_MASK,
        },
 };
 
@@ -1376,6 +1544,10 @@ static struct spear_muxreg i2c_1_2_muxreg[] = {
                .reg = PAD_FUNCTION_EN_0,
                .mask = PMX_CLCD1_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_CLCD1_MASK,
+               .val = PMX_CLCD1_MASK,
        },
 };
 
@@ -1409,6 +1581,10 @@ static struct spear_muxreg i2c3_dis_smi_clcd_muxreg[] = {
                .reg = PAD_FUNCTION_EN_0,
                .mask = PMX_CLCD1_MASK | PMX_SMI_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_CLCD1_MASK | PMX_SMI_MASK,
+               .val = PMX_CLCD1_MASK | PMX_SMI_MASK,
        },
 };
 
@@ -1435,6 +1611,10 @@ static struct spear_muxreg i2c3_dis_sd_i2s0_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_I2S1_MASK | PMX_MCIDATA3_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_I2S1_MASK | PMX_MCIDATA3_MASK,
+               .val = PMX_I2S1_MASK | PMX_MCIDATA3_MASK,
        },
 };
 
@@ -1469,6 +1649,10 @@ static struct spear_muxreg i2c_4_5_dis_smi_muxreg[] = {
                .reg = PAD_FUNCTION_EN_0,
                .mask = PMX_SMI_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_SMI_MASK,
+               .val = PMX_SMI_MASK,
        },
 };
 
@@ -1499,6 +1683,14 @@ static struct spear_muxreg i2c4_dis_sd_muxreg[] = {
                .reg = PAD_FUNCTION_EN_2,
                .mask = PMX_MCIDATA5_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_MCIDATA4_MASK,
+               .val = PMX_MCIDATA4_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_2,
+               .mask = PMX_MCIDATA5_MASK,
+               .val = PMX_MCIDATA5_MASK,
        },
 };
 
@@ -1526,6 +1718,12 @@ static struct spear_muxreg i2c5_dis_sd_muxreg[] = {
                .mask = PMX_MCIDATA6_MASK |
                        PMX_MCIDATA7_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_2,
+               .mask = PMX_MCIDATA6_MASK |
+                       PMX_MCIDATA7_MASK,
+               .val = PMX_MCIDATA6_MASK |
+                       PMX_MCIDATA7_MASK,
        },
 };
 
@@ -1560,6 +1758,10 @@ static struct spear_muxreg i2c_6_7_dis_kbd_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_KBD_ROWCOL25_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_KBD_ROWCOL25_MASK,
+               .val = PMX_KBD_ROWCOL25_MASK,
        },
 };
 
@@ -1587,6 +1789,12 @@ static struct spear_muxreg i2c6_dis_sd_muxreg[] = {
                .mask = PMX_MCIIORDRE_MASK |
                        PMX_MCIIOWRWE_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_2,
+               .mask = PMX_MCIIORDRE_MASK |
+                       PMX_MCIIOWRWE_MASK,
+               .val = PMX_MCIIORDRE_MASK |
+                       PMX_MCIIOWRWE_MASK,
        },
 };
 
@@ -1613,6 +1821,12 @@ static struct spear_muxreg i2c7_dis_sd_muxreg[] = {
                .mask = PMX_MCIRESETCF_MASK |
                        PMX_MCICS0CE_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_2,
+               .mask = PMX_MCIRESETCF_MASK |
+                       PMX_MCICS0CE_MASK,
+               .val = PMX_MCIRESETCF_MASK |
+                       PMX_MCICS0CE_MASK,
        },
 };
 
@@ -1651,6 +1865,14 @@ static struct spear_muxreg can0_dis_nor_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_NFRSTPWDWN3_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_NFRSTPWDWN2_MASK,
+               .val = PMX_NFRSTPWDWN2_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_NFRSTPWDWN3_MASK,
+               .val = PMX_NFRSTPWDWN3_MASK,
        },
 };
 
@@ -1677,6 +1899,10 @@ static struct spear_muxreg can0_dis_sd_muxreg[] = {
                .reg = PAD_FUNCTION_EN_2,
                .mask = PMX_MCICFINTR_MASK | PMX_MCIIORDY_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_2,
+               .mask = PMX_MCICFINTR_MASK | PMX_MCIIORDY_MASK,
+               .val = PMX_MCICFINTR_MASK | PMX_MCIIORDY_MASK,
        },
 };
 
@@ -1711,6 +1937,10 @@ static struct spear_muxreg can1_dis_sd_muxreg[] = {
                .reg = PAD_FUNCTION_EN_2,
                .mask = PMX_MCICS1_MASK | PMX_MCIDMAACK_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_2,
+               .mask = PMX_MCICS1_MASK | PMX_MCIDMAACK_MASK,
+               .val = PMX_MCICS1_MASK | PMX_MCIDMAACK_MASK,
        },
 };
 
@@ -1737,6 +1967,10 @@ static struct spear_muxreg can1_dis_kbd_muxreg[] = {
                .reg = PAD_FUNCTION_EN_1,
                .mask = PMX_KBD_ROWCOL25_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_KBD_ROWCOL25_MASK,
+               .val = PMX_KBD_ROWCOL25_MASK,
        },
 };
 
@@ -1763,29 +1997,64 @@ static struct spear_function can1_function = {
        .ngroups = ARRAY_SIZE(can1_grps),
 };
 
-/* Pad multiplexing for pci device */
-static const unsigned pci_sata_pins[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 18,
+/* Pad multiplexing for (ras-ip) pci device */
+static const unsigned pci_pins[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 18,
        19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
        37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
        55, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 };
-#define PCI_SATA_MUXREG                                \
-       {                                       \
-               .reg = PAD_FUNCTION_EN_0,       \
-               .mask = PMX_MCI_DATA8_15_MASK,  \
-               .val = 0,                       \
-       }, {                                    \
-               .reg = PAD_FUNCTION_EN_1,       \
-               .mask = PMX_PCI_REG1_MASK,      \
-               .val = 0,                       \
-       }, {                                    \
-               .reg = PAD_FUNCTION_EN_2,       \
-               .mask = PMX_PCI_REG2_MASK,      \
-               .val = 0,                       \
-       }
 
-/* pad multiplexing for pcie0 device */
+static struct spear_muxreg pci_muxreg[] = {
+       {
+               .reg = PAD_FUNCTION_EN_0,
+               .mask = PMX_MCI_DATA8_15_MASK,
+               .val = 0,
+       }, {
+               .reg = PAD_FUNCTION_EN_1,
+               .mask = PMX_PCI_REG1_MASK,
+               .val = 0,
+       }, {
+               .reg = PAD_FUNCTION_EN_2,
+               .mask = PMX_PCI_REG2_MASK,
+               .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_0,
+               .mask = PMX_MCI_DATA8_15_MASK,
+               .val = PMX_MCI_DATA8_15_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_PCI_REG1_MASK,
+               .val = PMX_PCI_REG1_MASK,
+       }, {
+               .reg = PAD_DIRECTION_SEL_2,
+               .mask = PMX_PCI_REG2_MASK,
+               .val = PMX_PCI_REG2_MASK,
+       },
+};
+
+static struct spear_modemux pci_modemux[] = {
+       {
+               .muxregs = pci_muxreg,
+               .nmuxregs = ARRAY_SIZE(pci_muxreg),
+       },
+};
+
+static struct spear_pingroup pci_pingroup = {
+       .name = "pci_grp",
+       .pins = pci_pins,
+       .npins = ARRAY_SIZE(pci_pins),
+       .modemuxs = pci_modemux,
+       .nmodemuxs = ARRAY_SIZE(pci_modemux),
+};
+
+static const char *const pci_grps[] = { "pci_grp" };
+static struct spear_function pci_function = {
+       .name = "pci",
+       .groups = pci_grps,
+       .ngroups = ARRAY_SIZE(pci_grps),
+};
+
+/* pad multiplexing for (fix-part) pcie0 device */
 static struct spear_muxreg pcie0_muxreg[] = {
-       PCI_SATA_MUXREG,
        {
                .reg = PCIE_SATA_CFG,
                .mask = PCIE_CFG_VAL(0),
@@ -1802,15 +2071,12 @@ static struct spear_modemux pcie0_modemux[] = {
 
 static struct spear_pingroup pcie0_pingroup = {
        .name = "pcie0_grp",
-       .pins = pci_sata_pins,
-       .npins = ARRAY_SIZE(pci_sata_pins),
        .modemuxs = pcie0_modemux,
        .nmodemuxs = ARRAY_SIZE(pcie0_modemux),
 };
 
-/* pad multiplexing for pcie1 device */
+/* pad multiplexing for (fix-part) pcie1 device */
 static struct spear_muxreg pcie1_muxreg[] = {
-       PCI_SATA_MUXREG,
        {
                .reg = PCIE_SATA_CFG,
                .mask = PCIE_CFG_VAL(1),
@@ -1827,15 +2093,12 @@ static struct spear_modemux pcie1_modemux[] = {
 
 static struct spear_pingroup pcie1_pingroup = {
        .name = "pcie1_grp",
-       .pins = pci_sata_pins,
-       .npins = ARRAY_SIZE(pci_sata_pins),
        .modemuxs = pcie1_modemux,
        .nmodemuxs = ARRAY_SIZE(pcie1_modemux),
 };
 
-/* pad multiplexing for pcie2 device */
+/* pad multiplexing for (fix-part) pcie2 device */
 static struct spear_muxreg pcie2_muxreg[] = {
-       PCI_SATA_MUXREG,
        {
                .reg = PCIE_SATA_CFG,
                .mask = PCIE_CFG_VAL(2),
@@ -1852,22 +2115,20 @@ static struct spear_modemux pcie2_modemux[] = {
 
 static struct spear_pingroup pcie2_pingroup = {
        .name = "pcie2_grp",
-       .pins = pci_sata_pins,
-       .npins = ARRAY_SIZE(pci_sata_pins),
        .modemuxs = pcie2_modemux,
        .nmodemuxs = ARRAY_SIZE(pcie2_modemux),
 };
 
-static const char *const pci_grps[] = { "pcie0_grp", "pcie1_grp", "pcie2_grp" };
-static struct spear_function pci_function = {
-       .name = "pci",
-       .groups = pci_grps,
-       .ngroups = ARRAY_SIZE(pci_grps),
+static const char *const pcie_grps[] = { "pcie0_grp", "pcie1_grp", "pcie2_grp"
+};
+static struct spear_function pcie_function = {
+       .name = "pci_express",
+       .groups = pcie_grps,
+       .ngroups = ARRAY_SIZE(pcie_grps),
 };
 
 /* pad multiplexing for sata0 device */
 static struct spear_muxreg sata0_muxreg[] = {
-       PCI_SATA_MUXREG,
        {
                .reg = PCIE_SATA_CFG,
                .mask = SATA_CFG_VAL(0),
@@ -1884,15 +2145,12 @@ static struct spear_modemux sata0_modemux[] = {
 
 static struct spear_pingroup sata0_pingroup = {
        .name = "sata0_grp",
-       .pins = pci_sata_pins,
-       .npins = ARRAY_SIZE(pci_sata_pins),
        .modemuxs = sata0_modemux,
        .nmodemuxs = ARRAY_SIZE(sata0_modemux),
 };
 
 /* pad multiplexing for sata1 device */
 static struct spear_muxreg sata1_muxreg[] = {
-       PCI_SATA_MUXREG,
        {
                .reg = PCIE_SATA_CFG,
                .mask = SATA_CFG_VAL(1),
@@ -1909,15 +2167,12 @@ static struct spear_modemux sata1_modemux[] = {
 
 static struct spear_pingroup sata1_pingroup = {
        .name = "sata1_grp",
-       .pins = pci_sata_pins,
-       .npins = ARRAY_SIZE(pci_sata_pins),
        .modemuxs = sata1_modemux,
        .nmodemuxs = ARRAY_SIZE(sata1_modemux),
 };
 
 /* pad multiplexing for sata2 device */
 static struct spear_muxreg sata2_muxreg[] = {
-       PCI_SATA_MUXREG,
        {
                .reg = PCIE_SATA_CFG,
                .mask = SATA_CFG_VAL(2),
@@ -1934,8 +2189,6 @@ static struct spear_modemux sata2_modemux[] = {
 
 static struct spear_pingroup sata2_pingroup = {
        .name = "sata2_grp",
-       .pins = pci_sata_pins,
-       .npins = ARRAY_SIZE(pci_sata_pins),
        .modemuxs = sata2_modemux,
        .nmodemuxs = ARRAY_SIZE(sata2_modemux),
 };
@@ -1957,6 +2210,14 @@ static struct spear_muxreg ssp1_dis_kbd_muxreg[] = {
                        PMX_KBD_COL0_MASK | PMX_NFIO8_15_MASK | PMX_NFCE1_MASK |
                        PMX_NFCE2_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_1,
+               .mask = PMX_KBD_ROWCOL25_MASK | PMX_KBD_COL1_MASK |
+                       PMX_KBD_COL0_MASK | PMX_NFIO8_15_MASK | PMX_NFCE1_MASK |
+                       PMX_NFCE2_MASK,
+               .val = PMX_KBD_ROWCOL25_MASK | PMX_KBD_COL1_MASK |
+                       PMX_KBD_COL0_MASK | PMX_NFIO8_15_MASK | PMX_NFCE1_MASK |
+                       PMX_NFCE2_MASK,
        },
 };
 
@@ -1983,6 +2244,12 @@ static struct spear_muxreg ssp1_dis_sd_muxreg[] = {
                .mask = PMX_MCIADDR0ALE_MASK | PMX_MCIADDR2_MASK |
                        PMX_MCICECF_MASK | PMX_MCICEXD_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_2,
+               .mask = PMX_MCIADDR0ALE_MASK | PMX_MCIADDR2_MASK |
+                       PMX_MCICECF_MASK | PMX_MCICEXD_MASK,
+               .val = PMX_MCIADDR0ALE_MASK | PMX_MCIADDR2_MASK |
+                       PMX_MCICECF_MASK | PMX_MCICEXD_MASK,
        },
 };
 
@@ -2017,6 +2284,12 @@ static struct spear_muxreg gpt64_muxreg[] = {
                .mask = PMX_MCICDCF1_MASK | PMX_MCICDCF2_MASK | PMX_MCICDXD_MASK
                        | PMX_MCILEDS_MASK,
                .val = 0,
+       }, {
+               .reg = PAD_DIRECTION_SEL_2,
+               .mask = PMX_MCICDCF1_MASK | PMX_MCICDCF2_MASK | PMX_MCICDXD_MASK
+                       | PMX_MCILEDS_MASK,
+               .val = PMX_MCICDCF1_MASK | PMX_MCICDCF2_MASK | PMX_MCICDXD_MASK
+                       | PMX_MCILEDS_MASK,
        },
 };
 
@@ -2093,6 +2366,7 @@ static struct spear_pingroup *spear1310_pingroups[] = {
        &can0_dis_sd_pingroup,
        &can1_dis_sd_pingroup,
        &can1_dis_kbd_pingroup,
+       &pci_pingroup,
        &pcie0_pingroup,
        &pcie1_pingroup,
        &pcie2_pingroup,
@@ -2138,6 +2412,7 @@ static struct spear_function *spear1310_functions[] = {
        &can0_function,
        &can1_function,
        &pci_function,
+       &pcie_function,
        &sata_function,
        &ssp1_function,
        &gpt64_function,
index a0eb057e55bd3f91e390364a9187ee1f4e0768ab..0606b8cf3f2c10923014917d190d3f5ef73cd0aa 100644 (file)
@@ -213,7 +213,7 @@ static const struct pinctrl_pin_desc spear1340_pins[] = {
  * Pad multiplexing for making all pads as gpio's. This is done to override the
  * values passed from bootloader and start from scratch.
  */
-static const unsigned pads_as_gpio_pins[] = { 251 };
+static const unsigned pads_as_gpio_pins[] = { 12, 88, 89, 251 };
 static struct spear_muxreg pads_as_gpio_muxreg[] = {
        {
                .reg = PAD_FUNCTION_EN_1,
@@ -1692,7 +1692,43 @@ static struct spear_pingroup clcd_pingroup = {
        .nmodemuxs = ARRAY_SIZE(clcd_modemux),
 };
 
-static const char *const clcd_grps[] = { "clcd_grp" };
+/* Disable cld runtime to save panel damage */
+static struct spear_muxreg clcd_sleep_muxreg[] = {
+       {
+               .reg = PAD_SHARED_IP_EN_1,
+               .mask = ARM_TRACE_MASK | MIPHY_DBG_MASK,
+               .val = 0,
+       }, {
+               .reg = PAD_FUNCTION_EN_5,
+               .mask = CLCD_REG4_MASK | CLCD_AND_ARM_TRACE_REG4_MASK,
+               .val = 0x0,
+       }, {
+               .reg = PAD_FUNCTION_EN_6,
+               .mask = CLCD_AND_ARM_TRACE_REG5_MASK,
+               .val = 0x0,
+       }, {
+               .reg = PAD_FUNCTION_EN_7,
+               .mask = CLCD_AND_ARM_TRACE_REG6_MASK,
+               .val = 0x0,
+       },
+};
+
+static struct spear_modemux clcd_sleep_modemux[] = {
+       {
+               .muxregs = clcd_sleep_muxreg,
+               .nmuxregs = ARRAY_SIZE(clcd_sleep_muxreg),
+       },
+};
+
+static struct spear_pingroup clcd_sleep_pingroup = {
+       .name = "clcd_sleep_grp",
+       .pins = clcd_pins,
+       .npins = ARRAY_SIZE(clcd_pins),
+       .modemuxs = clcd_sleep_modemux,
+       .nmodemuxs = ARRAY_SIZE(clcd_sleep_modemux),
+};
+
+static const char *const clcd_grps[] = { "clcd_grp", "clcd_sleep_grp" };
 static struct spear_function clcd_function = {
        .name = "clcd",
        .groups = clcd_grps,
@@ -1893,6 +1929,7 @@ static struct spear_pingroup *spear1340_pingroups[] = {
        &sdhci_pingroup,
        &cf_pingroup,
        &xd_pingroup,
+       &clcd_sleep_pingroup,
        &clcd_pingroup,
        &arm_trace_pingroup,
        &miphy_dbg_pingroup,
index 020b1e0bdb3ee77c0e4fd254e91467c3436604e9..ca47b0e50780c52b884c7155349ad107fd098a93 100644 (file)
@@ -2239,6 +2239,10 @@ static struct spear_muxreg pwm2_pin_34_muxreg[] = {
                .reg = PMX_CONFIG_REG,
                .mask = PMX_SSP_CS_MASK,
                .val = 0,
+       }, {
+               .reg = MODE_CONFIG_REG,
+               .mask = PMX_PWM_MASK,
+               .val = PMX_PWM_MASK,
        }, {
                .reg = IP_SEL_PAD_30_39_REG,
                .mask = PMX_PL_34_MASK,
@@ -2956,9 +2960,9 @@ static struct spear_function mii2_function = {
 };
 
 /* Pad multiplexing for cadence mii 1_2 as smii or rmii device */
-static const unsigned smii0_1_pins[] = { 10, 11, 13, 14, 15, 16, 17, 18, 19, 20,
+static const unsigned rmii0_1_pins[] = { 10, 11, 13, 14, 15, 16, 17, 18, 19, 20,
        21, 22, 23, 24, 25, 26, 27 };
-static const unsigned rmii0_1_pins[] = { 10, 11, 21, 22, 23, 24, 25, 26, 27 };
+static const unsigned smii0_1_pins[] = { 10, 11, 21, 22, 23, 24, 25, 26, 27 };
 static struct spear_muxreg mii0_1_muxreg[] = {
        {
                .reg = PMX_CONFIG_REG,
index 31f44347f17ccfd32e3ca0f0913d85b2998aaa05..7860b36053c4523f69a5861f9fd832afae0983e8 100644 (file)
@@ -15,6 +15,7 @@
 #include "pinctrl-spear.h"
 
 /* pad mux declarations */
+#define PMX_PWM_MASK           (1 << 16)
 #define PMX_FIRDA_MASK         (1 << 14)
 #define PMX_I2C_MASK           (1 << 13)
 #define PMX_SSP_CS_MASK                (1 << 12)
index cd0106293a4903672f2de56c008ecc7f0534c2e7..7304139934aaff357cde2f88b0b5db49d9095d43 100644 (file)
@@ -17,8 +17,6 @@
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 
-#include <mach/hardware.h>
-
 #define RTC_INPUT_CLK_32768HZ  (0x00 << 5)
 #define RTC_INPUT_CLK_32000HZ  (0x01 << 5)
 #define RTC_INPUT_CLK_38400HZ  (0x02 << 5)
@@ -72,14 +70,38 @@ static const u32 PIE_BIT_DEF[MAX_PIE_NUM][2] = {
 #define RTC_TEST2      0x2C    /*  32bit rtc test reg 2 */
 #define RTC_TEST3      0x30    /*  32bit rtc test reg 3 */
 
+enum imx_rtc_type {
+       IMX1_RTC,
+       IMX21_RTC,
+};
+
 struct rtc_plat_data {
        struct rtc_device *rtc;
        void __iomem *ioaddr;
        int irq;
        struct clk *clk;
        struct rtc_time g_rtc_alarm;
+       enum imx_rtc_type devtype;
 };
 
+static struct platform_device_id imx_rtc_devtype[] = {
+       {
+               .name = "imx1-rtc",
+               .driver_data = IMX1_RTC,
+       }, {
+               .name = "imx21-rtc",
+               .driver_data = IMX21_RTC,
+       }, {
+               /* sentinel */
+       }
+};
+MODULE_DEVICE_TABLE(platform, imx_rtc_devtype);
+
+static inline int is_imx1_rtc(struct rtc_plat_data *data)
+{
+       return data->devtype == IMX1_RTC;
+}
+
 /*
  * This function is used to obtain the RTC time or the alarm value in
  * second.
@@ -278,10 +300,13 @@ static int mxc_rtc_read_time(struct device *dev, struct rtc_time *tm)
  */
 static int mxc_rtc_set_mmss(struct device *dev, unsigned long time)
 {
+       struct platform_device *pdev = to_platform_device(dev);
+       struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+
        /*
         * TTC_DAYR register is 9-bit in MX1 SoC, save time and day of year only
         */
-       if (cpu_is_mx1()) {
+       if (is_imx1_rtc(pdata)) {
                struct rtc_time tm;
 
                rtc_time_to_tm(time, &tm);
@@ -360,6 +385,8 @@ static int __devinit mxc_rtc_probe(struct platform_device *pdev)
        if (!pdata)
                return -ENOMEM;
 
+       pdata->devtype = pdev->id_entry->driver_data;
+
        if (!devm_request_mem_region(&pdev->dev, res->start,
                                     resource_size(res), pdev->name))
                return -EBUSY;
@@ -480,6 +507,7 @@ static struct platform_driver mxc_rtc_driver = {
 #endif
                   .owner       = THIS_MODULE,
        },
+       .id_table = imx_rtc_devtype,
        .probe = mxc_rtc_probe,
        .remove = __devexit_p(mxc_rtc_remove),
 };
index 33bb4d891e161174d01b8f6e0d6433883d5fb495..4af3dfe70ef53d075bb7cc96ea1064801ac777c6 100644 (file)
@@ -112,9 +112,6 @@ extern int for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *);
 extern void css_reiterate_subchannels(void);
 void css_update_ssd_info(struct subchannel *sch);
 
-#define __MAX_SUBCHANNEL 65535
-#define __MAX_SSID 3
-
 struct channel_subsystem {
        u8 cssid;
        int valid;
index fc916f5d731412c7146465d3ff29277979b69189..fd3143c291c6a630933d608c6c6e455b2be04a0d 100644 (file)
@@ -1424,7 +1424,7 @@ static enum io_sch_action sch_get_action(struct subchannel *sch)
        }
        if (device_is_disconnected(cdev))
                return IO_SCH_REPROBE;
-       if (cdev->online)
+       if (cdev->online && !cdev->private->flags.resuming)
                return IO_SCH_VERIFY;
        if (cdev->private->state == DEV_STATE_NOT_OPER)
                return IO_SCH_UNREG_ATTACH;
@@ -1469,12 +1469,6 @@ static int io_subchannel_sch_event(struct subchannel *sch, int process)
                rc = 0;
                goto out_unlock;
        case IO_SCH_VERIFY:
-               if (cdev->private->flags.resuming == 1) {
-                       if (cio_enable_subchannel(sch, (u32)(addr_t)sch)) {
-                               ccw_device_set_notoper(cdev);
-                               break;
-                       }
-               }
                /* Trigger path verification. */
                io_subchannel_verify(sch);
                rc = 0;
index 199bc6791177491bea28b360845911a282b259b5..65d13e38803f9dddc11079b9a00176e7b94116d2 100644 (file)
@@ -125,8 +125,7 @@ int idset_is_empty(struct idset *set)
 
 void idset_add_set(struct idset *to, struct idset *from)
 {
-       int len = min(__BITOPS_WORDS(to->num_ssid * to->num_id),
-                     __BITOPS_WORDS(from->num_ssid * from->num_id));
+       int len = min(to->num_ssid * to->num_id, from->num_ssid * from->num_id);
 
        bitmap_or(to->bitmap, to->bitmap, from->bitmap, len);
 }
index bd4708a422cd78b09fd8594ded593af775343398..20fd974f903afd5d4ae15c95db2549d49db52849 100644 (file)
@@ -149,6 +149,7 @@ qla2x00_mark_vp_devices_dead(scsi_qla_host_t *vha)
 int
 qla24xx_disable_vp(scsi_qla_host_t *vha)
 {
+       unsigned long flags;
        int ret;
 
        ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL);
@@ -156,7 +157,9 @@ qla24xx_disable_vp(scsi_qla_host_t *vha)
        atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
 
        /* Remove port id from vp target map */
+       spin_lock_irqsave(&vha->hw->vport_slock, flags);
        qlt_update_vp_map(vha, RESET_AL_PA);
+       spin_unlock_irqrestore(&vha->hw->vport_slock, flags);
 
        qla2x00_mark_vp_devices_dead(vha);
        atomic_set(&vha->vp_state, VP_FAILED);
index 0e09d8f433d1683e61ba61074d7c67b71919d970..62aa5584f64478d286e373414dd8b119315a5204 100644 (file)
@@ -557,6 +557,7 @@ static bool qlt_check_fcport_exist(struct scsi_qla_host *vha,
        int pmap_len;
        fc_port_t *fcport;
        int global_resets;
+       unsigned long flags;
 
 retry:
        global_resets = atomic_read(&ha->tgt.qla_tgt->tgt_global_resets_count);
@@ -625,10 +626,10 @@ retry:
            sess->s_id.b.area, sess->loop_id, fcport->d_id.b.domain,
            fcport->d_id.b.al_pa, fcport->d_id.b.area, fcport->loop_id);
 
-       sess->s_id = fcport->d_id;
-       sess->loop_id = fcport->loop_id;
-       sess->conf_compl_supported = !!(fcport->flags &
-           FCF_CONF_COMP_SUPPORTED);
+       spin_lock_irqsave(&ha->hardware_lock, flags);
+       ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id,
+                               (fcport->flags & FCF_CONF_COMP_SUPPORTED));
+       spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
        res = true;
 
@@ -740,10 +741,9 @@ static struct qla_tgt_sess *qlt_create_sess(
                                qlt_undelete_sess(sess);
 
                        kref_get(&sess->se_sess->sess_kref);
-                       sess->s_id = fcport->d_id;
-                       sess->loop_id = fcport->loop_id;
-                       sess->conf_compl_supported = !!(fcport->flags &
-                           FCF_CONF_COMP_SUPPORTED);
+                       ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id,
+                                               (fcport->flags & FCF_CONF_COMP_SUPPORTED));
+
                        if (sess->local && !local)
                                sess->local = 0;
                        spin_unlock_irqrestore(&ha->hardware_lock, flags);
@@ -796,8 +796,7 @@ static struct qla_tgt_sess *qlt_create_sess(
         */
        kref_get(&sess->se_sess->sess_kref);
 
-       sess->conf_compl_supported = !!(fcport->flags &
-           FCF_CONF_COMP_SUPPORTED);
+       sess->conf_compl_supported = (fcport->flags & FCF_CONF_COMP_SUPPORTED);
        BUILD_BUG_ON(sizeof(sess->port_name) != sizeof(fcport->port_name));
        memcpy(sess->port_name, fcport->port_name, sizeof(sess->port_name));
 
@@ -869,10 +868,8 @@ void qlt_fc_port_added(struct scsi_qla_host *vha, fc_port_t *fcport)
                        ql_dbg(ql_dbg_tgt_mgt, vha, 0xf007,
                            "Reappeared sess %p\n", sess);
                }
-               sess->s_id = fcport->d_id;
-               sess->loop_id = fcport->loop_id;
-               sess->conf_compl_supported = !!(fcport->flags &
-                   FCF_CONF_COMP_SUPPORTED);
+               ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id,
+                                       (fcport->flags & FCF_CONF_COMP_SUPPORTED));
        }
 
        if (sess && sess->local) {
index 170af1571214095fe82db73fa52f520c16a8197b..bad749561ec2ae4fe57e3ea28763ec627f0b18f1 100644 (file)
@@ -648,6 +648,7 @@ struct qla_tgt_func_tmpl {
 
        int (*check_initiator_node_acl)(struct scsi_qla_host *, unsigned char *,
                                        void *, uint8_t *, uint16_t);
+       void (*update_sess)(struct qla_tgt_sess *, port_id_t, uint16_t, bool);
        struct qla_tgt_sess *(*find_sess_by_loop_id)(struct scsi_qla_host *,
                                                const uint16_t);
        struct qla_tgt_sess *(*find_sess_by_s_id)(struct scsi_qla_host *,
index 2358c16c4c8ea8a0cdb85c33c2c97a5b4e65c400..3d74f2f39ae18954ac825f4599b689d770f494cf 100644 (file)
@@ -237,7 +237,7 @@ static char *tcm_qla2xxx_get_fabric_wwn(struct se_portal_group *se_tpg)
                                struct tcm_qla2xxx_tpg, se_tpg);
        struct tcm_qla2xxx_lport *lport = tpg->lport;
 
-       return &lport->lport_name[0];
+       return lport->lport_naa_name;
 }
 
 static char *tcm_qla2xxx_npiv_get_fabric_wwn(struct se_portal_group *se_tpg)
@@ -1457,6 +1457,78 @@ static int tcm_qla2xxx_check_initiator_node_acl(
        return 0;
 }
 
+static void tcm_qla2xxx_update_sess(struct qla_tgt_sess *sess, port_id_t s_id,
+                                   uint16_t loop_id, bool conf_compl_supported)
+{
+       struct qla_tgt *tgt = sess->tgt;
+       struct qla_hw_data *ha = tgt->ha;
+       struct tcm_qla2xxx_lport *lport = ha->tgt.target_lport_ptr;
+       struct se_node_acl *se_nacl = sess->se_sess->se_node_acl;
+       struct tcm_qla2xxx_nacl *nacl = container_of(se_nacl,
+                       struct tcm_qla2xxx_nacl, se_node_acl);
+       u32 key;
+
+
+       if (sess->loop_id != loop_id || sess->s_id.b24 != s_id.b24)
+               pr_info("Updating session %p from port %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x loop_id %d -> %d s_id %x:%x:%x -> %x:%x:%x\n",
+                       sess,
+                       sess->port_name[0], sess->port_name[1],
+                       sess->port_name[2], sess->port_name[3],
+                       sess->port_name[4], sess->port_name[5],
+                       sess->port_name[6], sess->port_name[7],
+                       sess->loop_id, loop_id,
+                       sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa,
+                       s_id.b.domain, s_id.b.area, s_id.b.al_pa);
+
+       if (sess->loop_id != loop_id) {
+               /*
+                * Because we can shuffle loop IDs around and we
+                * update different sessions non-atomically, we might
+                * have overwritten this session's old loop ID
+                * already, and we might end up overwriting some other
+                * session that will be updated later.  So we have to
+                * be extra careful and we can't warn about those things...
+                */
+               if (lport->lport_loopid_map[sess->loop_id].se_nacl == se_nacl)
+                       lport->lport_loopid_map[sess->loop_id].se_nacl = NULL;
+
+               lport->lport_loopid_map[loop_id].se_nacl = se_nacl;
+
+               sess->loop_id = loop_id;
+       }
+
+       if (sess->s_id.b24 != s_id.b24) {
+               key = (((u32) sess->s_id.b.domain << 16) |
+                      ((u32) sess->s_id.b.area   <<  8) |
+                      ((u32) sess->s_id.b.al_pa));
+
+               if (btree_lookup32(&lport->lport_fcport_map, key))
+                       WARN(btree_remove32(&lport->lport_fcport_map, key) != se_nacl,
+                            "Found wrong se_nacl when updating s_id %x:%x:%x\n",
+                            sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa);
+               else
+                       WARN(1, "No lport_fcport_map entry for s_id %x:%x:%x\n",
+                            sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa);
+
+               key = (((u32) s_id.b.domain << 16) |
+                      ((u32) s_id.b.area   <<  8) |
+                      ((u32) s_id.b.al_pa));
+
+               if (btree_lookup32(&lport->lport_fcport_map, key)) {
+                       WARN(1, "Already have lport_fcport_map entry for s_id %x:%x:%x\n",
+                            s_id.b.domain, s_id.b.area, s_id.b.al_pa);
+                       btree_update32(&lport->lport_fcport_map, key, se_nacl);
+               } else {
+                       btree_insert32(&lport->lport_fcport_map, key, se_nacl, GFP_ATOMIC);
+               }
+
+               sess->s_id = s_id;
+               nacl->nport_id = key;
+       }
+
+       sess->conf_compl_supported = conf_compl_supported;
+}
+
 /*
  * Calls into tcm_qla2xxx used by qla2xxx LLD I/O path.
  */
@@ -1467,6 +1539,7 @@ static struct qla_tgt_func_tmpl tcm_qla2xxx_template = {
        .free_cmd               = tcm_qla2xxx_free_cmd,
        .free_mcmd              = tcm_qla2xxx_free_mcmd,
        .free_session           = tcm_qla2xxx_free_session,
+       .update_sess            = tcm_qla2xxx_update_sess,
        .check_initiator_node_acl = tcm_qla2xxx_check_initiator_node_acl,
        .find_sess_by_s_id      = tcm_qla2xxx_find_sess_by_s_id,
        .find_sess_by_loop_id   = tcm_qla2xxx_find_sess_by_loop_id,
@@ -1534,6 +1607,7 @@ static struct se_wwn *tcm_qla2xxx_make_lport(
        lport->lport_wwpn = wwpn;
        tcm_qla2xxx_format_wwn(&lport->lport_name[0], TCM_QLA2XXX_NAMELEN,
                                wwpn);
+       sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) wwpn);
 
        ret = tcm_qla2xxx_init_lport(lport);
        if (ret != 0)
@@ -1601,6 +1675,7 @@ static struct se_wwn *tcm_qla2xxx_npiv_make_lport(
        lport->lport_npiv_wwnn = npiv_wwnn;
        tcm_qla2xxx_npiv_format_wwn(&lport->lport_npiv_name[0],
                        TCM_QLA2XXX_NAMELEN, npiv_wwpn, npiv_wwnn);
+       sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) npiv_wwpn);
 
 /* FIXME: tcm_qla2xxx_npiv_make_lport */
        ret = -ENOSYS;
index 8254981033524466bc372ac4bbd067aa5d19cc5b..9ba075fe9781f0148dca9aa73b6525e554a91154 100644 (file)
@@ -61,6 +61,8 @@ struct tcm_qla2xxx_lport {
        u64 lport_npiv_wwnn;
        /* ASCII formatted WWPN for FC Target Lport */
        char lport_name[TCM_QLA2XXX_NAMELEN];
+       /* ASCII formatted naa WWPN for VPD page 83 etc */
+       char lport_naa_name[TCM_QLA2XXX_NAMELEN];
        /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */
        char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN];
        /* map for fc_port pointers in 24-bit FC Port ID space */
index b191dd549207db3ac2c25fd16e3b6a87559cb047..71fddbc60f181feb15bbd30994f16dc5b35d4831 100644 (file)
@@ -1294,26 +1294,19 @@ static struct scsi_host_template qpti_template = {
 static const struct of_device_id qpti_match[];
 static int __devinit qpti_sbus_probe(struct platform_device *op)
 {
-       const struct of_device_id *match;
-       struct scsi_host_template *tpnt;
        struct device_node *dp = op->dev.of_node;
        struct Scsi_Host *host;
        struct qlogicpti *qpti;
        static int nqptis;
        const char *fcode;
 
-       match = of_match_device(qpti_match, &op->dev);
-       if (!match)
-               return -EINVAL;
-       tpnt = match->data;
-
        /* Sometimes Antares cards come up not completely
         * setup, and we get a report of a zero IRQ.
         */
        if (op->archdata.irqs[0] == 0)
                return -ENODEV;
 
-       host = scsi_host_alloc(tpnt, sizeof(struct qlogicpti));
+       host = scsi_host_alloc(&qpti_template, sizeof(struct qlogicpti));
        if (!host)
                return -ENOMEM;
 
@@ -1445,19 +1438,15 @@ static int __devexit qpti_sbus_remove(struct platform_device *op)
 static const struct of_device_id qpti_match[] = {
        {
                .name = "ptisp",
-               .data = &qpti_template,
        },
        {
                .name = "PTI,ptisp",
-               .data = &qpti_template,
        },
        {
                .name = "QLGC,isp",
-               .data = &qpti_template,
        },
        {
                .name = "SUNW,isp",
-               .data = &qpti_template,
        },
        {},
 };
index 5e2f4d82d925fbf76b628299347c4f83a86321a3..7f3a1db316199ac4618d3e57a6162b27ed305282 100644 (file)
@@ -40,7 +40,6 @@
 #include <linux/vmalloc.h>
 #include <linux/ioport.h>
 #include <linux/platform_device.h>
-#include <plat/clock.h>
 #include <linux/clk.h>
 #include <plat/mailbox.h>
 #include <linux/pagemap.h>
index d6ce2182e67207d41932fec75914b9d2c7f44479..035c2c762537c63e9bf62210b5476f7aef5c687a 100644 (file)
@@ -3719,7 +3719,9 @@ restart:
                 */
                iscsit_thread_check_cpumask(conn, current, 1);
 
-               schedule_timeout_interruptible(MAX_SCHEDULE_TIMEOUT);
+               wait_event_interruptible(conn->queues_wq,
+                                        !iscsit_conn_all_queues_empty(conn) ||
+                                        ts->status == ISCSI_THREAD_SET_RESET);
 
                if ((ts->status == ISCSI_THREAD_SET_RESET) ||
                     signal_pending(current))
index 2ba9f9b9435c8684e59d0c65b6a18a6586ec5490..21048dbf7d13cc7ac116be38bb13a9ac6300c2a0 100644 (file)
@@ -486,6 +486,7 @@ struct iscsi_tmr_req {
 };
 
 struct iscsi_conn {
+       wait_queue_head_t       queues_wq;
        /* Authentication Successful for this connection */
        u8                      auth_complete;
        /* State connection is currently in */
index cdc8a10939c3d8d00912a6d9b5d735930d4e60ab..f8dbec05d5e56736fdc9238f997fcc8b18209021 100644 (file)
@@ -41,6 +41,7 @@
 
 static int iscsi_login_init_conn(struct iscsi_conn *conn)
 {
+       init_waitqueue_head(&conn->queues_wq);
        INIT_LIST_HEAD(&conn->conn_list);
        INIT_LIST_HEAD(&conn->conn_cmd_list);
        INIT_LIST_HEAD(&conn->immed_queue_list);
index afd98ccd40ae564f8013155bf6a4d99f857f339a..1a91195ab619a9ebbfa503cf7851c3cb8ca02b49 100644 (file)
@@ -488,7 +488,7 @@ void iscsit_add_cmd_to_immediate_queue(
        atomic_set(&conn->check_immediate_queue, 1);
        spin_unlock_bh(&conn->immed_queue_lock);
 
-       wake_up_process(conn->thread_set->tx_thread);
+       wake_up(&conn->queues_wq);
 }
 
 struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *conn)
@@ -562,7 +562,7 @@ void iscsit_add_cmd_to_response_queue(
        atomic_inc(&cmd->response_queue_count);
        spin_unlock_bh(&conn->response_queue_lock);
 
-       wake_up_process(conn->thread_set->tx_thread);
+       wake_up(&conn->queues_wq);
 }
 
 struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *conn)
@@ -616,6 +616,24 @@ static void iscsit_remove_cmd_from_response_queue(
        }
 }
 
+bool iscsit_conn_all_queues_empty(struct iscsi_conn *conn)
+{
+       bool empty;
+
+       spin_lock_bh(&conn->immed_queue_lock);
+       empty = list_empty(&conn->immed_queue_list);
+       spin_unlock_bh(&conn->immed_queue_lock);
+
+       if (!empty)
+               return empty;
+
+       spin_lock_bh(&conn->response_queue_lock);
+       empty = list_empty(&conn->response_queue_list);
+       spin_unlock_bh(&conn->response_queue_lock);
+
+       return empty;
+}
+
 void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *conn)
 {
        struct iscsi_queue_req *qr, *qr_tmp;
index 44054bd35437af3b21fbdc5422171d7d8032f76c..894d0f8379246f63166666b36259fbe0315d8dd4 100644 (file)
@@ -25,6 +25,7 @@ extern struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_
 extern void iscsit_add_cmd_to_response_queue(struct iscsi_cmd *, struct iscsi_conn *, u8);
 extern struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *);
 extern void iscsit_remove_cmd_from_tx_queues(struct iscsi_cmd *, struct iscsi_conn *);
+extern bool iscsit_conn_all_queues_empty(struct iscsi_conn *);
 extern void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *);
 extern void iscsit_release_cmd(struct iscsi_cmd *);
 extern void iscsit_free_cmd(struct iscsi_cmd *);
index 015f5be27bf6f00dab299b20b295ef71df4af3e2..c123327499a3572f5e950f6483ea20d99096ebab 100644 (file)
@@ -3206,7 +3206,8 @@ static int __init target_core_init_configfs(void)
        if (ret < 0)
                goto out;
 
-       if (core_dev_setup_virtual_lun0() < 0)
+       ret = core_dev_setup_virtual_lun0();
+       if (ret < 0)
                goto out;
 
        return 0;
index 8d774da16320707cb81f525f511188ff202c57ae..9abef9f8eb760a88e7073802ceec77197421bf97 100644 (file)
@@ -850,20 +850,20 @@ int se_dev_check_shutdown(struct se_device *dev)
 
 static u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size)
 {
-       u32 tmp, aligned_max_sectors;
+       u32 aligned_max_sectors;
+       u32 alignment;
        /*
         * Limit max_sectors to a PAGE_SIZE aligned value for modern
         * transport_allocate_data_tasks() operation.
         */
-       tmp = rounddown((max_sectors * block_size), PAGE_SIZE);
-       aligned_max_sectors = (tmp / block_size);
-       if (max_sectors != aligned_max_sectors) {
-               printk(KERN_INFO "Rounding down aligned max_sectors from %u"
-                               " to %u\n", max_sectors, aligned_max_sectors);
-               return aligned_max_sectors;
-       }
+       alignment = max(1ul, PAGE_SIZE / block_size);
+       aligned_max_sectors = rounddown(max_sectors, alignment);
+
+       if (max_sectors != aligned_max_sectors)
+               pr_info("Rounding down aligned max_sectors from %u to %u\n",
+                       max_sectors, aligned_max_sectors);
 
-       return max_sectors;
+       return aligned_max_sectors;
 }
 
 void se_dev_set_default_attribs(
index 868f8aa04f13d318b1c752d08887703f7a72de21..a6e27d967c7b7b4abc53dd194927252ed2cde897 100644 (file)
@@ -135,6 +135,12 @@ static int sbc_emulate_verify(struct se_cmd *cmd)
        return 0;
 }
 
+static int sbc_emulate_noop(struct se_cmd *cmd)
+{
+       target_complete_cmd(cmd, GOOD);
+       return 0;
+}
+
 static inline u32 sbc_get_size(struct se_cmd *cmd, u32 sectors)
 {
        return cmd->se_dev->se_sub_dev->se_dev_attrib.block_size * sectors;
@@ -531,6 +537,18 @@ int sbc_parse_cdb(struct se_cmd *cmd, struct spc_ops *ops)
                size = 0;
                cmd->execute_cmd = sbc_emulate_verify;
                break;
+       case REZERO_UNIT:
+       case SEEK_6:
+       case SEEK_10:
+               /*
+                * There are still clients out there which use these old SCSI-2
+                * commands. This mainly happens when running VMs with legacy
+                * guest systems, connected via SCSI command pass-through to
+                * iSCSI targets. Make them happy and return status GOOD.
+                */
+               size = 0;
+               cmd->execute_cmd = sbc_emulate_noop;
+               break;
        default:
                ret = spc_parse_cdb(cmd, &size);
                if (ret)
index 9229bd9ad61b3db7cd4d182ab3d5315f24785a5f..6fd434d3d7e477ab7d49660d20e02b0d638b8e3a 100644 (file)
@@ -605,6 +605,8 @@ static int spc_emulate_inquiry(struct se_cmd *cmd)
        unsigned char buf[SE_INQUIRY_BUF];
        int p, ret;
 
+       memset(buf, 0, SE_INQUIRY_BUF);
+
        if (dev == tpg->tpg_virt_lun0.lun_se_dev)
                buf[0] = 0x3f; /* Not connected */
        else
index 1c59a3c23b2c1b37ee8a3c54d62b8c66ea6f9e87..be75c4331a9222a5ca4d0b015ebdbe5a983c20ae 100644 (file)
@@ -140,15 +140,15 @@ void core_tmr_abort_task(
                printk("ABORT_TASK: Found referenced %s task_tag: %u\n",
                        se_cmd->se_tfo->get_fabric_name(), ref_tag);
 
-               spin_lock_irq(&se_cmd->t_state_lock);
+               spin_lock(&se_cmd->t_state_lock);
                if (se_cmd->transport_state & CMD_T_COMPLETE) {
                        printk("ABORT_TASK: ref_tag: %u already complete, skipping\n", ref_tag);
-                       spin_unlock_irq(&se_cmd->t_state_lock);
+                       spin_unlock(&se_cmd->t_state_lock);
                        spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
                        goto out;
                }
                se_cmd->transport_state |= CMD_T_ABORTED;
-               spin_unlock_irq(&se_cmd->t_state_lock);
+               spin_unlock(&se_cmd->t_state_lock);
 
                list_del_init(&se_cmd->se_cmd_list);
                kref_get(&se_cmd->cmd_kref);
index c33baff86aa699deacd04bd873e3c31fa5569cf5..9097155e9ebe7100c0bc1a4ac13b7c508a84ac8a 100644 (file)
@@ -1616,7 +1616,6 @@ static void target_complete_tmr_failure(struct work_struct *work)
 
        se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST;
        se_cmd->se_tfo->queue_tm_rsp(se_cmd);
-       transport_generic_free_cmd(se_cmd, 0);
 }
 
 /**
index fd03e8581afc2a8e86ed354c03c06e84a1b604cc..6dd29e4ce36b1cd4841b94b6f1c1bd6251040972 100644 (file)
@@ -815,7 +815,7 @@ static struct platform_device_id exynos_tmu_driver_ids[] = {
        },
        { },
 };
-MODULE_DEVICE_TABLE(platform, exynos4_tmu_driver_ids);
+MODULE_DEVICE_TABLE(platform, exynos_tmu_driver_ids);
 
 static inline struct  exynos_tmu_platform_data *exynos_get_driver_data(
                        struct platform_device *pdev)
index d4452716aaab1a7dbec7e3df53ec0abbed43aabd..f7a1b574a304e8808cb0cfda0d7e91ef6272bd50 100644 (file)
@@ -210,7 +210,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
                goto error_free_priv;
        }
 
-       zone = thermal_zone_device_register("rcar_thermal", 0, priv,
+       zone = thermal_zone_device_register("rcar_thermal", 0, 0, priv,
                                            &rcar_thermal_zone_ops, 0, 0);
        if (IS_ERR(zone)) {
                dev_err(&pdev->dev, "thermal zone device is NULL\n");
index 8c0b7b42319c44d7038892d0026582797acad95a..60b076cc4e20c28fb2c4e89a0445c61c0355925d 100644 (file)
 #define ECHO_OP_SET_CANON_COL 0x81
 #define ECHO_OP_ERASE_TAB 0x82
 
+struct n_tty_data {
+       unsigned int column;
+       unsigned long overrun_time;
+       int num_overrun;
+
+       unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1;
+       unsigned char echo_overrun:1;
+
+       DECLARE_BITMAP(process_char_map, 256);
+       DECLARE_BITMAP(read_flags, N_TTY_BUF_SIZE);
+
+       char *read_buf;
+       int read_head;
+       int read_tail;
+       int read_cnt;
+
+       unsigned char *echo_buf;
+       unsigned int echo_pos;
+       unsigned int echo_cnt;
+
+       int canon_data;
+       unsigned long canon_head;
+       unsigned int canon_column;
+
+       struct mutex atomic_read_lock;
+       struct mutex output_lock;
+       struct mutex echo_lock;
+       spinlock_t read_lock;
+};
+
 static inline int tty_put_user(struct tty_struct *tty, unsigned char x,
                               unsigned char __user *ptr)
 {
-       tty_audit_add_data(tty, &x, 1);
+       struct n_tty_data *ldata = tty->disc_data;
+
+       tty_audit_add_data(tty, &x, 1, ldata->icanon);
        return put_user(x, ptr);
 }
 
@@ -92,17 +124,18 @@ static inline int tty_put_user(struct tty_struct *tty, unsigned char x,
 
 static void n_tty_set_room(struct tty_struct *tty)
 {
+       struct n_tty_data *ldata = tty->disc_data;
        int left;
        int old_left;
 
-       /* tty->read_cnt is not read locked ? */
+       /* ldata->read_cnt is not read locked ? */
        if (I_PARMRK(tty)) {
                /* Multiply read_cnt by 3, since each byte might take up to
                 * three times as many spaces when PARMRK is set (depending on
                 * its flags, e.g. parity error). */
-               left = N_TTY_BUF_SIZE - tty->read_cnt * 3 - 1;
+               left = N_TTY_BUF_SIZE - ldata->read_cnt * 3 - 1;
        } else
-               left = N_TTY_BUF_SIZE - tty->read_cnt - 1;
+               left = N_TTY_BUF_SIZE - ldata->read_cnt - 1;
 
        /*
         * If we are doing input canonicalization, and there are no
@@ -111,44 +144,47 @@ static void n_tty_set_room(struct tty_struct *tty)
         * characters will be beeped.
         */
        if (left <= 0)
-               left = tty->icanon && !tty->canon_data;
+               left = ldata->icanon && !ldata->canon_data;
        old_left = tty->receive_room;
        tty->receive_room = left;
 
        /* Did this open up the receive buffer? We may need to flip */
-       if (left && !old_left)
-               schedule_work(&tty->buf.work);
+       if (left && !old_left) {
+               WARN_RATELIMIT(tty->port->itty == NULL,
+                               "scheduling with invalid itty");
+               schedule_work(&tty->port->buf.work);
+       }
 }
 
-static void put_tty_queue_nolock(unsigned char c, struct tty_struct *tty)
+static void put_tty_queue_nolock(unsigned char c, struct n_tty_data *ldata)
 {
-       if (tty->read_cnt < N_TTY_BUF_SIZE) {
-               tty->read_buf[tty->read_head] = c;
-               tty->read_head = (tty->read_head + 1) & (N_TTY_BUF_SIZE-1);
-               tty->read_cnt++;
+       if (ldata->read_cnt < N_TTY_BUF_SIZE) {
+               ldata->read_buf[ldata->read_head] = c;
+               ldata->read_head = (ldata->read_head + 1) & (N_TTY_BUF_SIZE-1);
+               ldata->read_cnt++;
        }
 }
 
 /**
  *     put_tty_queue           -       add character to tty
  *     @c: character
- *     @tty: tty device
+ *     @ldata: n_tty data
  *
  *     Add a character to the tty read_buf queue. This is done under the
  *     read_lock to serialize character addition and also to protect us
  *     against parallel reads or flushes
  */
 
-static void put_tty_queue(unsigned char c, struct tty_struct *tty)
+static void put_tty_queue(unsigned char c, struct n_tty_data *ldata)
 {
        unsigned long flags;
        /*
         *      The problem of stomping on the buffers ends here.
         *      Why didn't anyone see this one coming? --AJK
        */
-       spin_lock_irqsave(&tty->read_lock, flags);
-       put_tty_queue_nolock(c, tty);
-       spin_unlock_irqrestore(&tty->read_lock, flags);
+       spin_lock_irqsave(&ldata->read_lock, flags);
+       put_tty_queue_nolock(c, ldata);
+       spin_unlock_irqrestore(&ldata->read_lock, flags);
 }
 
 /**
@@ -179,18 +215,19 @@ static void check_unthrottle(struct tty_struct *tty)
 
 static void reset_buffer_flags(struct tty_struct *tty)
 {
+       struct n_tty_data *ldata = tty->disc_data;
        unsigned long flags;
 
-       spin_lock_irqsave(&tty->read_lock, flags);
-       tty->read_head = tty->read_tail = tty->read_cnt = 0;
-       spin_unlock_irqrestore(&tty->read_lock, flags);
+       spin_lock_irqsave(&ldata->read_lock, flags);
+       ldata->read_head = ldata->read_tail = ldata->read_cnt = 0;
+       spin_unlock_irqrestore(&ldata->read_lock, flags);
 
-       mutex_lock(&tty->echo_lock);
-       tty->echo_pos = tty->echo_cnt = tty->echo_overrun = 0;
-       mutex_unlock(&tty->echo_lock);
+       mutex_lock(&ldata->echo_lock);
+       ldata->echo_pos = ldata->echo_cnt = ldata->echo_overrun = 0;
+       mutex_unlock(&ldata->echo_lock);
 
-       tty->canon_head = tty->canon_data = tty->erasing = 0;
-       memset(&tty->read_flags, 0, sizeof tty->read_flags);
+       ldata->canon_head = ldata->canon_data = ldata->erasing = 0;
+       bitmap_zero(ldata->read_flags, N_TTY_BUF_SIZE);
        n_tty_set_room(tty);
 }
 
@@ -235,18 +272,19 @@ static void n_tty_flush_buffer(struct tty_struct *tty)
 
 static ssize_t n_tty_chars_in_buffer(struct tty_struct *tty)
 {
+       struct n_tty_data *ldata = tty->disc_data;
        unsigned long flags;
        ssize_t n = 0;
 
-       spin_lock_irqsave(&tty->read_lock, flags);
-       if (!tty->icanon) {
-               n = tty->read_cnt;
-       } else if (tty->canon_data) {
-               n = (tty->canon_head > tty->read_tail) ?
-                       tty->canon_head - tty->read_tail :
-                       tty->canon_head + (N_TTY_BUF_SIZE - tty->read_tail);
+       spin_lock_irqsave(&ldata->read_lock, flags);
+       if (!ldata->icanon) {
+               n = ldata->read_cnt;
+       } else if (ldata->canon_data) {
+               n = (ldata->canon_head > ldata->read_tail) ?
+                       ldata->canon_head - ldata->read_tail :
+                       ldata->canon_head + (N_TTY_BUF_SIZE - ldata->read_tail);
        }
-       spin_unlock_irqrestore(&tty->read_lock, flags);
+       spin_unlock_irqrestore(&ldata->read_lock, flags);
        return n;
 }
 
@@ -301,6 +339,7 @@ static inline int is_continuation(unsigned char c, struct tty_struct *tty)
 
 static int do_output_char(unsigned char c, struct tty_struct *tty, int space)
 {
+       struct n_tty_data *ldata = tty->disc_data;
        int     spaces;
 
        if (!space)
@@ -309,48 +348,48 @@ static int do_output_char(unsigned char c, struct tty_struct *tty, int space)
        switch (c) {
        case '\n':
                if (O_ONLRET(tty))
-                       tty->column = 0;
+                       ldata->column = 0;
                if (O_ONLCR(tty)) {
                        if (space < 2)
                                return -1;
-                       tty->canon_column = tty->column = 0;
+                       ldata->canon_column = ldata->column = 0;
                        tty->ops->write(tty, "\r\n", 2);
                        return 2;
                }
-               tty->canon_column = tty->column;
+               ldata->canon_column = ldata->column;
                break;
        case '\r':
-               if (O_ONOCR(tty) && tty->column == 0)
+               if (O_ONOCR(tty) && ldata->column == 0)
                        return 0;
                if (O_OCRNL(tty)) {
                        c = '\n';
                        if (O_ONLRET(tty))
-                               tty->canon_column = tty->column = 0;
+                               ldata->canon_column = ldata->column = 0;
                        break;
                }
-               tty->canon_column = tty->column = 0;
+               ldata->canon_column = ldata->column = 0;
                break;
        case '\t':
-               spaces = 8 - (tty->column & 7);
+               spaces = 8 - (ldata->column & 7);
                if (O_TABDLY(tty) == XTABS) {
                        if (space < spaces)
                                return -1;
-                       tty->column += spaces;
+                       ldata->column += spaces;
                        tty->ops->write(tty, "        ", spaces);
                        return spaces;
                }
-               tty->column += spaces;
+               ldata->column += spaces;
                break;
        case '\b':
-               if (tty->column > 0)
-                       tty->column--;
+               if (ldata->column > 0)
+                       ldata->column--;
                break;
        default:
                if (!iscntrl(c)) {
                        if (O_OLCUC(tty))
                                c = toupper(c);
                        if (!is_continuation(c, tty))
-                               tty->column++;
+                               ldata->column++;
                }
                break;
        }
@@ -375,14 +414,15 @@ static int do_output_char(unsigned char c, struct tty_struct *tty, int space)
 
 static int process_output(unsigned char c, struct tty_struct *tty)
 {
+       struct n_tty_data *ldata = tty->disc_data;
        int     space, retval;
 
-       mutex_lock(&tty->output_lock);
+       mutex_lock(&ldata->output_lock);
 
        space = tty_write_room(tty);
        retval = do_output_char(c, tty, space);
 
-       mutex_unlock(&tty->output_lock);
+       mutex_unlock(&ldata->output_lock);
        if (retval < 0)
                return -1;
        else
@@ -411,15 +451,16 @@ static int process_output(unsigned char c, struct tty_struct *tty)
 static ssize_t process_output_block(struct tty_struct *tty,
                                    const unsigned char *buf, unsigned int nr)
 {
+       struct n_tty_data *ldata = tty->disc_data;
        int     space;
        int     i;
        const unsigned char *cp;
 
-       mutex_lock(&tty->output_lock);
+       mutex_lock(&ldata->output_lock);
 
        space = tty_write_room(tty);
        if (!space) {
-               mutex_unlock(&tty->output_lock);
+               mutex_unlock(&ldata->output_lock);
                return 0;
        }
        if (nr > space)
@@ -431,30 +472,30 @@ static ssize_t process_output_block(struct tty_struct *tty,
                switch (c) {
                case '\n':
                        if (O_ONLRET(tty))
-                               tty->column = 0;
+                               ldata->column = 0;
                        if (O_ONLCR(tty))
                                goto break_out;
-                       tty->canon_column = tty->column;
+                       ldata->canon_column = ldata->column;
                        break;
                case '\r':
-                       if (O_ONOCR(tty) && tty->column == 0)
+                       if (O_ONOCR(tty) && ldata->column == 0)
                                goto break_out;
                        if (O_OCRNL(tty))
                                goto break_out;
-                       tty->canon_column = tty->column = 0;
+                       ldata->canon_column = ldata->column = 0;
                        break;
                case '\t':
                        goto break_out;
                case '\b':
-                       if (tty->column > 0)
-                               tty->column--;
+                       if (ldata->column > 0)
+                               ldata->column--;
                        break;
                default:
                        if (!iscntrl(c)) {
                                if (O_OLCUC(tty))
                                        goto break_out;
                                if (!is_continuation(c, tty))
-                                       tty->column++;
+                                       ldata->column++;
                        }
                        break;
                }
@@ -462,7 +503,7 @@ static ssize_t process_output_block(struct tty_struct *tty,
 break_out:
        i = tty->ops->write(tty, buf, i);
 
-       mutex_unlock(&tty->output_lock);
+       mutex_unlock(&ldata->output_lock);
        return i;
 }
 
@@ -494,21 +535,22 @@ break_out:
 
 static void process_echoes(struct tty_struct *tty)
 {
+       struct n_tty_data *ldata = tty->disc_data;
        int     space, nr;
        unsigned char c;
        unsigned char *cp, *buf_end;
 
-       if (!tty->echo_cnt)
+       if (!ldata->echo_cnt)
                return;
 
-       mutex_lock(&tty->output_lock);
-       mutex_lock(&tty->echo_lock);
+       mutex_lock(&ldata->output_lock);
+       mutex_lock(&ldata->echo_lock);
 
        space = tty_write_room(tty);
 
-       buf_end = tty->echo_buf + N_TTY_BUF_SIZE;
-       cp = tty->echo_buf + tty->echo_pos;
-       nr = tty->echo_cnt;
+       buf_end = ldata->echo_buf + N_TTY_BUF_SIZE;
+       cp = ldata->echo_buf + ldata->echo_pos;
+       nr = ldata->echo_cnt;
        while (nr > 0) {
                c = *cp;
                if (c == ECHO_OP_START) {
@@ -545,7 +587,7 @@ static void process_echoes(struct tty_struct *tty)
                                 * Otherwise, tab spacing is normal.
                                 */
                                if (!(num_chars & 0x80))
-                                       num_chars += tty->canon_column;
+                                       num_chars += ldata->canon_column;
                                num_bs = 8 - (num_chars & 7);
 
                                if (num_bs > space) {
@@ -555,22 +597,22 @@ static void process_echoes(struct tty_struct *tty)
                                space -= num_bs;
                                while (num_bs--) {
                                        tty_put_char(tty, '\b');
-                                       if (tty->column > 0)
-                                               tty->column--;
+                                       if (ldata->column > 0)
+                                               ldata->column--;
                                }
                                cp += 3;
                                nr -= 3;
                                break;
 
                        case ECHO_OP_SET_CANON_COL:
-                               tty->canon_column = tty->column;
+                               ldata->canon_column = ldata->column;
                                cp += 2;
                                nr -= 2;
                                break;
 
                        case ECHO_OP_MOVE_BACK_COL:
-                               if (tty->column > 0)
-                                       tty->column--;
+                               if (ldata->column > 0)
+                                       ldata->column--;
                                cp += 2;
                                nr -= 2;
                                break;
@@ -582,7 +624,7 @@ static void process_echoes(struct tty_struct *tty)
                                        break;
                                }
                                tty_put_char(tty, ECHO_OP_START);
-                               tty->column++;
+                               ldata->column++;
                                space--;
                                cp += 2;
                                nr -= 2;
@@ -604,7 +646,7 @@ static void process_echoes(struct tty_struct *tty)
                                }
                                tty_put_char(tty, '^');
                                tty_put_char(tty, op ^ 0100);
-                               tty->column += 2;
+                               ldata->column += 2;
                                space -= 2;
                                cp += 2;
                                nr -= 2;
@@ -635,20 +677,20 @@ static void process_echoes(struct tty_struct *tty)
        }
 
        if (nr == 0) {
-               tty->echo_pos = 0;
-               tty->echo_cnt = 0;
-               tty->echo_overrun = 0;
+               ldata->echo_pos = 0;
+               ldata->echo_cnt = 0;
+               ldata->echo_overrun = 0;
        } else {
-               int num_processed = tty->echo_cnt - nr;
-               tty->echo_pos += num_processed;
-               tty->echo_pos &= N_TTY_BUF_SIZE - 1;
-               tty->echo_cnt = nr;
+               int num_processed = ldata->echo_cnt - nr;
+               ldata->echo_pos += num_processed;
+               ldata->echo_pos &= N_TTY_BUF_SIZE - 1;
+               ldata->echo_cnt = nr;
                if (num_processed > 0)
-                       tty->echo_overrun = 0;
+                       ldata->echo_overrun = 0;
        }
 
-       mutex_unlock(&tty->echo_lock);
-       mutex_unlock(&tty->output_lock);
+       mutex_unlock(&ldata->echo_lock);
+       mutex_unlock(&ldata->output_lock);
 
        if (tty->ops->flush_chars)
                tty->ops->flush_chars(tty);
@@ -657,72 +699,70 @@ static void process_echoes(struct tty_struct *tty)
 /**
  *     add_echo_byte   -       add a byte to the echo buffer
  *     @c: unicode byte to echo
- *     @tty: terminal device
+ *     @ldata: n_tty data
  *
  *     Add a character or operation byte to the echo buffer.
  *
  *     Should be called under the echo lock to protect the echo buffer.
  */
 
-static void add_echo_byte(unsigned char c, struct tty_struct *tty)
+static void add_echo_byte(unsigned char c, struct n_tty_data *ldata)
 {
        int     new_byte_pos;
 
-       if (tty->echo_cnt == N_TTY_BUF_SIZE) {
+       if (ldata->echo_cnt == N_TTY_BUF_SIZE) {
                /* Circular buffer is already at capacity */
-               new_byte_pos = tty->echo_pos;
+               new_byte_pos = ldata->echo_pos;
 
                /*
                 * Since the buffer start position needs to be advanced,
                 * be sure to step by a whole operation byte group.
                 */
-               if (tty->echo_buf[tty->echo_pos] == ECHO_OP_START) {
-                       if (tty->echo_buf[(tty->echo_pos + 1) &
+               if (ldata->echo_buf[ldata->echo_pos] == ECHO_OP_START) {
+                       if (ldata->echo_buf[(ldata->echo_pos + 1) &
                                          (N_TTY_BUF_SIZE - 1)] ==
                                                ECHO_OP_ERASE_TAB) {
-                               tty->echo_pos += 3;
-                               tty->echo_cnt -= 2;
+                               ldata->echo_pos += 3;
+                               ldata->echo_cnt -= 2;
                        } else {
-                               tty->echo_pos += 2;
-                               tty->echo_cnt -= 1;
+                               ldata->echo_pos += 2;
+                               ldata->echo_cnt -= 1;
                        }
                } else {
-                       tty->echo_pos++;
+                       ldata->echo_pos++;
                }
-               tty->echo_pos &= N_TTY_BUF_SIZE - 1;
+               ldata->echo_pos &= N_TTY_BUF_SIZE - 1;
 
-               tty->echo_overrun = 1;
+               ldata->echo_overrun = 1;
        } else {
-               new_byte_pos = tty->echo_pos + tty->echo_cnt;
+               new_byte_pos = ldata->echo_pos + ldata->echo_cnt;
                new_byte_pos &= N_TTY_BUF_SIZE - 1;
-               tty->echo_cnt++;
+               ldata->echo_cnt++;
        }
 
-       tty->echo_buf[new_byte_pos] = c;
+       ldata->echo_buf[new_byte_pos] = c;
 }
 
 /**
  *     echo_move_back_col      -       add operation to move back a column
- *     @tty: terminal device
+ *     @ldata: n_tty data
  *
  *     Add an operation to the echo buffer to move back one column.
  *
  *     Locking: echo_lock to protect the echo buffer
  */
 
-static void echo_move_back_col(struct tty_struct *tty)
+static void echo_move_back_col(struct n_tty_data *ldata)
 {
-       mutex_lock(&tty->echo_lock);
-
-       add_echo_byte(ECHO_OP_START, tty);
-       add_echo_byte(ECHO_OP_MOVE_BACK_COL, tty);
-
-       mutex_unlock(&tty->echo_lock);
+       mutex_lock(&ldata->echo_lock);
+       add_echo_byte(ECHO_OP_START, ldata);
+       add_echo_byte(ECHO_OP_MOVE_BACK_COL, ldata);
+       mutex_unlock(&ldata->echo_lock);
 }
 
 /**
  *     echo_set_canon_col      -       add operation to set the canon column
- *     @tty: terminal device
+ *     @ldata: n_tty data
  *
  *     Add an operation to the echo buffer to set the canon column
  *     to the current column.
@@ -730,21 +770,19 @@ static void echo_move_back_col(struct tty_struct *tty)
  *     Locking: echo_lock to protect the echo buffer
  */
 
-static void echo_set_canon_col(struct tty_struct *tty)
+static void echo_set_canon_col(struct n_tty_data *ldata)
 {
-       mutex_lock(&tty->echo_lock);
-
-       add_echo_byte(ECHO_OP_START, tty);
-       add_echo_byte(ECHO_OP_SET_CANON_COL, tty);
-
-       mutex_unlock(&tty->echo_lock);
+       mutex_lock(&ldata->echo_lock);
+       add_echo_byte(ECHO_OP_START, ldata);
+       add_echo_byte(ECHO_OP_SET_CANON_COL, ldata);
+       mutex_unlock(&ldata->echo_lock);
 }
 
 /**
  *     echo_erase_tab  -       add operation to erase a tab
  *     @num_chars: number of character columns already used
  *     @after_tab: true if num_chars starts after a previous tab
- *     @tty: terminal device
+ *     @ldata: n_tty data
  *
  *     Add an operation to the echo buffer to erase a tab.
  *
@@ -758,12 +796,12 @@ static void echo_set_canon_col(struct tty_struct *tty)
  */
 
 static void echo_erase_tab(unsigned int num_chars, int after_tab,
-                          struct tty_struct *tty)
+                          struct n_tty_data *ldata)
 {
-       mutex_lock(&tty->echo_lock);
+       mutex_lock(&ldata->echo_lock);
 
-       add_echo_byte(ECHO_OP_START, tty);
-       add_echo_byte(ECHO_OP_ERASE_TAB, tty);
+       add_echo_byte(ECHO_OP_START, ldata);
+       add_echo_byte(ECHO_OP_ERASE_TAB, ldata);
 
        /* We only need to know this modulo 8 (tab spacing) */
        num_chars &= 7;
@@ -772,9 +810,9 @@ static void echo_erase_tab(unsigned int num_chars, int after_tab,
        if (after_tab)
                num_chars |= 0x80;
 
-       add_echo_byte(num_chars, tty);
+       add_echo_byte(num_chars, ldata);
 
-       mutex_unlock(&tty->echo_lock);
+       mutex_unlock(&ldata->echo_lock);
 }
 
 /**
@@ -790,18 +828,16 @@ static void echo_erase_tab(unsigned int num_chars, int after_tab,
  *     Locking: echo_lock to protect the echo buffer
  */
 
-static void echo_char_raw(unsigned char c, struct tty_struct *tty)
+static void echo_char_raw(unsigned char c, struct n_tty_data *ldata)
 {
-       mutex_lock(&tty->echo_lock);
-
+       mutex_lock(&ldata->echo_lock);
        if (c == ECHO_OP_START) {
-               add_echo_byte(ECHO_OP_START, tty);
-               add_echo_byte(ECHO_OP_START, tty);
+               add_echo_byte(ECHO_OP_START, ldata);
+               add_echo_byte(ECHO_OP_START, ldata);
        } else {
-               add_echo_byte(c, tty);
+               add_echo_byte(c, ldata);
        }
-
-       mutex_unlock(&tty->echo_lock);
+       mutex_unlock(&ldata->echo_lock);
 }
 
 /**
@@ -820,30 +856,32 @@ static void echo_char_raw(unsigned char c, struct tty_struct *tty)
 
 static void echo_char(unsigned char c, struct tty_struct *tty)
 {
-       mutex_lock(&tty->echo_lock);
+       struct n_tty_data *ldata = tty->disc_data;
+
+       mutex_lock(&ldata->echo_lock);
 
        if (c == ECHO_OP_START) {
-               add_echo_byte(ECHO_OP_START, tty);
-               add_echo_byte(ECHO_OP_START, tty);
+               add_echo_byte(ECHO_OP_START, ldata);
+               add_echo_byte(ECHO_OP_START, ldata);
        } else {
                if (L_ECHOCTL(tty) && iscntrl(c) && c != '\t')
-                       add_echo_byte(ECHO_OP_START, tty);
-               add_echo_byte(c, tty);
+                       add_echo_byte(ECHO_OP_START, ldata);
+               add_echo_byte(c, ldata);
        }
 
-       mutex_unlock(&tty->echo_lock);
+       mutex_unlock(&ldata->echo_lock);
 }
 
 /**
  *     finish_erasing          -       complete erase
- *     @tty: tty doing the erase
+ *     @ldata: n_tty data
  */
 
-static inline void finish_erasing(struct tty_struct *tty)
+static inline void finish_erasing(struct n_tty_data *ldata)
 {
-       if (tty->erasing) {
-               echo_char_raw('/', tty);
-               tty->erasing = 0;
+       if (ldata->erasing) {
+               echo_char_raw('/', ldata);
+               ldata->erasing = 0;
        }
 }
 
@@ -861,12 +899,13 @@ static inline void finish_erasing(struct tty_struct *tty)
 
 static void eraser(unsigned char c, struct tty_struct *tty)
 {
+       struct n_tty_data *ldata = tty->disc_data;
        enum { ERASE, WERASE, KILL } kill_type;
        int head, seen_alnums, cnt;
        unsigned long flags;
 
        /* FIXME: locking needed ? */
-       if (tty->read_head == tty->canon_head) {
+       if (ldata->read_head == ldata->canon_head) {
                /* process_output('\a', tty); */ /* what do you think? */
                return;
        }
@@ -876,24 +915,24 @@ static void eraser(unsigned char c, struct tty_struct *tty)
                kill_type = WERASE;
        else {
                if (!L_ECHO(tty)) {
-                       spin_lock_irqsave(&tty->read_lock, flags);
-                       tty->read_cnt -= ((tty->read_head - tty->canon_head) &
+                       spin_lock_irqsave(&ldata->read_lock, flags);
+                       ldata->read_cnt -= ((ldata->read_head - ldata->canon_head) &
                                          (N_TTY_BUF_SIZE - 1));
-                       tty->read_head = tty->canon_head;
-                       spin_unlock_irqrestore(&tty->read_lock, flags);
+                       ldata->read_head = ldata->canon_head;
+                       spin_unlock_irqrestore(&ldata->read_lock, flags);
                        return;
                }
                if (!L_ECHOK(tty) || !L_ECHOKE(tty) || !L_ECHOE(tty)) {
-                       spin_lock_irqsave(&tty->read_lock, flags);
-                       tty->read_cnt -= ((tty->read_head - tty->canon_head) &
+                       spin_lock_irqsave(&ldata->read_lock, flags);
+                       ldata->read_cnt -= ((ldata->read_head - ldata->canon_head) &
                                          (N_TTY_BUF_SIZE - 1));
-                       tty->read_head = tty->canon_head;
-                       spin_unlock_irqrestore(&tty->read_lock, flags);
-                       finish_erasing(tty);
+                       ldata->read_head = ldata->canon_head;
+                       spin_unlock_irqrestore(&ldata->read_lock, flags);
+                       finish_erasing(ldata);
                        echo_char(KILL_CHAR(tty), tty);
                        /* Add a newline if ECHOK is on and ECHOKE is off. */
                        if (L_ECHOK(tty))
-                               echo_char_raw('\n', tty);
+                               echo_char_raw('\n', ldata);
                        return;
                }
                kill_type = KILL;
@@ -901,14 +940,14 @@ static void eraser(unsigned char c, struct tty_struct *tty)
 
        seen_alnums = 0;
        /* FIXME: Locking ?? */
-       while (tty->read_head != tty->canon_head) {
-               head = tty->read_head;
+       while (ldata->read_head != ldata->canon_head) {
+               head = ldata->read_head;
 
                /* erase a single possibly multibyte character */
                do {
                        head = (head - 1) & (N_TTY_BUF_SIZE-1);
-                       c = tty->read_buf[head];
-               } while (is_continuation(c, tty) && head != tty->canon_head);
+                       c = ldata->read_buf[head];
+               } while (is_continuation(c, tty) && head != ldata->canon_head);
 
                /* do not partially erase */
                if (is_continuation(c, tty))
@@ -921,30 +960,31 @@ static void eraser(unsigned char c, struct tty_struct *tty)
                        else if (seen_alnums)
                                break;
                }
-               cnt = (tty->read_head - head) & (N_TTY_BUF_SIZE-1);
-               spin_lock_irqsave(&tty->read_lock, flags);
-               tty->read_head = head;
-               tty->read_cnt -= cnt;
-               spin_unlock_irqrestore(&tty->read_lock, flags);
+               cnt = (ldata->read_head - head) & (N_TTY_BUF_SIZE-1);
+               spin_lock_irqsave(&ldata->read_lock, flags);
+               ldata->read_head = head;
+               ldata->read_cnt -= cnt;
+               spin_unlock_irqrestore(&ldata->read_lock, flags);
                if (L_ECHO(tty)) {
                        if (L_ECHOPRT(tty)) {
-                               if (!tty->erasing) {
-                                       echo_char_raw('\\', tty);
-                                       tty->erasing = 1;
+                               if (!ldata->erasing) {
+                                       echo_char_raw('\\', ldata);
+                                       ldata->erasing = 1;
                                }
                                /* if cnt > 1, output a multi-byte character */
                                echo_char(c, tty);
                                while (--cnt > 0) {
                                        head = (head+1) & (N_TTY_BUF_SIZE-1);
-                                       echo_char_raw(tty->read_buf[head], tty);
-                                       echo_move_back_col(tty);
+                                       echo_char_raw(ldata->read_buf[head],
+                                                       ldata);
+                                       echo_move_back_col(ldata);
                                }
                        } else if (kill_type == ERASE && !L_ECHOE(tty)) {
                                echo_char(ERASE_CHAR(tty), tty);
                        } else if (c == '\t') {
                                unsigned int num_chars = 0;
                                int after_tab = 0;
-                               unsigned long tail = tty->read_head;
+                               unsigned long tail = ldata->read_head;
 
                                /*
                                 * Count the columns used for characters
@@ -953,9 +993,9 @@ static void eraser(unsigned char c, struct tty_struct *tty)
                                 * This info is used to go back the correct
                                 * number of columns.
                                 */
-                               while (tail != tty->canon_head) {
+                               while (tail != ldata->canon_head) {
                                        tail = (tail-1) & (N_TTY_BUF_SIZE-1);
-                                       c = tty->read_buf[tail];
+                                       c = ldata->read_buf[tail];
                                        if (c == '\t') {
                                                after_tab = 1;
                                                break;
@@ -966,25 +1006,25 @@ static void eraser(unsigned char c, struct tty_struct *tty)
                                                num_chars++;
                                        }
                                }
-                               echo_erase_tab(num_chars, after_tab, tty);
+                               echo_erase_tab(num_chars, after_tab, ldata);
                        } else {
                                if (iscntrl(c) && L_ECHOCTL(tty)) {
-                                       echo_char_raw('\b', tty);
-                                       echo_char_raw(' ', tty);
-                                       echo_char_raw('\b', tty);
+                                       echo_char_raw('\b', ldata);
+                                       echo_char_raw(' ', ldata);
+                                       echo_char_raw('\b', ldata);
                                }
                                if (!iscntrl(c) || L_ECHOCTL(tty)) {
-                                       echo_char_raw('\b', tty);
-                                       echo_char_raw(' ', tty);
-                                       echo_char_raw('\b', tty);
+                                       echo_char_raw('\b', ldata);
+                                       echo_char_raw(' ', ldata);
+                                       echo_char_raw('\b', ldata);
                                }
                        }
                }
                if (kill_type == ERASE)
                        break;
        }
-       if (tty->read_head == tty->canon_head && L_ECHO(tty))
-               finish_erasing(tty);
+       if (ldata->read_head == ldata->canon_head && L_ECHO(tty))
+               finish_erasing(ldata);
 }
 
 /**
@@ -1023,6 +1063,8 @@ static inline void isig(int sig, struct tty_struct *tty, int flush)
 
 static inline void n_tty_receive_break(struct tty_struct *tty)
 {
+       struct n_tty_data *ldata = tty->disc_data;
+
        if (I_IGNBRK(tty))
                return;
        if (I_BRKINT(tty)) {
@@ -1030,10 +1072,10 @@ static inline void n_tty_receive_break(struct tty_struct *tty)
                return;
        }
        if (I_PARMRK(tty)) {
-               put_tty_queue('\377', tty);
-               put_tty_queue('\0', tty);
+               put_tty_queue('\377', ldata);
+               put_tty_queue('\0', ldata);
        }
-       put_tty_queue('\0', tty);
+       put_tty_queue('\0', ldata);
        wake_up_interruptible(&tty->read_wait);
 }
 
@@ -1052,16 +1094,17 @@ static inline void n_tty_receive_break(struct tty_struct *tty)
 
 static inline void n_tty_receive_overrun(struct tty_struct *tty)
 {
+       struct n_tty_data *ldata = tty->disc_data;
        char buf[64];
 
-       tty->num_overrun++;
-       if (time_before(tty->overrun_time, jiffies - HZ) ||
-                       time_after(tty->overrun_time, jiffies)) {
+       ldata->num_overrun++;
+       if (time_after(jiffies, ldata->overrun_time + HZ) ||
+                       time_after(ldata->overrun_time, jiffies)) {
                printk(KERN_WARNING "%s: %d input overrun(s)\n",
                        tty_name(tty, buf),
-                       tty->num_overrun);
-               tty->overrun_time = jiffies;
-               tty->num_overrun = 0;
+                       ldata->num_overrun);
+               ldata->overrun_time = jiffies;
+               ldata->num_overrun = 0;
        }
 }
 
@@ -1076,16 +1119,18 @@ static inline void n_tty_receive_overrun(struct tty_struct *tty)
 static inline void n_tty_receive_parity_error(struct tty_struct *tty,
                                              unsigned char c)
 {
+       struct n_tty_data *ldata = tty->disc_data;
+
        if (I_IGNPAR(tty))
                return;
        if (I_PARMRK(tty)) {
-               put_tty_queue('\377', tty);
-               put_tty_queue('\0', tty);
-               put_tty_queue(c, tty);
+               put_tty_queue('\377', ldata);
+               put_tty_queue('\0', ldata);
+               put_tty_queue(c, ldata);
        } else  if (I_INPCK(tty))
-               put_tty_queue('\0', tty);
+               put_tty_queue('\0', ldata);
        else
-               put_tty_queue(c, tty);
+               put_tty_queue(c, ldata);
        wake_up_interruptible(&tty->read_wait);
 }
 
@@ -1101,11 +1146,12 @@ static inline void n_tty_receive_parity_error(struct tty_struct *tty,
 
 static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
 {
+       struct n_tty_data *ldata = tty->disc_data;
        unsigned long flags;
        int parmrk;
 
-       if (tty->raw) {
-               put_tty_queue(c, tty);
+       if (ldata->raw) {
+               put_tty_queue(c, ldata);
                return;
        }
 
@@ -1115,7 +1161,7 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
                c = tolower(c);
 
        if (L_EXTPROC(tty)) {
-               put_tty_queue(c, tty);
+               put_tty_queue(c, ldata);
                return;
        }
 
@@ -1143,26 +1189,26 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
         * handle specially, do shortcut processing to speed things
         * up.
         */
-       if (!test_bit(c, tty->process_char_map) || tty->lnext) {
-               tty->lnext = 0;
+       if (!test_bit(c, ldata->process_char_map) || ldata->lnext) {
+               ldata->lnext = 0;
                parmrk = (c == (unsigned char) '\377' && I_PARMRK(tty)) ? 1 : 0;
-               if (tty->read_cnt >= (N_TTY_BUF_SIZE - parmrk - 1)) {
+               if (ldata->read_cnt >= (N_TTY_BUF_SIZE - parmrk - 1)) {
                        /* beep if no space */
                        if (L_ECHO(tty))
                                process_output('\a', tty);
                        return;
                }
                if (L_ECHO(tty)) {
-                       finish_erasing(tty);
+                       finish_erasing(ldata);
                        /* Record the column of first canon char. */
-                       if (tty->canon_head == tty->read_head)
-                               echo_set_canon_col(tty);
+                       if (ldata->canon_head == ldata->read_head)
+                               echo_set_canon_col(ldata);
                        echo_char(c, tty);
                        process_echoes(tty);
                }
                if (parmrk)
-                       put_tty_queue(c, tty);
-               put_tty_queue(c, tty);
+                       put_tty_queue(c, ldata);
+               put_tty_queue(c, ldata);
                return;
        }
 
@@ -1218,7 +1264,7 @@ send_signal:
        } else if (c == '\n' && I_INLCR(tty))
                c = '\r';
 
-       if (tty->icanon) {
+       if (ldata->icanon) {
                if (c == ERASE_CHAR(tty) || c == KILL_CHAR(tty) ||
                    (c == WERASE_CHAR(tty) && L_IEXTEN(tty))) {
                        eraser(c, tty);
@@ -1226,12 +1272,12 @@ send_signal:
                        return;
                }
                if (c == LNEXT_CHAR(tty) && L_IEXTEN(tty)) {
-                       tty->lnext = 1;
+                       ldata->lnext = 1;
                        if (L_ECHO(tty)) {
-                               finish_erasing(tty);
+                               finish_erasing(ldata);
                                if (L_ECHOCTL(tty)) {
-                                       echo_char_raw('^', tty);
-                                       echo_char_raw('\b', tty);
+                                       echo_char_raw('^', ldata);
+                                       echo_char_raw('\b', ldata);
                                        process_echoes(tty);
                                }
                        }
@@ -1239,34 +1285,34 @@ send_signal:
                }
                if (c == REPRINT_CHAR(tty) && L_ECHO(tty) &&
                    L_IEXTEN(tty)) {
-                       unsigned long tail = tty->canon_head;
+                       unsigned long tail = ldata->canon_head;
 
-                       finish_erasing(tty);
+                       finish_erasing(ldata);
                        echo_char(c, tty);
-                       echo_char_raw('\n', tty);
-                       while (tail != tty->read_head) {
-                               echo_char(tty->read_buf[tail], tty);
+                       echo_char_raw('\n', ldata);
+                       while (tail != ldata->read_head) {
+                               echo_char(ldata->read_buf[tail], tty);
                                tail = (tail+1) & (N_TTY_BUF_SIZE-1);
                        }
                        process_echoes(tty);
                        return;
                }
                if (c == '\n') {
-                       if (tty->read_cnt >= N_TTY_BUF_SIZE) {
+                       if (ldata->read_cnt >= N_TTY_BUF_SIZE) {
                                if (L_ECHO(tty))
                                        process_output('\a', tty);
                                return;
                        }
                        if (L_ECHO(tty) || L_ECHONL(tty)) {
-                               echo_char_raw('\n', tty);
+                               echo_char_raw('\n', ldata);
                                process_echoes(tty);
                        }
                        goto handle_newline;
                }
                if (c == EOF_CHAR(tty)) {
-                       if (tty->read_cnt >= N_TTY_BUF_SIZE)
+                       if (ldata->read_cnt >= N_TTY_BUF_SIZE)
                                return;
-                       if (tty->canon_head != tty->read_head)
+                       if (ldata->canon_head != ldata->read_head)
                                set_bit(TTY_PUSH, &tty->flags);
                        c = __DISABLED_CHAR;
                        goto handle_newline;
@@ -1275,7 +1321,7 @@ send_signal:
                    (c == EOL2_CHAR(tty) && L_IEXTEN(tty))) {
                        parmrk = (c == (unsigned char) '\377' && I_PARMRK(tty))
                                 ? 1 : 0;
-                       if (tty->read_cnt >= (N_TTY_BUF_SIZE - parmrk)) {
+                       if (ldata->read_cnt >= (N_TTY_BUF_SIZE - parmrk)) {
                                if (L_ECHO(tty))
                                        process_output('\a', tty);
                                return;
@@ -1285,8 +1331,8 @@ send_signal:
                         */
                        if (L_ECHO(tty)) {
                                /* Record the column of first canon char. */
-                               if (tty->canon_head == tty->read_head)
-                                       echo_set_canon_col(tty);
+                               if (ldata->canon_head == ldata->read_head)
+                                       echo_set_canon_col(ldata);
                                echo_char(c, tty);
                                process_echoes(tty);
                        }
@@ -1295,15 +1341,15 @@ send_signal:
                         * EOL_CHAR and EOL2_CHAR?
                         */
                        if (parmrk)
-                               put_tty_queue(c, tty);
+                               put_tty_queue(c, ldata);
 
 handle_newline:
-                       spin_lock_irqsave(&tty->read_lock, flags);
-                       set_bit(tty->read_head, tty->read_flags);
-                       put_tty_queue_nolock(c, tty);
-                       tty->canon_head = tty->read_head;
-                       tty->canon_data++;
-                       spin_unlock_irqrestore(&tty->read_lock, flags);
+                       spin_lock_irqsave(&ldata->read_lock, flags);
+                       set_bit(ldata->read_head, ldata->read_flags);
+                       put_tty_queue_nolock(c, ldata);
+                       ldata->canon_head = ldata->read_head;
+                       ldata->canon_data++;
+                       spin_unlock_irqrestore(&ldata->read_lock, flags);
                        kill_fasync(&tty->fasync, SIGIO, POLL_IN);
                        if (waitqueue_active(&tty->read_wait))
                                wake_up_interruptible(&tty->read_wait);
@@ -1312,29 +1358,29 @@ handle_newline:
        }
 
        parmrk = (c == (unsigned char) '\377' && I_PARMRK(tty)) ? 1 : 0;
-       if (tty->read_cnt >= (N_TTY_BUF_SIZE - parmrk - 1)) {
+       if (ldata->read_cnt >= (N_TTY_BUF_SIZE - parmrk - 1)) {
                /* beep if no space */
                if (L_ECHO(tty))
                        process_output('\a', tty);
                return;
        }
        if (L_ECHO(tty)) {
-               finish_erasing(tty);
+               finish_erasing(ldata);
                if (c == '\n')
-                       echo_char_raw('\n', tty);
+                       echo_char_raw('\n', ldata);
                else {
                        /* Record the column of first canon char. */
-                       if (tty->canon_head == tty->read_head)
-                               echo_set_canon_col(tty);
+                       if (ldata->canon_head == ldata->read_head)
+                               echo_set_canon_col(ldata);
                        echo_char(c, tty);
                }
                process_echoes(tty);
        }
 
        if (parmrk)
-               put_tty_queue(c, tty);
+               put_tty_queue(c, ldata);
 
-       put_tty_queue(c, tty);
+       put_tty_queue(c, ldata);
 }
 
 
@@ -1369,33 +1415,31 @@ static void n_tty_write_wakeup(struct tty_struct *tty)
 static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
                              char *fp, int count)
 {
+       struct n_tty_data *ldata = tty->disc_data;
        const unsigned char *p;
        char *f, flags = TTY_NORMAL;
        int     i;
        char    buf[64];
        unsigned long cpuflags;
 
-       if (!tty->read_buf)
-               return;
-
-       if (tty->real_raw) {
-               spin_lock_irqsave(&tty->read_lock, cpuflags);
-               i = min(N_TTY_BUF_SIZE - tty->read_cnt,
-                       N_TTY_BUF_SIZE - tty->read_head);
+       if (ldata->real_raw) {
+               spin_lock_irqsave(&ldata->read_lock, cpuflags);
+               i = min(N_TTY_BUF_SIZE - ldata->read_cnt,
+                       N_TTY_BUF_SIZE - ldata->read_head);
                i = min(count, i);
-               memcpy(tty->read_buf + tty->read_head, cp, i);
-               tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1);
-               tty->read_cnt += i;
+               memcpy(ldata->read_buf + ldata->read_head, cp, i);
+               ldata->read_head = (ldata->read_head + i) & (N_TTY_BUF_SIZE-1);
+               ldata->read_cnt += i;
                cp += i;
                count -= i;
 
-               i = min(N_TTY_BUF_SIZE - tty->read_cnt,
-                       N_TTY_BUF_SIZE - tty->read_head);
+               i = min(N_TTY_BUF_SIZE - ldata->read_cnt,
+                       N_TTY_BUF_SIZE - ldata->read_head);
                i = min(count, i);
-               memcpy(tty->read_buf + tty->read_head, cp, i);
-               tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1);
-               tty->read_cnt += i;
-               spin_unlock_irqrestore(&tty->read_lock, cpuflags);
+               memcpy(ldata->read_buf + ldata->read_head, cp, i);
+               ldata->read_head = (ldata->read_head + i) & (N_TTY_BUF_SIZE-1);
+               ldata->read_cnt += i;
+               spin_unlock_irqrestore(&ldata->read_lock, cpuflags);
        } else {
                for (i = count, p = cp, f = fp; i; i--, p++) {
                        if (f)
@@ -1426,7 +1470,7 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
 
        n_tty_set_room(tty);
 
-       if ((!tty->icanon && (tty->read_cnt >= tty->minimum_to_wake)) ||
+       if ((!ldata->icanon && (ldata->read_cnt >= tty->minimum_to_wake)) ||
                L_EXTPROC(tty)) {
                kill_fasync(&tty->fasync, SIGIO, POLL_IN);
                if (waitqueue_active(&tty->read_wait))
@@ -1470,25 +1514,25 @@ int is_ignored(int sig)
 
 static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
 {
+       struct n_tty_data *ldata = tty->disc_data;
        int canon_change = 1;
-       BUG_ON(!tty);
 
        if (old)
                canon_change = (old->c_lflag ^ tty->termios.c_lflag) & ICANON;
        if (canon_change) {
-               memset(&tty->read_flags, 0, sizeof tty->read_flags);
-               tty->canon_head = tty->read_tail;
-               tty->canon_data = 0;
-               tty->erasing = 0;
+               bitmap_zero(ldata->read_flags, N_TTY_BUF_SIZE);
+               ldata->canon_head = ldata->read_tail;
+               ldata->canon_data = 0;
+               ldata->erasing = 0;
        }
 
-       if (canon_change && !L_ICANON(tty) && tty->read_cnt)
+       if (canon_change && !L_ICANON(tty) && ldata->read_cnt)
                wake_up_interruptible(&tty->read_wait);
 
-       tty->icanon = (L_ICANON(tty) != 0);
+       ldata->icanon = (L_ICANON(tty) != 0);
        if (test_bit(TTY_HW_COOK_IN, &tty->flags)) {
-               tty->raw = 1;
-               tty->real_raw = 1;
+               ldata->raw = 1;
+               ldata->real_raw = 1;
                n_tty_set_room(tty);
                return;
        }
@@ -1496,51 +1540,51 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
            I_ICRNL(tty) || I_INLCR(tty) || L_ICANON(tty) ||
            I_IXON(tty) || L_ISIG(tty) || L_ECHO(tty) ||
            I_PARMRK(tty)) {
-               memset(tty->process_char_map, 0, 256/8);
+               bitmap_zero(ldata->process_char_map, 256);
 
                if (I_IGNCR(tty) || I_ICRNL(tty))
-                       set_bit('\r', tty->process_char_map);
+                       set_bit('\r', ldata->process_char_map);
                if (I_INLCR(tty))
-                       set_bit('\n', tty->process_char_map);
+                       set_bit('\n', ldata->process_char_map);
 
                if (L_ICANON(tty)) {
-                       set_bit(ERASE_CHAR(tty), tty->process_char_map);
-                       set_bit(KILL_CHAR(tty), tty->process_char_map);
-                       set_bit(EOF_CHAR(tty), tty->process_char_map);
-                       set_bit('\n', tty->process_char_map);
-                       set_bit(EOL_CHAR(tty), tty->process_char_map);
+                       set_bit(ERASE_CHAR(tty), ldata->process_char_map);
+                       set_bit(KILL_CHAR(tty), ldata->process_char_map);
+                       set_bit(EOF_CHAR(tty), ldata->process_char_map);
+                       set_bit('\n', ldata->process_char_map);
+                       set_bit(EOL_CHAR(tty), ldata->process_char_map);
                        if (L_IEXTEN(tty)) {
                                set_bit(WERASE_CHAR(tty),
-                                       tty->process_char_map);
+                                       ldata->process_char_map);
                                set_bit(LNEXT_CHAR(tty),
-                                       tty->process_char_map);
+                                       ldata->process_char_map);
                                set_bit(EOL2_CHAR(tty),
-                                       tty->process_char_map);
+                                       ldata->process_char_map);
                                if (L_ECHO(tty))
                                        set_bit(REPRINT_CHAR(tty),
-                                               tty->process_char_map);
+                                               ldata->process_char_map);
                        }
                }
                if (I_IXON(tty)) {
-                       set_bit(START_CHAR(tty), tty->process_char_map);
-                       set_bit(STOP_CHAR(tty), tty->process_char_map);
+                       set_bit(START_CHAR(tty), ldata->process_char_map);
+                       set_bit(STOP_CHAR(tty), ldata->process_char_map);
                }
                if (L_ISIG(tty)) {
-                       set_bit(INTR_CHAR(tty), tty->process_char_map);
-                       set_bit(QUIT_CHAR(tty), tty->process_char_map);
-                       set_bit(SUSP_CHAR(tty), tty->process_char_map);
+                       set_bit(INTR_CHAR(tty), ldata->process_char_map);
+                       set_bit(QUIT_CHAR(tty), ldata->process_char_map);
+                       set_bit(SUSP_CHAR(tty), ldata->process_char_map);
                }
-               clear_bit(__DISABLED_CHAR, tty->process_char_map);
-               tty->raw = 0;
-               tty->real_raw = 0;
+               clear_bit(__DISABLED_CHAR, ldata->process_char_map);
+               ldata->raw = 0;
+               ldata->real_raw = 0;
        } else {
-               tty->raw = 1;
+               ldata->raw = 1;
                if ((I_IGNBRK(tty) || (!I_BRKINT(tty) && !I_PARMRK(tty))) &&
                    (I_IGNPAR(tty) || !I_INPCK(tty)) &&
                    (tty->driver->flags & TTY_DRIVER_REAL_RAW))
-                       tty->real_raw = 1;
+                       ldata->real_raw = 1;
                else
-                       tty->real_raw = 0;
+                       ldata->real_raw = 0;
        }
        n_tty_set_room(tty);
        /* The termios change make the tty ready for I/O */
@@ -1560,15 +1604,13 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
 
 static void n_tty_close(struct tty_struct *tty)
 {
+       struct n_tty_data *ldata = tty->disc_data;
+
        n_tty_flush_buffer(tty);
-       if (tty->read_buf) {
-               kfree(tty->read_buf);
-               tty->read_buf = NULL;
-       }
-       if (tty->echo_buf) {
-               kfree(tty->echo_buf);
-               tty->echo_buf = NULL;
-       }
+       kfree(ldata->read_buf);
+       kfree(ldata->echo_buf);
+       kfree(ldata);
+       tty->disc_data = NULL;
 }
 
 /**
@@ -1583,37 +1625,50 @@ static void n_tty_close(struct tty_struct *tty)
 
 static int n_tty_open(struct tty_struct *tty)
 {
-       if (!tty)
-               return -EINVAL;
+       struct n_tty_data *ldata;
+
+       ldata = kzalloc(sizeof(*ldata), GFP_KERNEL);
+       if (!ldata)
+               goto err;
+
+       ldata->overrun_time = jiffies;
+       mutex_init(&ldata->atomic_read_lock);
+       mutex_init(&ldata->output_lock);
+       mutex_init(&ldata->echo_lock);
+       spin_lock_init(&ldata->read_lock);
 
        /* These are ugly. Currently a malloc failure here can panic */
-       if (!tty->read_buf) {
-               tty->read_buf = kzalloc(N_TTY_BUF_SIZE, GFP_KERNEL);
-               if (!tty->read_buf)
-                       return -ENOMEM;
-       }
-       if (!tty->echo_buf) {
-               tty->echo_buf = kzalloc(N_TTY_BUF_SIZE, GFP_KERNEL);
+       ldata->read_buf = kzalloc(N_TTY_BUF_SIZE, GFP_KERNEL);
+       ldata->echo_buf = kzalloc(N_TTY_BUF_SIZE, GFP_KERNEL);
+       if (!ldata->read_buf || !ldata->echo_buf)
+               goto err_free_bufs;
 
-               if (!tty->echo_buf)
-                       return -ENOMEM;
-       }
+       tty->disc_data = ldata;
        reset_buffer_flags(tty);
        tty_unthrottle(tty);
-       tty->column = 0;
+       ldata->column = 0;
        n_tty_set_termios(tty, NULL);
        tty->minimum_to_wake = 1;
        tty->closing = 0;
+
        return 0;
+err_free_bufs:
+       kfree(ldata->read_buf);
+       kfree(ldata->echo_buf);
+       kfree(ldata);
+err:
+       return -ENOMEM;
 }
 
 static inline int input_available_p(struct tty_struct *tty, int amt)
 {
+       struct n_tty_data *ldata = tty->disc_data;
+
        tty_flush_to_ldisc(tty);
-       if (tty->icanon && !L_EXTPROC(tty)) {
-               if (tty->canon_data)
+       if (ldata->icanon && !L_EXTPROC(tty)) {
+               if (ldata->canon_data)
                        return 1;
-       } else if (tty->read_cnt >= (amt ? amt : 1))
+       } else if (ldata->read_cnt >= (amt ? amt : 1))
                return 1;
 
        return 0;
@@ -1632,7 +1687,7 @@ static inline int input_available_p(struct tty_struct *tty, int amt)
  *     buffer, and once to drain the space from the (physical) beginning of
  *     the buffer to head pointer.
  *
- *     Called under the tty->atomic_read_lock sem
+ *     Called under the ldata->atomic_read_lock sem
  *
  */
 
@@ -1641,29 +1696,31 @@ static int copy_from_read_buf(struct tty_struct *tty,
                                      size_t *nr)
 
 {
+       struct n_tty_data *ldata = tty->disc_data;
        int retval;
        size_t n;
        unsigned long flags;
        bool is_eof;
 
        retval = 0;
-       spin_lock_irqsave(&tty->read_lock, flags);
-       n = min(tty->read_cnt, N_TTY_BUF_SIZE - tty->read_tail);
+       spin_lock_irqsave(&ldata->read_lock, flags);
+       n = min(ldata->read_cnt, N_TTY_BUF_SIZE - ldata->read_tail);
        n = min(*nr, n);
-       spin_unlock_irqrestore(&tty->read_lock, flags);
+       spin_unlock_irqrestore(&ldata->read_lock, flags);
        if (n) {
-               retval = copy_to_user(*b, &tty->read_buf[tty->read_tail], n);
+               retval = copy_to_user(*b, &ldata->read_buf[ldata->read_tail], n);
                n -= retval;
                is_eof = n == 1 &&
-                       tty->read_buf[tty->read_tail] == EOF_CHAR(tty);
-               tty_audit_add_data(tty, &tty->read_buf[tty->read_tail], n);
-               spin_lock_irqsave(&tty->read_lock, flags);
-               tty->read_tail = (tty->read_tail + n) & (N_TTY_BUF_SIZE-1);
-               tty->read_cnt -= n;
+                       ldata->read_buf[ldata->read_tail] == EOF_CHAR(tty);
+               tty_audit_add_data(tty, &ldata->read_buf[ldata->read_tail], n,
+                               ldata->icanon);
+               spin_lock_irqsave(&ldata->read_lock, flags);
+               ldata->read_tail = (ldata->read_tail + n) & (N_TTY_BUF_SIZE-1);
+               ldata->read_cnt -= n;
                /* Turn single EOF into zero-length read */
-               if (L_EXTPROC(tty) && tty->icanon && is_eof && !tty->read_cnt)
+               if (L_EXTPROC(tty) && ldata->icanon && is_eof && !ldata->read_cnt)
                        n = 0;
-               spin_unlock_irqrestore(&tty->read_lock, flags);
+               spin_unlock_irqrestore(&ldata->read_lock, flags);
                *b += n;
                *nr -= n;
        }
@@ -1730,6 +1787,7 @@ static int job_control(struct tty_struct *tty, struct file *file)
 static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
                         unsigned char __user *buf, size_t nr)
 {
+       struct n_tty_data *ldata = tty->disc_data;
        unsigned char __user *b = buf;
        DECLARE_WAITQUEUE(wait, current);
        int c;
@@ -1741,17 +1799,13 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
        int packet;
 
 do_it_again:
-
-       if (WARN_ON(!tty->read_buf))
-               return -EAGAIN;
-
        c = job_control(tty, file);
        if (c < 0)
                return c;
 
        minimum = time = 0;
        timeout = MAX_SCHEDULE_TIMEOUT;
-       if (!tty->icanon) {
+       if (!ldata->icanon) {
                time = (HZ / 10) * TIME_CHAR(tty);
                minimum = MIN_CHAR(tty);
                if (minimum) {
@@ -1774,10 +1828,10 @@ do_it_again:
         *      Internal serialization of reads.
         */
        if (file->f_flags & O_NONBLOCK) {
-               if (!mutex_trylock(&tty->atomic_read_lock))
+               if (!mutex_trylock(&ldata->atomic_read_lock))
                        return -EAGAIN;
        } else {
-               if (mutex_lock_interruptible(&tty->atomic_read_lock))
+               if (mutex_lock_interruptible(&ldata->atomic_read_lock))
                        return -ERESTARTSYS;
        }
        packet = tty->packet;
@@ -1830,7 +1884,6 @@ do_it_again:
                        /* FIXME: does n_tty_set_room need locking ? */
                        n_tty_set_room(tty);
                        timeout = schedule_timeout(timeout);
-                       BUG_ON(!tty->read_buf);
                        continue;
                }
                __set_current_state(TASK_RUNNING);
@@ -1845,45 +1898,45 @@ do_it_again:
                        nr--;
                }
 
-               if (tty->icanon && !L_EXTPROC(tty)) {
+               if (ldata->icanon && !L_EXTPROC(tty)) {
                        /* N.B. avoid overrun if nr == 0 */
-                       spin_lock_irqsave(&tty->read_lock, flags);
-                       while (nr && tty->read_cnt) {
+                       spin_lock_irqsave(&ldata->read_lock, flags);
+                       while (nr && ldata->read_cnt) {
                                int eol;
 
-                               eol = test_and_clear_bit(tty->read_tail,
-                                               tty->read_flags);
-                               c = tty->read_buf[tty->read_tail];
-                               tty->read_tail = ((tty->read_tail+1) &
+                               eol = test_and_clear_bit(ldata->read_tail,
+                                               ldata->read_flags);
+                               c = ldata->read_buf[ldata->read_tail];
+                               ldata->read_tail = ((ldata->read_tail+1) &
                                                  (N_TTY_BUF_SIZE-1));
-                               tty->read_cnt--;
+                               ldata->read_cnt--;
                                if (eol) {
                                        /* this test should be redundant:
                                         * we shouldn't be reading data if
                                         * canon_data is 0
                                         */
-                                       if (--tty->canon_data < 0)
-                                               tty->canon_data = 0;
+                                       if (--ldata->canon_data < 0)
+                                               ldata->canon_data = 0;
                                }
-                               spin_unlock_irqrestore(&tty->read_lock, flags);
+                               spin_unlock_irqrestore(&ldata->read_lock, flags);
 
                                if (!eol || (c != __DISABLED_CHAR)) {
                                        if (tty_put_user(tty, c, b++)) {
                                                retval = -EFAULT;
                                                b--;
-                                               spin_lock_irqsave(&tty->read_lock, flags);
+                                               spin_lock_irqsave(&ldata->read_lock, flags);
                                                break;
                                        }
                                        nr--;
                                }
                                if (eol) {
                                        tty_audit_push(tty);
-                                       spin_lock_irqsave(&tty->read_lock, flags);
+                                       spin_lock_irqsave(&ldata->read_lock, flags);
                                        break;
                                }
-                               spin_lock_irqsave(&tty->read_lock, flags);
+                               spin_lock_irqsave(&ldata->read_lock, flags);
                        }
-                       spin_unlock_irqrestore(&tty->read_lock, flags);
+                       spin_unlock_irqrestore(&ldata->read_lock, flags);
                        if (retval)
                                break;
                } else {
@@ -1915,7 +1968,7 @@ do_it_again:
                if (time)
                        timeout = time;
        }
-       mutex_unlock(&tty->atomic_read_lock);
+       mutex_unlock(&ldata->atomic_read_lock);
        remove_wait_queue(&tty->read_wait, &wait);
 
        if (!waitqueue_active(&tty->read_wait))
@@ -2076,19 +2129,19 @@ static unsigned int n_tty_poll(struct tty_struct *tty, struct file *file,
        return mask;
 }
 
-static unsigned long inq_canon(struct tty_struct *tty)
+static unsigned long inq_canon(struct n_tty_data *ldata)
 {
        int nr, head, tail;
 
-       if (!tty->canon_data)
+       if (!ldata->canon_data)
                return 0;
-       head = tty->canon_head;
-       tail = tty->read_tail;
+       head = ldata->canon_head;
+       tail = ldata->read_tail;
        nr = (head - tail) & (N_TTY_BUF_SIZE-1);
        /* Skip EOF-chars.. */
        while (head != tail) {
-               if (test_bit(tail, tty->read_flags) &&
-                   tty->read_buf[tail] == __DISABLED_CHAR)
+               if (test_bit(tail, ldata->read_flags) &&
+                   ldata->read_buf[tail] == __DISABLED_CHAR)
                        nr--;
                tail = (tail+1) & (N_TTY_BUF_SIZE-1);
        }
@@ -2098,6 +2151,7 @@ static unsigned long inq_canon(struct tty_struct *tty)
 static int n_tty_ioctl(struct tty_struct *tty, struct file *file,
                       unsigned int cmd, unsigned long arg)
 {
+       struct n_tty_data *ldata = tty->disc_data;
        int retval;
 
        switch (cmd) {
@@ -2105,9 +2159,9 @@ static int n_tty_ioctl(struct tty_struct *tty, struct file *file,
                return put_user(tty_chars_in_buffer(tty), (int __user *) arg);
        case TIOCINQ:
                /* FIXME: Locking */
-               retval = tty->read_cnt;
+               retval = ldata->read_cnt;
                if (L_ICANON(tty))
-                       retval = inq_canon(tty);
+                       retval = inq_canon(ldata);
                return put_user(retval, (unsigned int __user *) arg);
        default:
                return n_tty_ioctl_helper(tty, file, cmd, arg);
index a82b39939a9cab4fc02a6d6d0be13607284d68ce..4219f040adb8ff55f35109accc5eea5e55ef2366 100644 (file)
@@ -4,9 +4,6 @@
  *  Added support for a Unix98-style ptmx device.
  *    -- C. Scott Ananian <cananian@alumni.princeton.edu>, 14-Jan-1998
  *
- *  When reading this code see also fs/devpts. In particular note that the
- *  driver_data field is used by the devpts side as a binding to the devpts
- *  inode.
  */
 
 #include <linux/module.h>
@@ -59,7 +56,7 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
 #ifdef CONFIG_UNIX98_PTYS
                if (tty->driver == ptm_driver) {
                        mutex_lock(&devpts_mutex);
-                       devpts_pty_kill(tty->link);
+                       devpts_pty_kill(tty->link->driver_data);
                        mutex_unlock(&devpts_mutex);
                }
 #endif
@@ -96,7 +93,7 @@ static void pty_unthrottle(struct tty_struct *tty)
 
 static int pty_space(struct tty_struct *to)
 {
-       int n = 8192 - to->buf.memory_used;
+       int n = 8192 - to->port->buf.memory_used;
        if (n < 0)
                return 0;
        return n;
@@ -348,6 +345,7 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty,
        tty_port_init(ports[1]);
        o_tty->port = ports[0];
        tty->port = ports[1];
+       o_tty->port->itty = o_tty;
 
        tty_driver_kref_get(driver);
        tty->count++;
@@ -366,8 +364,15 @@ err:
        return retval;
 }
 
+/* this is called once with whichever end is closed last */
+static void pty_unix98_shutdown(struct tty_struct *tty)
+{
+       devpts_kill_index(tty->driver_data, tty->index);
+}
+
 static void pty_cleanup(struct tty_struct *tty)
 {
+       tty->port->itty = NULL;
        kfree(tty->port);
 }
 
@@ -547,7 +552,7 @@ static struct tty_struct *pts_unix98_lookup(struct tty_driver *driver,
        struct tty_struct *tty;
 
        mutex_lock(&devpts_mutex);
-       tty = devpts_get_tty(pts_inode, idx);
+       tty = devpts_get_priv(pts_inode);
        mutex_unlock(&devpts_mutex);
        /* Master must be open before slave */
        if (!tty)
@@ -581,6 +586,7 @@ static const struct tty_operations ptm_unix98_ops = {
        .set_termios = pty_set_termios,
        .ioctl = pty_unix98_ioctl,
        .resize = pty_resize,
+       .shutdown = pty_unix98_shutdown,
        .cleanup = pty_cleanup
 };
 
@@ -596,6 +602,7 @@ static const struct tty_operations pty_unix98_ops = {
        .chars_in_buffer = pty_chars_in_buffer,
        .unthrottle = pty_unthrottle,
        .set_termios = pty_set_termios,
+       .shutdown = pty_unix98_shutdown,
        .cleanup = pty_cleanup,
 };
 
@@ -614,6 +621,7 @@ static const struct tty_operations pty_unix98_ops = {
 static int ptmx_open(struct inode *inode, struct file *filp)
 {
        struct tty_struct *tty;
+       struct inode *slave_inode;
        int retval;
        int index;
 
@@ -650,15 +658,21 @@ static int ptmx_open(struct inode *inode, struct file *filp)
 
        tty_add_file(tty, filp);
 
-       retval = devpts_pty_new(inode, tty->link);
-       if (retval)
+       slave_inode = devpts_pty_new(inode,
+                       MKDEV(UNIX98_PTY_SLAVE_MAJOR, index), index,
+                       tty->link);
+       if (IS_ERR(slave_inode)) {
+               retval = PTR_ERR(slave_inode);
                goto err_release;
+       }
 
        retval = ptm_driver->ops->open(tty, filp);
        if (retval)
                goto err_release;
 
        tty_unlock(tty);
+       tty->driver_data = inode;
+       tty->link->driver_data = slave_inode;
        return 0;
 err_release:
        tty_unlock(tty);
index 3ba4234592bc8a7285b2d488ce9b0db010e2e018..5ccbd90540cfdf4bef3be26c15d2202393ced213 100644 (file)
@@ -2349,16 +2349,14 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
                        serial_port_out(port, UART_EFR, efr);
        }
 
-#ifdef CONFIG_ARCH_OMAP1
        /* Workaround to enable 115200 baud on OMAP1510 internal ports */
-       if (cpu_is_omap1510() && is_omap_port(up)) {
+       if (is_omap1510_8250(up)) {
                if (baud == 115200) {
                        quot = 1;
                        serial_port_out(port, UART_OMAP_OSC_12M_SEL, 1);
                } else
                        serial_port_out(port, UART_OMAP_OSC_12M_SEL, 0);
        }
-#endif
 
        /*
         * For NatSemi, switch to bank 2 not bank 1, to avoid resetting EXCR2,
@@ -2439,10 +2437,9 @@ static unsigned int serial8250_port_size(struct uart_8250_port *pt)
 {
        if (pt->port.iotype == UPIO_AU)
                return 0x1000;
-#ifdef CONFIG_ARCH_OMAP1
-       if (is_omap_port(pt))
+       if (is_omap1_8250(pt))
                return 0x16 << pt->port.regshift;
-#endif
+
        return 8 << pt->port.regshift;
 }
 
index 5a76f9c8d36b98d943ef574de25c4400579c0551..3b4ea84898c2e719dc233ecddde63dc3c421bd0d 100644 (file)
@@ -106,3 +106,39 @@ static inline int serial8250_pnp_init(void) { return 0; }
 static inline void serial8250_pnp_exit(void) { }
 #endif
 
+#ifdef CONFIG_ARCH_OMAP1
+static inline int is_omap1_8250(struct uart_8250_port *pt)
+{
+       int res;
+
+       switch (pt->port.mapbase) {
+       case OMAP1_UART1_BASE:
+       case OMAP1_UART2_BASE:
+       case OMAP1_UART3_BASE:
+               res = 1;
+               break;
+       default:
+               res = 0;
+               break;
+       }
+
+       return res;
+}
+
+static inline int is_omap1510_8250(struct uart_8250_port *pt)
+{
+       if (!cpu_is_omap1510())
+               return 0;
+
+       return is_omap1_8250(pt);
+}
+#else
+static inline int is_omap1_8250(struct uart_8250_port *pt)
+{
+       return 0;
+}
+static inline int is_omap1510_8250(struct uart_8250_port *pt)
+{
+       return 0;
+}
+#endif
index eaafb98debed89e2f1b2e5e83ac33cd79301792e..843a150ba1053dd84d547e15565599ab24791ea3 100644 (file)
@@ -140,7 +140,7 @@ static void __init init_port(struct early_serial8250_device *device)
        serial_out(port, UART_FCR, 0);          /* no fifo */
        serial_out(port, UART_MCR, 0x3);        /* DTR + RTS */
 
-       divisor = port->uartclk / (16 * device->baud);
+       divisor = DIV_ROUND_CLOSEST(port->uartclk, 16 * device->baud);
        c = serial_in(port, UART_LCR);
        serial_out(port, UART_LCR, c | UART_LCR_DLAB);
        serial_out(port, UART_DLL, divisor & 0xff);
index 7f04717176aa42c8ba6232719903eb547e673df3..740458ca62cca5e82a8fc579e61d69ab52b0074c 100644 (file)
@@ -530,16 +530,16 @@ static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level,
        switch (level) {
        case 3:
                if (!IS_ERR(ourport->baudclk))
-                       clk_disable(ourport->baudclk);
+                       clk_disable_unprepare(ourport->baudclk);
 
-               clk_disable(ourport->clk);
+               clk_disable_unprepare(ourport->clk);
                break;
 
        case 0:
-               clk_enable(ourport->clk);
+               clk_prepare_enable(ourport->clk);
 
                if (!IS_ERR(ourport->baudclk))
-                       clk_enable(ourport->baudclk);
+                       clk_prepare_enable(ourport->baudclk);
 
                break;
        default:
@@ -713,11 +713,11 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
                s3c24xx_serial_setsource(port, clk_sel);
 
                if (!IS_ERR(ourport->baudclk)) {
-                       clk_disable(ourport->baudclk);
+                       clk_disable_unprepare(ourport->baudclk);
                        ourport->baudclk = ERR_PTR(-EINVAL);
                }
 
-               clk_enable(clk);
+               clk_prepare_enable(clk);
 
                ourport->baudclk = clk;
                ourport->baudclk_rate = clk ? clk_get_rate(clk) : 0;
@@ -1287,9 +1287,9 @@ static int s3c24xx_serial_resume(struct device *dev)
        struct s3c24xx_uart_port *ourport = to_ourport(port);
 
        if (port) {
-               clk_enable(ourport->clk);
+               clk_prepare_enable(ourport->clk);
                s3c24xx_serial_resetport(port, s3c24xx_port_to_cfg(port));
-               clk_disable(ourport->clk);
+               clk_disable_unprepare(ourport->clk);
 
                uart_resume_port(&s3c24xx_uart_drv, port);
        }
index b0b39b823ccf16ec2e0b82264721a0be7e54005f..6953dc82850cb278fd99da209e560021d4d0c1e8 100644 (file)
@@ -23,7 +23,7 @@ struct tty_audit_buf {
 };
 
 static struct tty_audit_buf *tty_audit_buf_alloc(int major, int minor,
-                                                int icanon)
+                                                unsigned icanon)
 {
        struct tty_audit_buf *buf;
 
@@ -239,7 +239,8 @@ int tty_audit_push_task(struct task_struct *tsk, kuid_t loginuid, u32 sessionid)
  *     if TTY auditing is disabled or out of memory.  Otherwise, return a new
  *     reference to the buffer.
  */
-static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty)
+static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty,
+               unsigned icanon)
 {
        struct tty_audit_buf *buf, *buf2;
 
@@ -257,7 +258,7 @@ static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty)
 
        buf2 = tty_audit_buf_alloc(tty->driver->major,
                                   tty->driver->minor_start + tty->index,
-                                  tty->icanon);
+                                  icanon);
        if (buf2 == NULL) {
                audit_log_lost("out of memory in TTY auditing");
                return NULL;
@@ -287,7 +288,7 @@ static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty)
  *     Audit @data of @size from @tty, if necessary.
  */
 void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
-                       size_t size)
+                       size_t size, unsigned icanon)
 {
        struct tty_audit_buf *buf;
        int major, minor;
@@ -299,7 +300,7 @@ void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
            && tty->driver->subtype == PTY_TYPE_MASTER)
                return;
 
-       buf = tty_audit_buf_get(tty);
+       buf = tty_audit_buf_get(tty, icanon);
        if (!buf)
                return;
 
@@ -307,11 +308,11 @@ void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
        major = tty->driver->major;
        minor = tty->driver->minor_start + tty->index;
        if (buf->major != major || buf->minor != minor
-           || buf->icanon != tty->icanon) {
+           || buf->icanon != icanon) {
                tty_audit_buf_push_current(buf);
                buf->major = major;
                buf->minor = minor;
-               buf->icanon = tty->icanon;
+               buf->icanon = icanon;
        }
        do {
                size_t run;
index 91e326ffe7db826054c2607c1ea2688ed047bb81..6cf87d7afb7efb14264b7a20c7394a99adbb7946 100644 (file)
  *     Locking: none
  */
 
-void tty_buffer_free_all(struct tty_struct *tty)
+void tty_buffer_free_all(struct tty_port *port)
 {
+       struct tty_bufhead *buf = &port->buf;
        struct tty_buffer *thead;
-       while ((thead = tty->buf.head) != NULL) {
-               tty->buf.head = thead->next;
+
+       while ((thead = buf->head) != NULL) {
+               buf->head = thead->next;
                kfree(thead);
        }
-       while ((thead = tty->buf.free) != NULL) {
-               tty->buf.free = thead->next;
+       while ((thead = buf->free) != NULL) {
+               buf->free = thead->next;
                kfree(thead);
        }
-       tty->buf.tail = NULL;
-       tty->buf.memory_used = 0;
+       buf->tail = NULL;
+       buf->memory_used = 0;
 }
 
 /**
@@ -54,11 +56,11 @@ void tty_buffer_free_all(struct tty_struct *tty)
  *     Locking: Caller must hold tty->buf.lock
  */
 
-static struct tty_buffer *tty_buffer_alloc(struct tty_struct *tty, size_t size)
+static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size)
 {
        struct tty_buffer *p;
 
-       if (tty->buf.memory_used + size > 65536)
+       if (port->buf.memory_used + size > 65536)
                return NULL;
        p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC);
        if (p == NULL)
@@ -70,7 +72,7 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_struct *tty, size_t size)
        p->read = 0;
        p->char_buf_ptr = (char *)(p->data);
        p->flag_buf_ptr = (unsigned char *)p->char_buf_ptr + size;
-       tty->buf.memory_used += size;
+       port->buf.memory_used += size;
        return p;
 }
 
@@ -85,17 +87,19 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_struct *tty, size_t size)
  *     Locking: Caller must hold tty->buf.lock
  */
 
-static void tty_buffer_free(struct tty_struct *tty, struct tty_buffer *b)
+static void tty_buffer_free(struct tty_port *port, struct tty_buffer *b)
 {
+       struct tty_bufhead *buf = &port->buf;
+
        /* Dumb strategy for now - should keep some stats */
-       tty->buf.memory_used -= b->size;
-       WARN_ON(tty->buf.memory_used < 0);
+       buf->memory_used -= b->size;
+       WARN_ON(buf->memory_used < 0);
 
        if (b->size >= 512)
                kfree(b);
        else {
-               b->next = tty->buf.free;
-               tty->buf.free = b;
+               b->next = buf->free;
+               buf->free = b;
        }
 }
 
@@ -110,15 +114,16 @@ static void tty_buffer_free(struct tty_struct *tty, struct tty_buffer *b)
  *     Locking: Caller must hold tty->buf.lock
  */
 
-static void __tty_buffer_flush(struct tty_struct *tty)
+static void __tty_buffer_flush(struct tty_port *port)
 {
+       struct tty_bufhead *buf = &port->buf;
        struct tty_buffer *thead;
 
-       while ((thead = tty->buf.head) != NULL) {
-               tty->buf.head = thead->next;
-               tty_buffer_free(tty, thead);
+       while ((thead = buf->head) != NULL) {
+               buf->head = thead->next;
+               tty_buffer_free(port, thead);
        }
-       tty->buf.tail = NULL;
+       buf->tail = NULL;
 }
 
 /**
@@ -134,21 +139,24 @@ static void __tty_buffer_flush(struct tty_struct *tty)
 
 void tty_buffer_flush(struct tty_struct *tty)
 {
+       struct tty_port *port = tty->port;
+       struct tty_bufhead *buf = &port->buf;
        unsigned long flags;
-       spin_lock_irqsave(&tty->buf.lock, flags);
+
+       spin_lock_irqsave(&buf->lock, flags);
 
        /* If the data is being pushed to the tty layer then we can't
           process it here. Instead set a flag and the flush_to_ldisc
           path will process the flush request before it exits */
-       if (test_bit(TTY_FLUSHING, &tty->flags)) {
-               set_bit(TTY_FLUSHPENDING, &tty->flags);
-               spin_unlock_irqrestore(&tty->buf.lock, flags);
+       if (test_bit(TTYP_FLUSHING, &port->iflags)) {
+               set_bit(TTYP_FLUSHPENDING, &port->iflags);
+               spin_unlock_irqrestore(&buf->lock, flags);
                wait_event(tty->read_wait,
-                               test_bit(TTY_FLUSHPENDING, &tty->flags) == 0);
+                               test_bit(TTYP_FLUSHPENDING, &port->iflags) == 0);
                return;
        } else
-               __tty_buffer_flush(tty);
-       spin_unlock_irqrestore(&tty->buf.lock, flags);
+               __tty_buffer_flush(port);
+       spin_unlock_irqrestore(&buf->lock, flags);
 }
 
 /**
@@ -163,9 +171,9 @@ void tty_buffer_flush(struct tty_struct *tty)
  *     Locking: Caller must hold tty->buf.lock
  */
 
-static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size)
+static struct tty_buffer *tty_buffer_find(struct tty_port *port, size_t size)
 {
-       struct tty_buffer **tbh = &tty->buf.free;
+       struct tty_buffer **tbh = &port->buf.free;
        while ((*tbh) != NULL) {
                struct tty_buffer *t = *tbh;
                if (t->size >= size) {
@@ -174,14 +182,14 @@ static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size)
                        t->used = 0;
                        t->commit = 0;
                        t->read = 0;
-                       tty->buf.memory_used += t->size;
+                       port->buf.memory_used += t->size;
                        return t;
                }
                tbh = &((*tbh)->next);
        }
        /* Round the buffer size out */
        size = (size + 0xFF) & ~0xFF;
-       return tty_buffer_alloc(tty, size);
+       return tty_buffer_alloc(port, size);
        /* Should possibly check if this fails for the largest buffer we
           have queued and recycle that ? */
 }
@@ -192,29 +200,31 @@ static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size)
  *
  *     Make at least size bytes of linear space available for the tty
  *     buffer. If we fail return the size we managed to find.
- *      Locking: Caller must hold tty->buf.lock
+ *      Locking: Caller must hold port->buf.lock
  */
-static int __tty_buffer_request_room(struct tty_struct *tty, size_t size)
+static int __tty_buffer_request_room(struct tty_port *port, size_t size)
 {
+       struct tty_bufhead *buf = &port->buf;
        struct tty_buffer *b, *n;
        int left;
        /* OPTIMISATION: We could keep a per tty "zero" sized buffer to
           remove this conditional if its worth it. This would be invisible
           to the callers */
-       if ((b = tty->buf.tail) != NULL)
+       b = buf->tail;
+       if (b != NULL)
                left = b->size - b->used;
        else
                left = 0;
 
        if (left < size) {
                /* This is the slow path - looking for new buffers to use */
-               if ((n = tty_buffer_find(tty, size)) != NULL) {
+               if ((n = tty_buffer_find(port, size)) != NULL) {
                        if (b != NULL) {
                                b->next = n;
                                b->commit = b->used;
                        } else
-                               tty->buf.head = n;
-                       tty->buf.tail = n;
+                               buf->head = n;
+                       buf->tail = n;
                } else
                        size = left;
        }
@@ -231,16 +241,17 @@ static int __tty_buffer_request_room(struct tty_struct *tty, size_t size)
  *     Make at least size bytes of linear space available for the tty
  *     buffer. If we fail return the size we managed to find.
  *
- *     Locking: Takes tty->buf.lock
+ *     Locking: Takes port->buf.lock
  */
 int tty_buffer_request_room(struct tty_struct *tty, size_t size)
 {
+       struct tty_port *port = tty->port;
        unsigned long flags;
        int length;
 
-       spin_lock_irqsave(&tty->buf.lock, flags);
-       length = __tty_buffer_request_room(tty, size);
-       spin_unlock_irqrestore(&tty->buf.lock, flags);
+       spin_lock_irqsave(&port->buf.lock, flags);
+       length = __tty_buffer_request_room(port, size);
+       spin_unlock_irqrestore(&port->buf.lock, flags);
        return length;
 }
 EXPORT_SYMBOL_GPL(tty_buffer_request_room);
@@ -255,12 +266,13 @@ EXPORT_SYMBOL_GPL(tty_buffer_request_room);
  *     Queue a series of bytes to the tty buffering. All the characters
  *     passed are marked with the supplied flag. Returns the number added.
  *
- *     Locking: Called functions may take tty->buf.lock
+ *     Locking: Called functions may take port->buf.lock
  */
 
 int tty_insert_flip_string_fixed_flag(struct tty_struct *tty,
                const unsigned char *chars, char flag, size_t size)
 {
+       struct tty_bufhead *buf = &tty->port->buf;
        int copied = 0;
        do {
                int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE);
@@ -268,18 +280,18 @@ int tty_insert_flip_string_fixed_flag(struct tty_struct *tty,
                unsigned long flags;
                struct tty_buffer *tb;
 
-               spin_lock_irqsave(&tty->buf.lock, flags);
-               space = __tty_buffer_request_room(tty, goal);
-               tb = tty->buf.tail;
+               spin_lock_irqsave(&buf->lock, flags);
+               space = __tty_buffer_request_room(tty->port, goal);
+               tb = buf->tail;
                /* If there is no space then tb may be NULL */
                if (unlikely(space == 0)) {
-                       spin_unlock_irqrestore(&tty->buf.lock, flags);
+                       spin_unlock_irqrestore(&buf->lock, flags);
                        break;
                }
                memcpy(tb->char_buf_ptr + tb->used, chars, space);
                memset(tb->flag_buf_ptr + tb->used, flag, space);
                tb->used += space;
-               spin_unlock_irqrestore(&tty->buf.lock, flags);
+               spin_unlock_irqrestore(&buf->lock, flags);
                copied += space;
                chars += space;
                /* There is a small chance that we need to split the data over
@@ -300,12 +312,13 @@ EXPORT_SYMBOL(tty_insert_flip_string_fixed_flag);
  *     the flags array indicates the status of the character. Returns the
  *     number added.
  *
- *     Locking: Called functions may take tty->buf.lock
+ *     Locking: Called functions may take port->buf.lock
  */
 
 int tty_insert_flip_string_flags(struct tty_struct *tty,
                const unsigned char *chars, const char *flags, size_t size)
 {
+       struct tty_bufhead *buf = &tty->port->buf;
        int copied = 0;
        do {
                int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE);
@@ -313,18 +326,18 @@ int tty_insert_flip_string_flags(struct tty_struct *tty,
                unsigned long __flags;
                struct tty_buffer *tb;
 
-               spin_lock_irqsave(&tty->buf.lock, __flags);
-               space = __tty_buffer_request_room(tty, goal);
-               tb = tty->buf.tail;
+               spin_lock_irqsave(&buf->lock, __flags);
+               space = __tty_buffer_request_room(tty->port, goal);
+               tb = buf->tail;
                /* If there is no space then tb may be NULL */
                if (unlikely(space == 0)) {
-                       spin_unlock_irqrestore(&tty->buf.lock, __flags);
+                       spin_unlock_irqrestore(&buf->lock, __flags);
                        break;
                }
                memcpy(tb->char_buf_ptr + tb->used, chars, space);
                memcpy(tb->flag_buf_ptr + tb->used, flags, space);
                tb->used += space;
-               spin_unlock_irqrestore(&tty->buf.lock, __flags);
+               spin_unlock_irqrestore(&buf->lock, __flags);
                copied += space;
                chars += space;
                flags += space;
@@ -342,18 +355,23 @@ EXPORT_SYMBOL(tty_insert_flip_string_flags);
  *     Takes any pending buffers and transfers their ownership to the
  *     ldisc side of the queue. It then schedules those characters for
  *     processing by the line discipline.
+ *     Note that this function can only be used when the low_latency flag
+ *     is unset. Otherwise the workqueue won't be flushed.
  *
- *     Locking: Takes tty->buf.lock
+ *     Locking: Takes port->buf.lock
  */
 
 void tty_schedule_flip(struct tty_struct *tty)
 {
+       struct tty_bufhead *buf = &tty->port->buf;
        unsigned long flags;
-       spin_lock_irqsave(&tty->buf.lock, flags);
-       if (tty->buf.tail != NULL)
-               tty->buf.tail->commit = tty->buf.tail->used;
-       spin_unlock_irqrestore(&tty->buf.lock, flags);
-       schedule_work(&tty->buf.work);
+       WARN_ON(tty->low_latency);
+
+       spin_lock_irqsave(&buf->lock, flags);
+       if (buf->tail != NULL)
+               buf->tail->commit = buf->tail->used;
+       spin_unlock_irqrestore(&buf->lock, flags);
+       schedule_work(&buf->work);
 }
 EXPORT_SYMBOL(tty_schedule_flip);
 
@@ -369,26 +387,27 @@ EXPORT_SYMBOL(tty_schedule_flip);
  *     that need their own block copy routines into the buffer. There is no
  *     guarantee the buffer is a DMA target!
  *
- *     Locking: May call functions taking tty->buf.lock
+ *     Locking: May call functions taking port->buf.lock
  */
 
 int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars,
-                                                               size_t size)
+               size_t size)
 {
+       struct tty_bufhead *buf = &tty->port->buf;
        int space;
        unsigned long flags;
        struct tty_buffer *tb;
 
-       spin_lock_irqsave(&tty->buf.lock, flags);
-       space = __tty_buffer_request_room(tty, size);
+       spin_lock_irqsave(&buf->lock, flags);
+       space = __tty_buffer_request_room(tty->port, size);
 
-       tb = tty->buf.tail;
+       tb = buf->tail;
        if (likely(space)) {
                *chars = tb->char_buf_ptr + tb->used;
                memset(tb->flag_buf_ptr + tb->used, TTY_NORMAL, space);
                tb->used += space;
        }
-       spin_unlock_irqrestore(&tty->buf.lock, flags);
+       spin_unlock_irqrestore(&buf->lock, flags);
        return space;
 }
 EXPORT_SYMBOL_GPL(tty_prepare_flip_string);
@@ -406,26 +425,27 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string);
  *     that need their own block copy routines into the buffer. There is no
  *     guarantee the buffer is a DMA target!
  *
- *     Locking: May call functions taking tty->buf.lock
+ *     Locking: May call functions taking port->buf.lock
  */
 
 int tty_prepare_flip_string_flags(struct tty_struct *tty,
                        unsigned char **chars, char **flags, size_t size)
 {
+       struct tty_bufhead *buf = &tty->port->buf;
        int space;
        unsigned long __flags;
        struct tty_buffer *tb;
 
-       spin_lock_irqsave(&tty->buf.lock, __flags);
-       space = __tty_buffer_request_room(tty, size);
+       spin_lock_irqsave(&buf->lock, __flags);
+       space = __tty_buffer_request_room(tty->port, size);
 
-       tb = tty->buf.tail;
+       tb = buf->tail;
        if (likely(space)) {
                *chars = tb->char_buf_ptr + tb->used;
                *flags = tb->flag_buf_ptr + tb->used;
                tb->used += space;
        }
-       spin_unlock_irqrestore(&tty->buf.lock, __flags);
+       spin_unlock_irqrestore(&buf->lock, __flags);
        return space;
 }
 EXPORT_SYMBOL_GPL(tty_prepare_flip_string_flags);
@@ -446,20 +466,25 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string_flags);
 
 static void flush_to_ldisc(struct work_struct *work)
 {
-       struct tty_struct *tty =
-               container_of(work, struct tty_struct, buf.work);
+       struct tty_port *port = container_of(work, struct tty_port, buf.work);
+       struct tty_bufhead *buf = &port->buf;
+       struct tty_struct *tty;
        unsigned long   flags;
        struct tty_ldisc *disc;
 
+       tty = port->itty;
+       if (WARN_RATELIMIT(tty == NULL, "tty is NULL"))
+               return;
+
        disc = tty_ldisc_ref(tty);
        if (disc == NULL)       /*  !TTY_LDISC */
                return;
 
-       spin_lock_irqsave(&tty->buf.lock, flags);
+       spin_lock_irqsave(&buf->lock, flags);
 
-       if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) {
+       if (!test_and_set_bit(TTYP_FLUSHING, &port->iflags)) {
                struct tty_buffer *head;
-               while ((head = tty->buf.head) != NULL) {
+               while ((head = buf->head) != NULL) {
                        int count;
                        char *char_buf;
                        unsigned char *flag_buf;
@@ -468,14 +493,14 @@ static void flush_to_ldisc(struct work_struct *work)
                        if (!count) {
                                if (head->next == NULL)
                                        break;
-                               tty->buf.head = head->next;
-                               tty_buffer_free(tty, head);
+                               buf->head = head->next;
+                               tty_buffer_free(port, head);
                                continue;
                        }
                        /* Ldisc or user is trying to flush the buffers
                           we are feeding to the ldisc, stop feeding the
                           line discipline as we want to empty the queue */
-                       if (test_bit(TTY_FLUSHPENDING, &tty->flags))
+                       if (test_bit(TTYP_FLUSHPENDING, &port->iflags))
                                break;
                        if (!tty->receive_room)
                                break;
@@ -484,22 +509,22 @@ static void flush_to_ldisc(struct work_struct *work)
                        char_buf = head->char_buf_ptr + head->read;
                        flag_buf = head->flag_buf_ptr + head->read;
                        head->read += count;
-                       spin_unlock_irqrestore(&tty->buf.lock, flags);
+                       spin_unlock_irqrestore(&buf->lock, flags);
                        disc->ops->receive_buf(tty, char_buf,
                                                        flag_buf, count);
-                       spin_lock_irqsave(&tty->buf.lock, flags);
+                       spin_lock_irqsave(&buf->lock, flags);
                }
-               clear_bit(TTY_FLUSHING, &tty->flags);
+               clear_bit(TTYP_FLUSHING, &port->iflags);
        }
 
        /* We may have a deferred request to flush the input buffer,
           if so pull the chain under the lock and empty the queue */
-       if (test_bit(TTY_FLUSHPENDING, &tty->flags)) {
-               __tty_buffer_flush(tty);
-               clear_bit(TTY_FLUSHPENDING, &tty->flags);
+       if (test_bit(TTYP_FLUSHPENDING, &port->iflags)) {
+               __tty_buffer_flush(port);
+               clear_bit(TTYP_FLUSHPENDING, &port->iflags);
                wake_up(&tty->read_wait);
        }
-       spin_unlock_irqrestore(&tty->buf.lock, flags);
+       spin_unlock_irqrestore(&buf->lock, flags);
 
        tty_ldisc_deref(disc);
 }
@@ -514,7 +539,8 @@ static void flush_to_ldisc(struct work_struct *work)
  */
 void tty_flush_to_ldisc(struct tty_struct *tty)
 {
-       flush_work(&tty->buf.work);
+       if (!tty->low_latency)
+               flush_work(&tty->port->buf.work);
 }
 
 /**
@@ -532,16 +558,18 @@ void tty_flush_to_ldisc(struct tty_struct *tty)
 
 void tty_flip_buffer_push(struct tty_struct *tty)
 {
+       struct tty_bufhead *buf = &tty->port->buf;
        unsigned long flags;
-       spin_lock_irqsave(&tty->buf.lock, flags);
-       if (tty->buf.tail != NULL)
-               tty->buf.tail->commit = tty->buf.tail->used;
-       spin_unlock_irqrestore(&tty->buf.lock, flags);
+
+       spin_lock_irqsave(&buf->lock, flags);
+       if (buf->tail != NULL)
+               buf->tail->commit = buf->tail->used;
+       spin_unlock_irqrestore(&buf->lock, flags);
 
        if (tty->low_latency)
-               flush_to_ldisc(&tty->buf.work);
+               flush_to_ldisc(&buf->work);
        else
-               schedule_work(&tty->buf.work);
+               schedule_work(&buf->work);
 }
 EXPORT_SYMBOL(tty_flip_buffer_push);
 
@@ -555,13 +583,15 @@ EXPORT_SYMBOL(tty_flip_buffer_push);
  *     Locking: none
  */
 
-void tty_buffer_init(struct tty_struct *tty)
+void tty_buffer_init(struct tty_port *port)
 {
-       spin_lock_init(&tty->buf.lock);
-       tty->buf.head = NULL;
-       tty->buf.tail = NULL;
-       tty->buf.free = NULL;
-       tty->buf.memory_used = 0;
-       INIT_WORK(&tty->buf.work, flush_to_ldisc);
+       struct tty_bufhead *buf = &port->buf;
+
+       spin_lock_init(&buf->lock);
+       buf->head = NULL;
+       buf->tail = NULL;
+       buf->free = NULL;
+       buf->memory_used = 0;
+       INIT_WORK(&buf->work, flush_to_ldisc);
 }
 
index 2ea176b2280e60f201aefec32af4beb8d7892702..a3eba7f359ed2b50ac3c3da6c7ec22384bd16732 100644 (file)
@@ -186,7 +186,6 @@ void free_tty_struct(struct tty_struct *tty)
        if (tty->dev)
                put_device(tty->dev);
        kfree(tty->write_buf);
-       tty_buffer_free_all(tty);
        tty->magic = 0xDEADDEAD;
        kfree(tty);
 }
@@ -1417,6 +1416,8 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx)
                        "%s: %s driver does not set tty->port. This will crash the kernel later. Fix the driver!\n",
                        __func__, tty->driver->name);
 
+       tty->port->itty = tty;
+
        /*
         * Structures all installed ... call the ldisc open routines.
         * If we fail here just call release_tty to clean up.  No need
@@ -1552,6 +1553,7 @@ static void release_tty(struct tty_struct *tty, int idx)
                tty->ops->shutdown(tty);
        tty_free_termios(tty);
        tty_driver_remove_tty(tty->driver, tty);
+       tty->port->itty = NULL;
 
        if (tty->link)
                tty_kref_put(tty->link);
@@ -1625,7 +1627,6 @@ int tty_release(struct inode *inode, struct file *filp)
        struct tty_struct *tty = file_tty(filp);
        struct tty_struct *o_tty;
        int     pty_master, tty_closing, o_tty_closing, do_sleep;
-       int     devpts;
        int     idx;
        char    buf[64];
 
@@ -1640,7 +1641,6 @@ int tty_release(struct inode *inode, struct file *filp)
        idx = tty->index;
        pty_master = (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
                      tty->driver->subtype == PTY_TYPE_MASTER);
-       devpts = (tty->driver->flags & TTY_DRIVER_DEVPTS_MEM) != 0;
        /* Review: parallel close */
        o_tty = tty->link;
 
@@ -1799,9 +1799,6 @@ int tty_release(struct inode *inode, struct file *filp)
        release_tty(tty, idx);
        mutex_unlock(&tty_mutex);
 
-       /* Make this pty number available for reallocation */
-       if (devpts)
-               devpts_kill_index(inode, idx);
        return 0;
 }
 
@@ -2937,19 +2934,13 @@ void initialize_tty_struct(struct tty_struct *tty,
        tty_ldisc_init(tty);
        tty->session = NULL;
        tty->pgrp = NULL;
-       tty->overrun_time = jiffies;
-       tty_buffer_init(tty);
        mutex_init(&tty->legacy_mutex);
        mutex_init(&tty->termios_mutex);
        mutex_init(&tty->ldisc_mutex);
        init_waitqueue_head(&tty->write_wait);
        init_waitqueue_head(&tty->read_wait);
        INIT_WORK(&tty->hangup_work, do_tty_hangup);
-       mutex_init(&tty->atomic_read_lock);
        mutex_init(&tty->atomic_write_lock);
-       mutex_init(&tty->output_lock);
-       mutex_init(&tty->echo_lock);
-       spin_lock_init(&tty->read_lock);
        spin_lock_init(&tty->ctrl_lock);
        INIT_LIST_HEAD(&tty->tty_files);
        INIT_WORK(&tty->SAK_work, do_SAK_work);
index 0f2a2c5e704c3560755069f1c102f6714e0ae4b6..f4e6754525dc4e015d95db0db5ddd49295f77dd0 100644 (file)
@@ -512,7 +512,7 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old)
 static int tty_ldisc_halt(struct tty_struct *tty)
 {
        clear_bit(TTY_LDISC, &tty->flags);
-       return cancel_work_sync(&tty->buf.work);
+       return cancel_work_sync(&tty->port->buf.work);
 }
 
 /**
@@ -525,7 +525,7 @@ static void tty_ldisc_flush_works(struct tty_struct *tty)
 {
        flush_work(&tty->hangup_work);
        flush_work(&tty->SAK_work);
-       flush_work(&tty->buf.work);
+       flush_work(&tty->port->buf.work);
 }
 
 /**
@@ -704,9 +704,9 @@ enable:
        /* Restart the work queue in case no characters kick it off. Safe if
           already running */
        if (work)
-               schedule_work(&tty->buf.work);
+               schedule_work(&tty->port->buf.work);
        if (o_work)
-               schedule_work(&o_tty->buf.work);
+               schedule_work(&o_tty->port->buf.work);
        mutex_unlock(&tty->ldisc_mutex);
        tty_unlock(tty);
        return retval;
@@ -817,7 +817,7 @@ void tty_ldisc_hangup(struct tty_struct *tty)
         */
        clear_bit(TTY_LDISC, &tty->flags);
        tty_unlock(tty);
-       cancel_work_sync(&tty->buf.work);
+       cancel_work_sync(&tty->port->buf.work);
        mutex_unlock(&tty->ldisc_mutex);
 retry:
        tty_lock(tty);
@@ -897,6 +897,11 @@ int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty)
 
 static void tty_ldisc_kill(struct tty_struct *tty)
 {
+       /* There cannot be users from userspace now. But there still might be
+        * drivers holding a reference via tty_ldisc_ref. Do not steal them the
+        * ldisc until they are done. */
+       tty_ldisc_wait_idle(tty, MAX_SCHEDULE_TIMEOUT);
+
        mutex_lock(&tty->ldisc_mutex);
        /*
         * Now kill off the ldisc
index d7bdd8d0c23f0faa832aee87447af772958ceb13..416b42f7c346680067ea6eb8d4679421cf5596c8 100644 (file)
@@ -21,6 +21,7 @@
 void tty_port_init(struct tty_port *port)
 {
        memset(port, 0, sizeof(*port));
+       tty_buffer_init(port);
        init_waitqueue_head(&port->open_wait);
        init_waitqueue_head(&port->close_wait);
        init_waitqueue_head(&port->delta_msr_wait);
@@ -126,6 +127,7 @@ static void tty_port_destructor(struct kref *kref)
        struct tty_port *port = container_of(kref, struct tty_port, kref);
        if (port->xmit_buf)
                free_page((unsigned long)port->xmit_buf);
+       tty_buffer_free_all(port);
        if (port->ops->destruct)
                port->ops->destruct(port);
        else
index 8e9b4be97a2d202c4b1725ff44f97943627b132d..60b7b69260592e9b413b599dcf572117f8487450 100644 (file)
@@ -341,15 +341,11 @@ int paste_selection(struct tty_struct *tty)
        struct  tty_ldisc *ld;
        DECLARE_WAITQUEUE(wait, current);
 
-
        console_lock();
        poke_blanked_console();
        console_unlock();
 
-       /* FIXME: wtf is this supposed to achieve ? */
-       ld = tty_ldisc_ref(tty);
-       if (!ld)
-               ld = tty_ldisc_ref_wait(tty);
+       ld = tty_ldisc_ref_wait(tty);
 
        /* FIXME: this is completely unsafe */
        add_wait_queue(&vc->paste_wait, &wait);
@@ -361,8 +357,7 @@ int paste_selection(struct tty_struct *tty)
                }
                count = sel_buffer_lth - pasted;
                count = min(count, tty->receive_room);
-               tty->ldisc->ops->receive_buf(tty, sel_buffer + pasted,
-                                                               NULL, count);
+               ld->ops->receive_buf(tty, sel_buffer + pasted, NULL, count);
                pasted += count;
        }
        remove_wait_queue(&vc->paste_wait, &wait);
index 2a4749c3eb3f7bd7679f768ca5cdab27de0db72f..23afa06b65a44abf2268dfd4e18dab7e95261414 100644 (file)
@@ -44,7 +44,7 @@
 #include <asm/unaligned.h>
 #include <asm/mach-types.h>
 
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 
 #include <mach/usb.h>
 
@@ -61,6 +61,8 @@
 #define        DRIVER_DESC     "OMAP UDC driver"
 #define        DRIVER_VERSION  "4 October 2004"
 
+#define OMAP_DMA_USB_W2FC_TX0          29
+
 /*
  * The OMAP UDC needs _very_ early endpoint setup:  before enabling the
  * D+ pullup to allow enumeration.  That's too early for the gadget
index 6458764994efe5d2523ca0cfded7af6a0fd91432..4ec3c0d7a18b84bb895262de69bf080886391025 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/ctype.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
+#include <linux/if_vlan.h>
 
 #include "u_ether.h"
 
@@ -295,7 +296,7 @@ static void rx_complete(struct usb_ep *ep, struct usb_request *req)
                while (skb2) {
                        if (status < 0
                                        || ETH_HLEN > skb2->len
-                                       || skb2->len > ETH_FRAME_LEN) {
+                                       || skb2->len > VLAN_ETH_FRAME_LEN) {
                                dev->net->stats.rx_errors++;
                                dev->net->stats.rx_length_errors++;
                                DBG(dev, "rx length %d\n", skb2->len);
index 4a08fc0b27c9e541da76b9598120b646ab7aa9a5..8e58a5fa19946282909eecf2a691ad5d546169c8 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/usb/ulpi.h>
 #include <linux/slab.h>
 
-#include <mach/hardware.h>
 #include <linux/platform_data/usb-ehci-mxc.h>
 
 #include <asm/mach-types.h>
index d7fe287d067803e484d56efdf53060546634ea1e..0d5ac36fdf47aab8dec5cf96e082ac48ad1e0f65 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/usb/ulpi.h>
-#include <plat/usb.h>
 #include <linux/regulator/consumer.h>
 #include <linux/pm_runtime.h>
 #include <linux/gpio.h>
 #include <linux/clk.h>
 
+#include <linux/platform_data/usb-omap.h>
+
 /* EHCI Register Set */
 #define EHCI_INSNREG04                                 (0xA0)
 #define EHCI_INSNREG04_DISABLE_UNSUSPEND               (1 << 5)
index 4531d03503c32371f4b1c5cd505ac38243dafe13..439e6e4f2d6b96c3cb69ad8179aaf5b15be34666 100644 (file)
@@ -25,7 +25,6 @@
 #include <asm/mach-types.h>
 
 #include <mach/mux.h>
-#include <plat/fpga.h>
 
 #include <mach/hardware.h>
 #include <mach/irqs.h>
@@ -93,14 +92,14 @@ static int omap_ohci_transceiver_power(int on)
 {
        if (on) {
                if (machine_is_omap_innovator() && cpu_is_omap1510())
-                       fpga_write(fpga_read(INNOVATOR_FPGA_CAM_USB_CONTROL)
+                       __raw_writeb(__raw_readb(INNOVATOR_FPGA_CAM_USB_CONTROL)
                                | ((1 << 5/*usb1*/) | (1 << 3/*usb2*/)),
                               INNOVATOR_FPGA_CAM_USB_CONTROL);
                else if (machine_is_omap_osk())
                        tps65010_set_gpio_out_value(GPIO1, LOW);
        } else {
                if (machine_is_omap_innovator() && cpu_is_omap1510())
-                       fpga_write(fpga_read(INNOVATOR_FPGA_CAM_USB_CONTROL)
+                       __raw_writeb(__raw_readb(INNOVATOR_FPGA_CAM_USB_CONTROL)
                                & ~((1 << 5/*usb1*/) | (1 << 3/*usb2*/)),
                               INNOVATOR_FPGA_CAM_USB_CONTROL);
                else if (machine_is_omap_osk())
index 1b8133b6e451a7a30965eae265a4106c3050521f..bd7803dce9bed70e2d9802dfe9c8a508e5959752 100644 (file)
@@ -30,7 +30,6 @@
  */
 
 #include <linux/platform_device.h>
-#include <plat/usb.h>
 #include <linux/pm_runtime.h>
 
 /*-------------------------------------------------------------------------*/
index c964d6af178bd0196e20a80bd482529c38369900..a87cdd2387cf5dc1f8b44834585b032a5940c843 100644 (file)
@@ -34,8 +34,7 @@
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
 #include <linux/usb/nop-usb-xceiv.h>
-
-#include <plat/usb.h>
+#include <linux/platform_data/usb-omap.h>
 
 #include "musb_core.h"
 
index ff5f112053d28f114e4d90844b7aa2172f3856d4..aa34f22181c13c9e31969d3ab3ee13656fb370d4 100644 (file)
 #include <linux/pm_runtime.h>
 #include <linux/module.h>
 #include <linux/usb/nop-usb-xceiv.h>
+#include <linux/platform_data/usb-omap.h>
 
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/of_address.h>
 
-#include <plat/usb.h>
-
 #include "musb_core.h"
 
 #ifdef CONFIG_OF
index b85f3973e78c372061221a9e4e75852af5944629..8ef656659fcbdbf9d3d98854ce76c880e1414fb1 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef __MUSB_OMAP243X_H__
 #define __MUSB_OMAP243X_H__
 
-#include <plat/usb.h>
+#include <linux/platform_data/usb-omap.h>
 
 /*
  * OMAP2430-specific definitions
index 7a62b95dac2455dc3c209296e37f74c92cd59729..bfca114f7c5613cb83c4e4c45d3a2ccdcccce84b 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
 #include <linux/slab.h>
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 
 #include "musb_core.h"
 #include "tusb6010.h"
 
 #define MAX_DMAREQ             5       /* REVISIT: Really 6, but req5 not OK */
 
+#define OMAP24XX_DMA_EXT_DMAREQ0       2
+#define OMAP24XX_DMA_EXT_DMAREQ1       3
+#define OMAP242X_DMA_EXT_DMAREQ2       14
+#define OMAP242X_DMA_EXT_DMAREQ3       15
+#define OMAP242X_DMA_EXT_DMAREQ4       16
+#define OMAP242X_DMA_EXT_DMAREQ5       64
+
 struct tusb_omap_dma_ch {
        struct musb             *musb;
        void __iomem            *tbase;
index cf2688de083244c2ab25da05638c6edb2d7e3a47..e501dbc966b3b2a3976d17956fc9bd9f387cec29 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/math64.h>
 
 #include <linux/platform_data/video-imxfb.h>
-#include <mach/hardware.h>
 
 /*
  * Complain if VAR is out of range.
@@ -53,8 +52,8 @@
 #define LCDC_SIZE      0x04
 #define SIZE_XMAX(x)   ((((x) >> 4) & 0x3f) << 20)
 
-#define YMAX_MASK       (cpu_is_mx1() ? 0x1ff : 0x3ff)
-#define SIZE_YMAX(y)   ((y) & YMAX_MASK)
+#define YMAX_MASK_IMX1 0x1ff
+#define YMAX_MASK_IMX21        0x3ff
 
 #define LCDC_VPW       0x08
 #define VPW_VPW(x)     ((x) & 0x3ff)
@@ -128,12 +127,18 @@ struct imxfb_rgb {
        struct fb_bitfield      transp;
 };
 
+enum imxfb_type {
+       IMX1_FB,
+       IMX21_FB,
+};
+
 struct imxfb_info {
        struct platform_device  *pdev;
        void __iomem            *regs;
        struct clk              *clk_ipg;
        struct clk              *clk_ahb;
        struct clk              *clk_per;
+       enum imxfb_type         devtype;
 
        /*
         * These are the addresses we mapped
@@ -168,6 +173,24 @@ struct imxfb_info {
        void (*backlight_power)(int);
 };
 
+static struct platform_device_id imxfb_devtype[] = {
+       {
+               .name = "imx1-fb",
+               .driver_data = IMX1_FB,
+       }, {
+               .name = "imx21-fb",
+               .driver_data = IMX21_FB,
+       }, {
+               /* sentinel */
+       }
+};
+MODULE_DEVICE_TABLE(platform, imxfb_devtype);
+
+static inline int is_imx1_fb(struct imxfb_info *fbi)
+{
+       return fbi->devtype == IMX1_FB;
+}
+
 #define IMX_NAME       "IMX"
 
 /*
@@ -366,7 +389,7 @@ static int imxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
                break;
        case 16:
        default:
-               if (cpu_is_mx1())
+               if (is_imx1_fb(fbi))
                        pcr |= PCR_BPIX_12;
                else
                        pcr |= PCR_BPIX_16;
@@ -596,6 +619,7 @@ static struct fb_ops imxfb_ops = {
 static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *info)
 {
        struct imxfb_info *fbi = info->par;
+       u32 ymax_mask = is_imx1_fb(fbi) ? YMAX_MASK_IMX1 : YMAX_MASK_IMX21;
 
        pr_debug("var: xres=%d hslen=%d lm=%d rm=%d\n",
                var->xres, var->hsync_len,
@@ -617,7 +641,7 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf
        if (var->right_margin > 255)
                printk(KERN_ERR "%s: invalid right_margin %d\n",
                        info->fix.id, var->right_margin);
-       if (var->yres < 1 || var->yres > YMAX_MASK)
+       if (var->yres < 1 || var->yres > ymax_mask)
                printk(KERN_ERR "%s: invalid yres %d\n",
                        info->fix.id, var->yres);
        if (var->vsync_len > 100)
@@ -645,7 +669,7 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf
                VCR_V_WAIT_2(var->upper_margin),
                fbi->regs + LCDC_VCR);
 
-       writel(SIZE_XMAX(var->xres) | SIZE_YMAX(var->yres),
+       writel(SIZE_XMAX(var->xres) | (var->yres & ymax_mask),
                        fbi->regs + LCDC_SIZE);
 
        writel(fbi->pcr, fbi->regs + LCDC_PCR);
@@ -765,6 +789,7 @@ static int __init imxfb_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        fbi = info->par;
+       fbi->devtype = pdev->id_entry->driver_data;
 
        if (!fb_mode)
                fb_mode = pdata->mode[0].mode.name;
@@ -939,6 +964,7 @@ static struct platform_driver imxfb_driver = {
        .driver         = {
                .name   = DRIVER_NAME,
        },
+       .id_table       = imxfb_devtype,
 };
 
 static int imxfb_setup(void)
index ce1d452464ed5171d537346bdd1a0132a7d321d1..73688720857445ddb18096a90a80fc22f2f63499 100644 (file)
 #include <linux/console.h>
 #include <linux/clk.h>
 #include <linux/mutex.h>
+#include <linux/dma/ipu-dma.h>
 
 #include <linux/platform_data/dma-imx.h>
-#include <mach/hardware.h>
-#include <mach/ipu.h>
 #include <linux/platform_data/video-mx3fb.h>
 
 #include <asm/io.h>
index b38b1dd15ce35f059c446a36313424d2ab11274c..2ee423279e358f59d8799ef2d47309a0e074dd4d 100644 (file)
@@ -23,7 +23,8 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 
-#include <plat/fpga.h>
+#include <mach/hardware.h>
+
 #include "omapfb.h"
 
 static int innovator1510_panel_init(struct lcd_panel *panel,
@@ -38,13 +39,13 @@ static void innovator1510_panel_cleanup(struct lcd_panel *panel)
 
 static int innovator1510_panel_enable(struct lcd_panel *panel)
 {
-       fpga_write(0x7, OMAP1510_FPGA_LCD_PANEL_CONTROL);
+       __raw_writeb(0x7, OMAP1510_FPGA_LCD_PANEL_CONTROL);
        return 0;
 }
 
 static void innovator1510_panel_disable(struct lcd_panel *panel)
 {
-       fpga_write(0x0, OMAP1510_FPGA_LCD_PANEL_CONTROL);
+       __raw_writeb(0x0, OMAP1510_FPGA_LCD_PANEL_CONTROL);
 }
 
 static unsigned long innovator1510_panel_get_caps(struct lcd_panel *panel)
index 7767338f8b14028fe4ff409eed4717e99296f0ba..c39d6e46f8c52796d113076ee9b3532890b7a814 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/gfp.h>
 
 #include <mach/lcdc.h>
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 
 #include <asm/mach-types.h>
 
index 4351c438b76f5f52cd0ea7f03c28c1b9cb48492d..1b5ee8ec192ac35a0d7843402a554d3a0643fc0f 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/uaccess.h>
 #include <linux/module.h>
 
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 
 #include "omapfb.h"
 #include "lcdc.h"
index f79c137753d708f0130031fd32b99e5a6e0469e0..c510a445739818827cd5d8a51b143956e6f45eb4 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/io.h>
 #include <linux/interrupt.h>
 
-#include <plat/dma.h>
+#include <plat-omap/dma-omap.h>
 
 #include "omapfb.h"
 #include "lcdc.h"
index b2af72dc20bdb2cf0cc5f880008916fb85d09826..d94ef9e31a354b877f2eb3dcee6cb4be1bda2462 100644 (file)
@@ -237,7 +237,7 @@ static int __init omap_dss_probe(struct platform_device *pdev)
 
        core.pdev = pdev;
 
-       dss_features_init();
+       dss_features_init(pdata->version);
 
        dss_apply_init();
 
index b43477a5fae869e5e8981faaea48f51c15827e49..a5ab354f267ae1a458ae1ba0fd5d6c8104f74b4f 100644 (file)
@@ -37,8 +37,6 @@
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 
-#include <plat/cpu.h>
-
 #include <video/omapdss.h>
 
 #include "dss.h"
@@ -4042,29 +4040,44 @@ static const struct dispc_features omap44xx_dispc_feats __initconst = {
        .gfx_fifo_workaround    =       true,
 };
 
-static int __init dispc_init_features(struct device *dev)
+static int __init dispc_init_features(struct platform_device *pdev)
 {
+       struct omap_dss_board_info *pdata = pdev->dev.platform_data;
        const struct dispc_features *src;
        struct dispc_features *dst;
 
-       dst = devm_kzalloc(dev, sizeof(*dst), GFP_KERNEL);
+       dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL);
        if (!dst) {
-               dev_err(dev, "Failed to allocate DISPC Features\n");
+               dev_err(&pdev->dev, "Failed to allocate DISPC Features\n");
                return -ENOMEM;
        }
 
-       if (cpu_is_omap24xx()) {
+       switch (pdata->version) {
+       case OMAPDSS_VER_OMAP24xx:
                src = &omap24xx_dispc_feats;
-       } else if (cpu_is_omap34xx()) {
-               if (omap_rev() < OMAP3430_REV_ES3_0)
-                       src = &omap34xx_rev1_0_dispc_feats;
-               else
-                       src = &omap34xx_rev3_0_dispc_feats;
-       } else if (cpu_is_omap44xx()) {
+               break;
+
+       case OMAPDSS_VER_OMAP34xx_ES1:
+               src = &omap34xx_rev1_0_dispc_feats;
+               break;
+
+       case OMAPDSS_VER_OMAP34xx_ES3:
+       case OMAPDSS_VER_OMAP3630:
+       case OMAPDSS_VER_AM35xx:
+               src = &omap34xx_rev3_0_dispc_feats;
+               break;
+
+       case OMAPDSS_VER_OMAP4430_ES1:
+       case OMAPDSS_VER_OMAP4430_ES2:
+       case OMAPDSS_VER_OMAP4:
                src = &omap44xx_dispc_feats;
-       } else if (soc_is_omap54xx()) {
+               break;
+
+       case OMAPDSS_VER_OMAP5:
                src = &omap44xx_dispc_feats;
-       } else {
+               break;
+
+       default:
                return -ENODEV;
        }
 
@@ -4084,7 +4097,7 @@ static int __init omap_dispchw_probe(struct platform_device *pdev)
 
        dispc.pdev = pdev;
 
-       r = dispc_init_features(&dispc.pdev->dev);
+       r = dispc_init_features(dispc.pdev);
        if (r)
                return r;
 
index 2ab1c3e96553d81297ad5f942eed2cfb76a5064b..363852a0f76491271a68505fbe4bdbde7673e951 100644 (file)
@@ -35,8 +35,6 @@
 
 #include <video/omapdss.h>
 
-#include <plat/cpu.h>
-
 #include "dss.h"
 #include "dss_features.h"
 
@@ -792,29 +790,46 @@ static const struct dss_features omap54xx_dss_feats __initconst = {
        .dpi_select_source      =       &dss_dpi_select_source_omap5,
 };
 
-static int __init dss_init_features(struct device *dev)
+static int __init dss_init_features(struct platform_device *pdev)
 {
+       struct omap_dss_board_info *pdata = pdev->dev.platform_data;
        const struct dss_features *src;
        struct dss_features *dst;
 
-       dst = devm_kzalloc(dev, sizeof(*dst), GFP_KERNEL);
+       dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL);
        if (!dst) {
-               dev_err(dev, "Failed to allocate local DSS Features\n");
+               dev_err(&pdev->dev, "Failed to allocate local DSS Features\n");
                return -ENOMEM;
        }
 
-       if (cpu_is_omap24xx())
+       switch (pdata->version) {
+       case OMAPDSS_VER_OMAP24xx:
                src = &omap24xx_dss_feats;
-       else if (cpu_is_omap34xx())
+               break;
+
+       case OMAPDSS_VER_OMAP34xx_ES1:
+       case OMAPDSS_VER_OMAP34xx_ES3:
+       case OMAPDSS_VER_AM35xx:
                src = &omap34xx_dss_feats;
-       else if (cpu_is_omap3630())
+               break;
+
+       case OMAPDSS_VER_OMAP3630:
                src = &omap3630_dss_feats;
-       else if (cpu_is_omap44xx())
+               break;
+
+       case OMAPDSS_VER_OMAP4430_ES1:
+       case OMAPDSS_VER_OMAP4430_ES2:
+       case OMAPDSS_VER_OMAP4:
                src = &omap44xx_dss_feats;
-       else if (soc_is_omap54xx())
+               break;
+
+       case OMAPDSS_VER_OMAP5:
                src = &omap54xx_dss_feats;
-       else
+               break;
+
+       default:
                return -ENODEV;
+       }
 
        memcpy(dst, src, sizeof(*dst));
        dss.feat = dst;
@@ -831,7 +846,7 @@ static int __init omap_dsshw_probe(struct platform_device *pdev)
 
        dss.pdev = pdev;
 
-       r = dss_init_features(&dss.pdev->dev);
+       r = dss_init_features(dss.pdev);
        if (r)
                return r;
 
index acbc1e1efba3650aaccba2d86b000816973d23ba..3e8287c8709dcfe2175ac4f36bc143b8df30eeaa 100644 (file)
@@ -23,7 +23,6 @@
 #include <linux/slab.h>
 
 #include <video/omapdss.h>
-#include <plat/cpu.h>
 
 #include "dss.h"
 #include "dss_features.h"
@@ -825,10 +824,20 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
 
 };
 
-void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data)
+void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data,
+               enum omapdss_version version)
 {
-       if (cpu_is_omap44xx())
+       switch (version) {
+       case OMAPDSS_VER_OMAP4430_ES1:
+       case OMAPDSS_VER_OMAP4430_ES2:
+       case OMAPDSS_VER_OMAP4:
                ip_data->ops = &omap4_hdmi_functions;
+               break;
+       default:
+               ip_data->ops = NULL;
+       }
+
+       WARN_ON(ip_data->ops == NULL);
 }
 #endif
 
@@ -929,29 +938,44 @@ bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type)
        return omap_current_dss_features->supported_rotation_types & rot_type;
 }
 
-void dss_features_init(void)
+void dss_features_init(enum omapdss_version version)
 {
-       if (cpu_is_omap24xx())
+       switch (version) {
+       case OMAPDSS_VER_OMAP24xx:
                omap_current_dss_features = &omap2_dss_features;
-       else if (cpu_is_omap3630())
+               break;
+
+       case OMAPDSS_VER_OMAP34xx_ES1:
+       case OMAPDSS_VER_OMAP34xx_ES3:
+               omap_current_dss_features = &omap3430_dss_features;
+               break;
+
+       case OMAPDSS_VER_OMAP3630:
                omap_current_dss_features = &omap3630_dss_features;
-       else if (cpu_is_omap34xx()) {
-               if (soc_is_am35xx()) {
-                       omap_current_dss_features = &am35xx_dss_features;
-               } else {
-                       omap_current_dss_features = &omap3430_dss_features;
-               }
-       }
-       else if (omap_rev() == OMAP4430_REV_ES1_0)
+               break;
+
+       case OMAPDSS_VER_OMAP4430_ES1:
                omap_current_dss_features = &omap4430_es1_0_dss_features;
-       else if (omap_rev() == OMAP4430_REV_ES2_0 ||
-               omap_rev() == OMAP4430_REV_ES2_1 ||
-               omap_rev() == OMAP4430_REV_ES2_2)
+               break;
+
+       case OMAPDSS_VER_OMAP4430_ES2:
                omap_current_dss_features = &omap4430_es2_0_1_2_dss_features;
-       else if (cpu_is_omap44xx())
+               break;
+
+       case OMAPDSS_VER_OMAP4:
                omap_current_dss_features = &omap4_dss_features;
-       else if (soc_is_omap54xx())
+               break;
+
+       case OMAPDSS_VER_OMAP5:
                omap_current_dss_features = &omap5_dss_features;
-       else
+               break;
+
+       case OMAPDSS_VER_AM35xx:
+               omap_current_dss_features = &am35xx_dss_features;
+               break;
+
+       default:
                DSSWARN("Unsupported OMAP version");
+               break;
+       }
 }
index 9218113b5e88c2c5488acb2f989e06ff080cfe06..fc492ef72a51b35f523b09a7c8622cbd3103851c 100644 (file)
@@ -123,8 +123,9 @@ bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type);
 
 bool dss_has_feature(enum dss_feat_id id);
 void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end);
-void dss_features_init(void);
+void dss_features_init(enum omapdss_version version);
 #if defined(CONFIG_OMAP4_DSS_HDMI)
-void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data);
+void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data,
+               enum omapdss_version version);
 #endif
 #endif
index a48a7dd75b3303a3bba28e10b01e4c1f133c00d3..adcc906d12f860fee01fce8089d2cce253960a73 100644 (file)
@@ -323,6 +323,7 @@ static void hdmi_runtime_put(void)
 
 static int __init hdmi_init_display(struct omap_dss_device *dssdev)
 {
+       struct omap_dss_board_info *pdata = hdmi.pdev->dev.platform_data;
        int r;
 
        struct gpio gpios[] = {
@@ -333,7 +334,7 @@ static int __init hdmi_init_display(struct omap_dss_device *dssdev)
 
        DSSDBG("init_display\n");
 
-       dss_init_hdmi_ip_ops(&hdmi.ip_data);
+       dss_init_hdmi_ip_ops(&hdmi.ip_data, pdata->version);
 
        if (hdmi.vdda_hdmi_dac_reg == NULL) {
                struct regulator *reg;
index 606b89f12351d4e1cc2cb234fd4e5c481bf82cda..55a39be694a5f907e2e75d1a02c268313a342083 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/export.h>
 
 #include <video/omapdss.h>
-#include <plat/vrfb.h>
+#include <video/omapvrfb.h>
 #include <plat/vram.h>
 
 #include "omapfb.h"
index 16db1589bd9180a01920078f156b3650971b2311..bc225e46fdd2da8125bf48d1dfd7cf2cbda9625e 100644 (file)
@@ -31,9 +31,8 @@
 #include <linux/omapfb.h>
 
 #include <video/omapdss.h>
-#include <plat/cpu.h>
 #include <plat/vram.h>
-#include <plat/vrfb.h>
+#include <video/omapvrfb.h>
 
 #include "omapfb.h"
 
@@ -2396,10 +2395,7 @@ static int __init omapfb_probe(struct platform_device *pdev)
                goto err0;
        }
 
-       /* TODO : Replace cpu check with omap_has_vrfb once HAS_FEATURE
-       *        available for OMAP2 and OMAP3
-       */
-       if (def_vrfb && !cpu_is_omap24xx() && !cpu_is_omap34xx()) {
+       if (def_vrfb && !omap_vrfb_supported()) {
                def_vrfb = 0;
                dev_warn(&pdev->dev, "VRFB is not supported on this hardware, "
                                "ignoring the module parameter vrfb=y\n");
index e8d8cc76a4351ce58e306d5a67b4b947cec2e9c1..17aa174e187c94cb617065ebeeccb2b45985ba94 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/omapfb.h>
 
 #include <video/omapdss.h>
-#include <plat/vrfb.h>
+#include <video/omapvrfb.h>
 
 #include "omapfb.h"
 
index 7e990220ad2a6f52a25ff861f754d86e447a8358..5d8fdac3b8003982242d1f5f865492752ccac4bf 100644 (file)
@@ -26,9 +26,9 @@
 #include <linux/io.h>
 #include <linux/bitops.h>
 #include <linux/mutex.h>
+#include <linux/platform_device.h>
 
-#include <plat/vrfb.h>
-#include <plat/sdrc.h>
+#include <video/omapvrfb.h>
 
 #ifdef DEBUG
 #define DBG(format, ...) pr_debug("VRFB: " format, ## __VA_ARGS__)
 #define DBG(format, ...)
 #endif
 
-#define SMS_ROT_VIRT_BASE(context, rot) \
-       (((context >= 4) ? 0xD0000000 : 0x70000000) \
-        + (0x4000000 * (context)) \
-        + (0x1000000 * (rot)))
+#define SMS_ROT_CONTROL(context)       (0x0 + 0x10 * context)
+#define SMS_ROT_SIZE(context)          (0x4 + 0x10 * context)
+#define SMS_ROT_PHYSICAL_BA(context)   (0x8 + 0x10 * context)
+#define SMS_ROT_VIRT_BASE(rot)         (0x1000000 * (rot))
 
 #define OMAP_VRFB_SIZE                 (2048 * 2048 * 4)
 
 #define SMS_PW_OFFSET          4
 #define SMS_PS_OFFSET          0
 
-#define VRFB_NUM_CTXS 12
 /* bitmap of reserved contexts */
 static unsigned long ctx_map;
 
+struct vrfb_ctx {
+       u32 base;
+       u32 physical_ba;
+       u32 control;
+       u32 size;
+};
+
 static DEFINE_MUTEX(ctx_lock);
 
 /*
@@ -65,17 +71,34 @@ static DEFINE_MUTEX(ctx_lock);
  * we don't need locking, since no drivers will run until after the wake-up
  * has finished.
  */
-static struct {
-       u32 physical_ba;
-       u32 control;
-       u32 size;
-} vrfb_hw_context[VRFB_NUM_CTXS];
+
+static void __iomem *vrfb_base;
+
+static int num_ctxs;
+static struct vrfb_ctx *ctxs;
+
+static bool vrfb_loaded;
+
+static void omap2_sms_write_rot_control(u32 val, unsigned ctx)
+{
+       __raw_writel(val, vrfb_base + SMS_ROT_CONTROL(ctx));
+}
+
+static void omap2_sms_write_rot_size(u32 val, unsigned ctx)
+{
+       __raw_writel(val, vrfb_base + SMS_ROT_SIZE(ctx));
+}
+
+static void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx)
+{
+       __raw_writel(val, vrfb_base + SMS_ROT_PHYSICAL_BA(ctx));
+}
 
 static inline void restore_hw_context(int ctx)
 {
-       omap2_sms_write_rot_control(vrfb_hw_context[ctx].control, ctx);
-       omap2_sms_write_rot_size(vrfb_hw_context[ctx].size, ctx);
-       omap2_sms_write_rot_physical_ba(vrfb_hw_context[ctx].physical_ba, ctx);
+       omap2_sms_write_rot_control(ctxs[ctx].control, ctx);
+       omap2_sms_write_rot_size(ctxs[ctx].size, ctx);
+       omap2_sms_write_rot_physical_ba(ctxs[ctx].physical_ba, ctx);
 }
 
 static u32 get_image_width_roundup(u16 width, u8 bytespp)
@@ -196,9 +219,9 @@ void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
        control |= VRFB_PAGE_WIDTH_EXP  << SMS_PW_OFFSET;
        control |= VRFB_PAGE_HEIGHT_EXP << SMS_PH_OFFSET;
 
-       vrfb_hw_context[ctx].physical_ba = paddr;
-       vrfb_hw_context[ctx].size = size;
-       vrfb_hw_context[ctx].control = control;
+       ctxs[ctx].physical_ba = paddr;
+       ctxs[ctx].size = size;
+       ctxs[ctx].control = control;
 
        omap2_sms_write_rot_physical_ba(paddr, ctx);
        omap2_sms_write_rot_size(size, ctx);
@@ -274,11 +297,11 @@ int omap_vrfb_request_ctx(struct vrfb *vrfb)
 
        mutex_lock(&ctx_lock);
 
-       for (ctx = 0; ctx < VRFB_NUM_CTXS; ++ctx)
+       for (ctx = 0; ctx < num_ctxs; ++ctx)
                if ((ctx_map & (1 << ctx)) == 0)
                        break;
 
-       if (ctx == VRFB_NUM_CTXS) {
+       if (ctx == num_ctxs) {
                pr_err("vrfb: no free contexts\n");
                r = -EBUSY;
                goto out;
@@ -293,7 +316,7 @@ int omap_vrfb_request_ctx(struct vrfb *vrfb)
        vrfb->context = ctx;
 
        for (rot = 0; rot < 4; ++rot) {
-               paddr = SMS_ROT_VIRT_BASE(ctx, rot);
+               paddr = ctxs[ctx].base + SMS_ROT_VIRT_BASE(rot);
                if (!request_mem_region(paddr, OMAP_VRFB_SIZE, "vrfb")) {
                        pr_err("vrfb: failed to reserve VRFB "
                                        "area for ctx %d, rotation %d\n",
@@ -314,3 +337,80 @@ out:
        return r;
 }
 EXPORT_SYMBOL(omap_vrfb_request_ctx);
+
+bool omap_vrfb_supported(void)
+{
+       return vrfb_loaded;
+}
+EXPORT_SYMBOL(omap_vrfb_supported);
+
+static int __init vrfb_probe(struct platform_device *pdev)
+{
+       struct resource *mem;
+       int i;
+
+       /* first resource is the register res, the rest are vrfb contexts */
+
+       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!mem) {
+               dev_err(&pdev->dev, "can't get vrfb base address\n");
+               return -EINVAL;
+       }
+
+       vrfb_base = devm_request_and_ioremap(&pdev->dev, mem);
+       if (!vrfb_base) {
+               dev_err(&pdev->dev, "can't ioremap vrfb memory\n");
+               return -ENOMEM;
+       }
+
+       num_ctxs = pdev->num_resources - 1;
+
+       ctxs = devm_kzalloc(&pdev->dev,
+                       sizeof(struct vrfb_ctx) * num_ctxs,
+                       GFP_KERNEL);
+
+       if (!ctxs)
+               return -ENOMEM;
+
+       for (i = 0; i < num_ctxs; ++i) {
+               mem = platform_get_resource(pdev, IORESOURCE_MEM, 1 + i);
+               if (!mem) {
+                       dev_err(&pdev->dev, "can't get vrfb ctx %d address\n",
+                                       i);
+                       return -EINVAL;
+               }
+
+               ctxs[i].base = mem->start;
+       }
+
+       vrfb_loaded = true;
+
+       return 0;
+}
+
+static void __exit vrfb_remove(struct platform_device *pdev)
+{
+       vrfb_loaded = false;
+}
+
+static struct platform_driver vrfb_driver = {
+       .driver.name    = "omapvrfb",
+       .remove         = __exit_p(vrfb_remove),
+};
+
+static int __init vrfb_init(void)
+{
+       return platform_driver_probe(&vrfb_driver, &vrfb_probe);
+}
+
+static void __exit vrfb_exit(void)
+{
+       platform_driver_unregister(&vrfb_driver);
+}
+
+module_init(vrfb_init);
+module_exit(vrfb_exit);
+
+MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
+MODULE_DESCRIPTION("OMAP VRFB");
+MODULE_LICENSE("GPL v2");
index b7f5173ff9e94214ed40c3c40f4444324e128888..917bb5681684d31490e1b228b60db57cc0d53a7b 100644 (file)
@@ -641,7 +641,6 @@ static void xenfb_backend_changed(struct xenbus_device *dev,
        case XenbusStateReconfiguring:
        case XenbusStateReconfigured:
        case XenbusStateUnknown:
-       case XenbusStateClosed:
                break;
 
        case XenbusStateInitWait:
@@ -670,6 +669,10 @@ InitWait:
                info->feature_resize = val;
                break;
 
+       case XenbusStateClosed:
+               if (dev->state == XenbusStateClosed)
+                       break;
+               /* Missed the backend's CLOSING state -- fallthrough */
        case XenbusStateClosing:
                xenbus_frontend_closed(dev);
                break;
index 1e8659ca27ef4228d55e97ec5cbafc99d861b22a..809b0de59c0982cc30bca6d0b06b6229a5403c65 100644 (file)
@@ -225,8 +225,10 @@ EXPORT_SYMBOL_GPL(register_virtio_device);
 
 void unregister_virtio_device(struct virtio_device *dev)
 {
+       int index = dev->index; /* save for after device release */
+
        device_unregister(&dev->dev);
-       ida_simple_remove(&virtio_index_ida, dev->index);
+       ida_simple_remove(&virtio_index_ida, index);
 }
 EXPORT_SYMBOL_GPL(unregister_virtio_device);
 
index bcfab2b00ad20ae5c1e72fbf0e2809aa02cfdf2d..9a45d0294cf48f21397f43909680f2f9349c6d86 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/uaccess.h>
 #include <linux/timer.h>
 #include <linux/jiffies.h>
-#include <mach/hardware.h>
 
 #define DRIVER_NAME "imx2-wdt"
 
index f5db18dbc0f9e5e9092462142aa805a87239d696..477a1d47a64c1374877f43d5d3c43241799a5f49 100644 (file)
@@ -46,8 +46,8 @@
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
 #include <mach/hardware.h>
-#include <plat/cpu.h>
-#include <plat/prcm.h>
+
+#include <linux/platform_data/omap-wd-timer.h>
 
 #include "omap_wdt.h"
 
@@ -202,8 +202,10 @@ static ssize_t omap_wdt_write(struct file *file, const char __user *data,
 static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
                                                unsigned long arg)
 {
+       struct omap_wd_timer_platform_data *pdata;
        struct omap_wdt_dev *wdev;
-       int new_margin;
+       u32 rs;
+       int new_margin, bs;
        static const struct watchdog_info ident = {
                .identity = "OMAP Watchdog",
                .options = WDIOF_SETTIMEOUT,
@@ -211,6 +213,7 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
        };
 
        wdev = file->private_data;
+       pdata = wdev->dev->platform_data;
 
        switch (cmd) {
        case WDIOC_GETSUPPORT:
@@ -219,17 +222,12 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
        case WDIOC_GETSTATUS:
                return put_user(0, (int __user *)arg);
        case WDIOC_GETBOOTSTATUS:
-#ifdef CONFIG_ARCH_OMAP1
-               if (cpu_is_omap16xx())
-                       return put_user(__raw_readw(ARM_SYSST),
-                                       (int __user *)arg);
-#endif
-#ifdef CONFIG_ARCH_OMAP2PLUS
-               if (cpu_is_omap24xx())
-                       return put_user(omap_prcm_get_reset_sources(),
-                                       (int __user *)arg);
-#endif
-               return put_user(0, (int __user *)arg);
+               if (!pdata || !pdata->read_reset_sources)
+                       return put_user(0, (int __user *)arg);
+               rs = pdata->read_reset_sources();
+               bs = (rs & (1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT)) ?
+                       WDIOF_CARDRESET : 0;
+               return put_user(bs, (int __user *)arg);
        case WDIOC_KEEPALIVE:
                spin_lock(&wdt_lock);
                omap_wdt_ping(wdev);
index 0e86370354572ac7d4116eb70cf6e41d1a52cf35..74354708c6c4e7dd9040ead14affbfa88924ca74 100644 (file)
@@ -2,6 +2,7 @@ ifneq ($(CONFIG_ARM),y)
 obj-y  += manage.o balloon.o
 obj-$(CONFIG_HOTPLUG_CPU)              += cpu_hotplug.o
 endif
+obj-$(CONFIG_X86)                      += fallback.o
 obj-y  += grant-table.o features.o events.o
 obj-y  += xenbus/
 
index 912ac81b6dbff5e2b9f48c2b2662083bf00ce476..0be4df39e953a5b870948e6ed8a1553a15cc2c2a 100644 (file)
@@ -1395,10 +1395,10 @@ void xen_evtchn_do_upcall(struct pt_regs *regs)
 {
        struct pt_regs *old_regs = set_irq_regs(regs);
 
+       irq_enter();
 #ifdef CONFIG_X86
        exit_idle();
 #endif
-       irq_enter();
 
        __xen_evtchn_do_upcall();
 
diff --git a/drivers/xen/fallback.c b/drivers/xen/fallback.c
new file mode 100644 (file)
index 0000000..0ef7c4d
--- /dev/null
@@ -0,0 +1,80 @@
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/bug.h>
+#include <linux/export.h>
+#include <asm/hypervisor.h>
+#include <asm/xen/hypercall.h>
+
+int xen_event_channel_op_compat(int cmd, void *arg)
+{
+       struct evtchn_op op;
+       int rc;
+
+       op.cmd = cmd;
+       memcpy(&op.u, arg, sizeof(op.u));
+       rc = _hypercall1(int, event_channel_op_compat, &op);
+
+       switch (cmd) {
+       case EVTCHNOP_close:
+       case EVTCHNOP_send:
+       case EVTCHNOP_bind_vcpu:
+       case EVTCHNOP_unmask:
+               /* no output */
+               break;
+
+#define COPY_BACK(eop) \
+       case EVTCHNOP_##eop: \
+               memcpy(arg, &op.u.eop, sizeof(op.u.eop)); \
+               break
+
+       COPY_BACK(bind_interdomain);
+       COPY_BACK(bind_virq);
+       COPY_BACK(bind_pirq);
+       COPY_BACK(status);
+       COPY_BACK(alloc_unbound);
+       COPY_BACK(bind_ipi);
+#undef COPY_BACK
+
+       default:
+               WARN_ON(rc != -ENOSYS);
+               break;
+       }
+
+       return rc;
+}
+EXPORT_SYMBOL_GPL(xen_event_channel_op_compat);
+
+int HYPERVISOR_physdev_op_compat(int cmd, void *arg)
+{
+       struct physdev_op op;
+       int rc;
+
+       op.cmd = cmd;
+       memcpy(&op.u, arg, sizeof(op.u));
+       rc = _hypercall1(int, physdev_op_compat, &op);
+
+       switch (cmd) {
+       case PHYSDEVOP_IRQ_UNMASK_NOTIFY:
+       case PHYSDEVOP_set_iopl:
+       case PHYSDEVOP_set_iobitmap:
+       case PHYSDEVOP_apic_write:
+               /* no output */
+               break;
+
+#define COPY_BACK(pop, fld) \
+       case PHYSDEVOP_##pop: \
+               memcpy(arg, &op.u.fld, sizeof(op.u.fld)); \
+               break
+
+       COPY_BACK(irq_status_query, irq_status_query);
+       COPY_BACK(apic_read, apic_op);
+       COPY_BACK(ASSIGN_VECTOR, irq_op);
+#undef COPY_BACK
+
+       default:
+               WARN_ON(rc != -ENOSYS);
+               break;
+       }
+
+       return rc;
+}
index 610bfc6be17708594783d231d608c14651625376..2e22df2f7a3f8b57fe44ce8842b825602a012658 100644 (file)
@@ -105,6 +105,21 @@ static void gntdev_print_maps(struct gntdev_priv *priv,
 #endif
 }
 
+static void gntdev_free_map(struct grant_map *map)
+{
+       if (map == NULL)
+               return;
+
+       if (map->pages)
+               free_xenballooned_pages(map->count, map->pages);
+       kfree(map->pages);
+       kfree(map->grants);
+       kfree(map->map_ops);
+       kfree(map->unmap_ops);
+       kfree(map->kmap_ops);
+       kfree(map);
+}
+
 static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count)
 {
        struct grant_map *add;
@@ -142,12 +157,7 @@ static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count)
        return add;
 
 err:
-       kfree(add->pages);
-       kfree(add->grants);
-       kfree(add->map_ops);
-       kfree(add->unmap_ops);
-       kfree(add->kmap_ops);
-       kfree(add);
+       gntdev_free_map(add);
        return NULL;
 }
 
@@ -198,17 +208,9 @@ static void gntdev_put_map(struct grant_map *map)
                evtchn_put(map->notify.event);
        }
 
-       if (map->pages) {
-               if (!use_ptemod)
-                       unmap_grant_pages(map, 0, map->count);
-
-               free_xenballooned_pages(map->count, map->pages);
-       }
-       kfree(map->pages);
-       kfree(map->grants);
-       kfree(map->map_ops);
-       kfree(map->unmap_ops);
-       kfree(map);
+       if (map->pages && !use_ptemod)
+               unmap_grant_pages(map, 0, map->count);
+       gntdev_free_map(map);
 }
 
 /* ------------------------------------------------------------------ */
index 89f76252a16f20e2638ee578faf4e3cbb4a316c6..ac727028e658f75778fa916ca94e91c5d80e0737 100644 (file)
@@ -458,7 +458,7 @@ static ssize_t xenbus_file_write(struct file *filp,
                goto out;
 
        /* Can't write a xenbus message larger we can buffer */
-       if ((len + u->len) > sizeof(u->u.buffer)) {
+       if (len > sizeof(u->u.buffer) - u->len) {
                /* On error, dump existing buffer */
                u->len = 0;
                rc = -EINVAL;
index 9298c65ad9c74bb1c4adde9ef9ffa07b397ca63f..b96fc6ce485595f0179bc909c807ae197258e671 100644 (file)
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -75,6 +75,7 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size)
        unsigned int sz = sizeof(struct bio) + extra_size;
        struct kmem_cache *slab = NULL;
        struct bio_slab *bslab, *new_bio_slabs;
+       unsigned int new_bio_slab_max;
        unsigned int i, entry = -1;
 
        mutex_lock(&bio_slab_lock);
@@ -97,12 +98,13 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size)
                goto out_unlock;
 
        if (bio_slab_nr == bio_slab_max && entry == -1) {
-               bio_slab_max <<= 1;
+               new_bio_slab_max = bio_slab_max << 1;
                new_bio_slabs = krealloc(bio_slabs,
-                                        bio_slab_max * sizeof(struct bio_slab),
+                                        new_bio_slab_max * sizeof(struct bio_slab),
                                         GFP_KERNEL);
                if (!new_bio_slabs)
                        goto out_unlock;
+               bio_slab_max = new_bio_slab_max;
                bio_slabs = new_bio_slabs;
        }
        if (entry == -1)
index 02ce90972d81ca6e8b60ed580931c676c441fc2c..9349bb37a2fe68df93651e6afeb384468157edd2 100644 (file)
@@ -90,6 +90,8 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
                *max_len = handle_length;
                type = 255;
        }
+       if (dentry)
+               dput(dentry);
        return type;
 }
 
index fc783e264420a890751aa81e819fc8b53aaa1a81..0fb15bbbe43cd955150336dec51b415ee1901c5a 100644 (file)
@@ -224,6 +224,13 @@ sid_to_str(struct cifs_sid *sidptr, char *sidstr)
        }
 }
 
+static void
+cifs_copy_sid(struct cifs_sid *dst, const struct cifs_sid *src)
+{
+       memcpy(dst, src, sizeof(*dst));
+       dst->num_subauth = min_t(u8, src->num_subauth, NUM_SUBAUTHS);
+}
+
 static void
 id_rb_insert(struct rb_root *root, struct cifs_sid *sidptr,
                struct cifs_sid_id **psidid, char *typestr)
@@ -248,7 +255,7 @@ id_rb_insert(struct rb_root *root, struct cifs_sid *sidptr,
                }
        }
 
-       memcpy(&(*psidid)->sid, sidptr, sizeof(struct cifs_sid));
+       cifs_copy_sid(&(*psidid)->sid, sidptr);
        (*psidid)->time = jiffies - (SID_MAP_RETRY + 1);
        (*psidid)->refcount = 0;
 
@@ -354,7 +361,7 @@ id_to_sid(unsigned long cid, uint sidtype, struct cifs_sid *ssid)
         * any fields of the node after a reference is put .
         */
        if (test_bit(SID_ID_MAPPED, &psidid->state)) {
-               memcpy(ssid, &psidid->sid, sizeof(struct cifs_sid));
+               cifs_copy_sid(ssid, &psidid->sid);
                psidid->time = jiffies; /* update ts for accessing */
                goto id_sid_out;
        }
@@ -370,14 +377,14 @@ id_to_sid(unsigned long cid, uint sidtype, struct cifs_sid *ssid)
                if (IS_ERR(sidkey)) {
                        rc = -EINVAL;
                        cFYI(1, "%s: Can't map and id to a SID", __func__);
+               } else if (sidkey->datalen < sizeof(struct cifs_sid)) {
+                       rc = -EIO;
+                       cFYI(1, "%s: Downcall contained malformed key "
+                               "(datalen=%hu)", __func__, sidkey->datalen);
                } else {
                        lsid = (struct cifs_sid *)sidkey->payload.data;
-                       memcpy(&psidid->sid, lsid,
-                               sidkey->datalen < sizeof(struct cifs_sid) ?
-                               sidkey->datalen : sizeof(struct cifs_sid));
-                       memcpy(ssid, &psidid->sid,
-                               sidkey->datalen < sizeof(struct cifs_sid) ?
-                               sidkey->datalen : sizeof(struct cifs_sid));
+                       cifs_copy_sid(&psidid->sid, lsid);
+                       cifs_copy_sid(ssid, &psidid->sid);
                        set_bit(SID_ID_MAPPED, &psidid->state);
                        key_put(sidkey);
                        kfree(psidid->sidstr);
@@ -396,7 +403,7 @@ id_to_sid(unsigned long cid, uint sidtype, struct cifs_sid *ssid)
                        return rc;
                }
                if (test_bit(SID_ID_MAPPED, &psidid->state))
-                       memcpy(ssid, &psidid->sid, sizeof(struct cifs_sid));
+                       cifs_copy_sid(ssid, &psidid->sid);
                else
                        rc = -EINVAL;
        }
@@ -675,8 +682,6 @@ int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid)
 static void copy_sec_desc(const struct cifs_ntsd *pntsd,
                                struct cifs_ntsd *pnntsd, __u32 sidsoffset)
 {
-       int i;
-
        struct cifs_sid *owner_sid_ptr, *group_sid_ptr;
        struct cifs_sid *nowner_sid_ptr, *ngroup_sid_ptr;
 
@@ -692,26 +697,14 @@ static void copy_sec_desc(const struct cifs_ntsd *pntsd,
        owner_sid_ptr = (struct cifs_sid *)((char *)pntsd +
                                le32_to_cpu(pntsd->osidoffset));
        nowner_sid_ptr = (struct cifs_sid *)((char *)pnntsd + sidsoffset);
-
-       nowner_sid_ptr->revision = owner_sid_ptr->revision;
-       nowner_sid_ptr->num_subauth = owner_sid_ptr->num_subauth;
-       for (i = 0; i < 6; i++)
-               nowner_sid_ptr->authority[i] = owner_sid_ptr->authority[i];
-       for (i = 0; i < 5; i++)
-               nowner_sid_ptr->sub_auth[i] = owner_sid_ptr->sub_auth[i];
+       cifs_copy_sid(nowner_sid_ptr, owner_sid_ptr);
 
        /* copy group sid */
        group_sid_ptr = (struct cifs_sid *)((char *)pntsd +
                                le32_to_cpu(pntsd->gsidoffset));
        ngroup_sid_ptr = (struct cifs_sid *)((char *)pnntsd + sidsoffset +
                                        sizeof(struct cifs_sid));
-
-       ngroup_sid_ptr->revision = group_sid_ptr->revision;
-       ngroup_sid_ptr->num_subauth = group_sid_ptr->num_subauth;
-       for (i = 0; i < 6; i++)
-               ngroup_sid_ptr->authority[i] = group_sid_ptr->authority[i];
-       for (i = 0; i < 5; i++)
-               ngroup_sid_ptr->sub_auth[i] = group_sid_ptr->sub_auth[i];
+       cifs_copy_sid(ngroup_sid_ptr, group_sid_ptr);
 
        return;
 }
@@ -1120,8 +1113,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
                                kfree(nowner_sid_ptr);
                                return rc;
                        }
-                       memcpy(owner_sid_ptr, nowner_sid_ptr,
-                                       sizeof(struct cifs_sid));
+                       cifs_copy_sid(owner_sid_ptr, nowner_sid_ptr);
                        kfree(nowner_sid_ptr);
                        *aclflag = CIFS_ACL_OWNER;
                }
@@ -1139,8 +1131,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
                                kfree(ngroup_sid_ptr);
                                return rc;
                        }
-                       memcpy(group_sid_ptr, ngroup_sid_ptr,
-                                       sizeof(struct cifs_sid));
+                       cifs_copy_sid(group_sid_ptr, ngroup_sid_ptr);
                        kfree(ngroup_sid_ptr);
                        *aclflag = CIFS_ACL_GROUP;
                }
index 7c0a8128364546111322b4a89caef9009a276980..d3671f2acb29bd313779cf8022efe4c41e9987ef 100644 (file)
@@ -398,7 +398,16 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry,
         * in network traffic in the other paths.
         */
        if (!(oflags & O_CREAT)) {
-               struct dentry *res = cifs_lookup(inode, direntry, 0);
+               struct dentry *res;
+
+               /*
+                * Check for hashed negative dentry. We have already revalidated
+                * the dentry and it is fine. No need to perform another lookup.
+                */
+               if (!d_unhashed(direntry))
+                       return -ENOENT;
+
+               res = cifs_lookup(inode, direntry, 0);
                if (IS_ERR(res))
                        return PTR_ERR(res);
 
index 14afbabe65464e226549894404ec1af9d1a3f747..472e6befc54d3640d4ca8f7b3a6458aeb7eddce6 100644 (file)
@@ -545,37 +545,38 @@ void devpts_kill_index(struct inode *ptmx_inode, int idx)
        mutex_unlock(&allocated_ptys_lock);
 }
 
-int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
+/**
+ * devpts_pty_new -- create a new inode in /dev/pts/
+ * @ptmx_inode: inode of the master
+ * @device: major+minor of the node to be created
+ * @index: used as a name of the node
+ * @priv: what's given back by devpts_get_priv
+ *
+ * The created inode is returned. Remove it from /dev/pts/ by devpts_pty_kill.
+ */
+struct inode *devpts_pty_new(struct inode *ptmx_inode, dev_t device, int index,
+               void *priv)
 {
-       /* tty layer puts index from devpts_new_index() in here */
-       int number = tty->index;
-       struct tty_driver *driver = tty->driver;
-       dev_t device = MKDEV(driver->major, driver->minor_start+number);
        struct dentry *dentry;
        struct super_block *sb = pts_sb_from_inode(ptmx_inode);
-       struct inode *inode = new_inode(sb);
+       struct inode *inode;
        struct dentry *root = sb->s_root;
        struct pts_fs_info *fsi = DEVPTS_SB(sb);
        struct pts_mount_opts *opts = &fsi->mount_opts;
-       int ret = 0;
        char s[12];
 
-       /* We're supposed to be given the slave end of a pty */
-       BUG_ON(driver->type != TTY_DRIVER_TYPE_PTY);
-       BUG_ON(driver->subtype != PTY_TYPE_SLAVE);
-
+       inode = new_inode(sb);
        if (!inode)
-               return -ENOMEM;
+               return ERR_PTR(-ENOMEM);
 
-       inode->i_ino = number + 3;
+       inode->i_ino = index + 3;
        inode->i_uid = opts->setuid ? opts->uid : current_fsuid();
        inode->i_gid = opts->setgid ? opts->gid : current_fsgid();
        inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
        init_special_inode(inode, S_IFCHR|opts->mode, device);
-       inode->i_private = tty;
-       tty->driver_data = inode;
+       inode->i_private = priv;
 
-       sprintf(s, "%d", number);
+       sprintf(s, "%d", index);
 
        mutex_lock(&root->d_inode->i_mutex);
 
@@ -585,18 +586,24 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
                fsnotify_create(root->d_inode, dentry);
        } else {
                iput(inode);
-               ret = -ENOMEM;
+               inode = ERR_PTR(-ENOMEM);
        }
 
        mutex_unlock(&root->d_inode->i_mutex);
 
-       return ret;
+       return inode;
 }
 
-struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number)
+/**
+ * devpts_get_priv -- get private data for a slave
+ * @pts_inode: inode of the slave
+ *
+ * Returns whatever was passed as priv in devpts_pty_new for a given inode.
+ */
+void *devpts_get_priv(struct inode *pts_inode)
 {
        struct dentry *dentry;
-       struct tty_struct *tty;
+       void *priv = NULL;
 
        BUG_ON(pts_inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR));
 
@@ -605,18 +612,22 @@ struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number)
        if (!dentry)
                return NULL;
 
-       tty = NULL;
        if (pts_inode->i_sb->s_magic == DEVPTS_SUPER_MAGIC)
-               tty = (struct tty_struct *)pts_inode->i_private;
+               priv = pts_inode->i_private;
 
        dput(dentry);
 
-       return tty;
+       return priv;
 }
 
-void devpts_pty_kill(struct tty_struct *tty)
+/**
+ * devpts_pty_kill -- remove inode form /dev/pts/
+ * @inode: inode of the slave to be removed
+ *
+ * This is an inverse operation of devpts_pty_new.
+ */
+void devpts_pty_kill(struct inode *inode)
 {
-       struct inode *inode = tty->driver_data;
        struct super_block *sb = pts_sb_from_inode(inode);
        struct dentry *root = sb->s_root;
        struct dentry *dentry;
index da72250ddc1cf2331336a23cbe8239bf880a10cf..cd96649bfe62da9e408dbd629f56f6452c139bc9 100644 (file)
@@ -346,7 +346,7 @@ static inline struct epitem *ep_item_from_epqueue(poll_table *p)
 /* Tells if the epoll_ctl(2) operation needs an event copy from userspace */
 static inline int ep_op_has_event(int op)
 {
-       return op == EPOLL_CTL_ADD || op == EPOLL_CTL_MOD;
+       return op != EPOLL_CTL_DEL;
 }
 
 /* Initialize the poll safe wake up structure */
@@ -676,34 +676,6 @@ static int ep_remove(struct eventpoll *ep, struct epitem *epi)
        return 0;
 }
 
-/*
- * Disables a "struct epitem" in the eventpoll set. Returns -EBUSY if the item
- * had no event flags set, indicating that another thread may be currently
- * handling that item's events (in the case that EPOLLONESHOT was being
- * used). Otherwise a zero result indicates that the item has been disabled
- * from receiving events. A disabled item may be re-enabled via
- * EPOLL_CTL_MOD. Must be called with "mtx" held.
- */
-static int ep_disable(struct eventpoll *ep, struct epitem *epi)
-{
-       int result = 0;
-       unsigned long flags;
-
-       spin_lock_irqsave(&ep->lock, flags);
-       if (epi->event.events & ~EP_PRIVATE_BITS) {
-               if (ep_is_linked(&epi->rdllink))
-                       list_del_init(&epi->rdllink);
-               /* Ensure ep_poll_callback will not add epi back onto ready
-                  list: */
-               epi->event.events &= EP_PRIVATE_BITS;
-               }
-       else
-               result = -EBUSY;
-       spin_unlock_irqrestore(&ep->lock, flags);
-
-       return result;
-}
-
 static void ep_free(struct eventpoll *ep)
 {
        struct rb_node *rbp;
@@ -1048,6 +1020,8 @@ static void ep_rbtree_insert(struct eventpoll *ep, struct epitem *epi)
        rb_insert_color(&epi->rbn, &ep->rbr);
 }
 
+
+
 #define PATH_ARR_SIZE 5
 /*
  * These are the number paths of length 1 to 5, that we are allowing to emanate
@@ -1813,12 +1787,6 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
                } else
                        error = -ENOENT;
                break;
-       case EPOLL_CTL_DISABLE:
-               if (epi)
-                       error = ep_disable(ep, epi);
-               else
-                       error = -ENOENT;
-               break;
        }
        mutex_unlock(&ep->mtx);
 
index 4facdd29a350f1d8250d17373e94c44a393ab78f..3a100e7a62a8343d31912a423330e11ea40e2e2a 100644 (file)
@@ -725,6 +725,10 @@ repeat_in_this_group:
                                   "inode=%lu", ino + 1);
                        continue;
                }
+               BUFFER_TRACE(inode_bitmap_bh, "get_write_access");
+               err = ext4_journal_get_write_access(handle, inode_bitmap_bh);
+               if (err)
+                       goto fail;
                ext4_lock_group(sb, group);
                ret2 = ext4_test_and_set_bit(ino, inode_bitmap_bh->b_data);
                ext4_unlock_group(sb, group);
@@ -738,6 +742,11 @@ repeat_in_this_group:
        goto out;
 
 got:
+       BUFFER_TRACE(inode_bitmap_bh, "call ext4_handle_dirty_metadata");
+       err = ext4_handle_dirty_metadata(handle, NULL, inode_bitmap_bh);
+       if (err)
+               goto fail;
+
        /* We may have to initialize the block bitmap if it isn't already */
        if (ext4_has_group_desc_csum(sb) &&
            gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
@@ -771,11 +780,6 @@ got:
                        goto fail;
        }
 
-       BUFFER_TRACE(inode_bitmap_bh, "get_write_access");
-       err = ext4_journal_get_write_access(handle, inode_bitmap_bh);
-       if (err)
-               goto fail;
-
        BUFFER_TRACE(group_desc_bh, "get_write_access");
        err = ext4_journal_get_write_access(handle, group_desc_bh);
        if (err)
@@ -823,11 +827,6 @@ got:
        }
        ext4_unlock_group(sb, group);
 
-       BUFFER_TRACE(inode_bitmap_bh, "call ext4_handle_dirty_metadata");
-       err = ext4_handle_dirty_metadata(handle, NULL, inode_bitmap_bh);
-       if (err)
-               goto fail;
-
        BUFFER_TRACE(group_desc_bh, "call ext4_handle_dirty_metadata");
        err = ext4_handle_dirty_metadata(handle, NULL, group_desc_bh);
        if (err)
index d3b5fa80b71b76a973919a6b9cfa2ebb34096adf..708d997a77485989d53583084a3e1b99354fb407 100644 (file)
--- a/fs/file.c
+++ b/fs/file.c
@@ -900,7 +900,7 @@ int replace_fd(unsigned fd, struct file *file, unsigned flags)
                return __close_fd(files, fd);
 
        if (fd >= rlimit(RLIMIT_NOFILE))
-               return -EMFILE;
+               return -EBADF;
 
        spin_lock(&files->file_lock);
        err = expand_files(files, fd);
@@ -926,7 +926,7 @@ SYSCALL_DEFINE3(dup3, unsigned int, oldfd, unsigned int, newfd, int, flags)
                return -EINVAL;
 
        if (newfd >= rlimit(RLIMIT_NOFILE))
-               return -EMFILE;
+               return -EBADF;
 
        spin_lock(&files->file_lock);
        err = expand_files(files, newfd);
index 0def0504afc1816ae40b55de02c07aa68cc3a003..e056b4ce487777bbe794d64a11e4cbe2756205d3 100644 (file)
@@ -516,15 +516,13 @@ static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)
                struct gfs2_holder i_gh;
                int error;
 
-               gfs2_holder_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
-               error = gfs2_glock_nq(&i_gh);
-               if (error == 0) {
-                       file_accessed(file);
-                       gfs2_glock_dq(&i_gh);
-               }
-               gfs2_holder_uninit(&i_gh);
+               error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY,
+                                          &i_gh);
                if (error)
                        return error;
+               /* grab lock to update inode */
+               gfs2_glock_dq_uninit(&i_gh);
+               file_accessed(file);
        }
        vma->vm_ops = &gfs2_vm_ops;
 
@@ -677,10 +675,8 @@ static ssize_t gfs2_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
        size_t writesize = iov_length(iov, nr_segs);
        struct dentry *dentry = file->f_dentry;
        struct gfs2_inode *ip = GFS2_I(dentry->d_inode);
-       struct gfs2_sbd *sdp;
        int ret;
 
-       sdp = GFS2_SB(file->f_mapping->host);
        ret = gfs2_rs_alloc(ip);
        if (ret)
                return ret;
index 8ff95a2d54ee7dae3de7a9ad6945b5a6c0f17b13..9ceccb1595a3d6f454dd0818eaea92cc8593114f 100644 (file)
@@ -393,12 +393,10 @@ static void buf_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
        struct gfs2_meta_header *mh;
        struct gfs2_trans *tr;
 
-       lock_buffer(bd->bd_bh);
-       gfs2_log_lock(sdp);
        tr = current->journal_info;
        tr->tr_touched = 1;
        if (!list_empty(&bd->bd_list))
-               goto out;
+               return;
        set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags);
        set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
        mh = (struct gfs2_meta_header *)bd->bd_bh->b_data;
@@ -414,9 +412,6 @@ static void buf_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
        sdp->sd_log_num_buf++;
        list_add(&bd->bd_list, &sdp->sd_log_le_buf);
        tr->tr_num_buf_new++;
-out:
-       gfs2_log_unlock(sdp);
-       unlock_buffer(bd->bd_bh);
 }
 
 static void gfs2_check_magic(struct buffer_head *bh)
@@ -621,7 +616,6 @@ static void revoke_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
 
 static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
 {
-       struct gfs2_log_descriptor *ld;
        struct gfs2_meta_header *mh;
        unsigned int offset;
        struct list_head *head = &sdp->sd_log_le_revoke;
@@ -634,7 +628,6 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
 
        length = gfs2_struct2blk(sdp, sdp->sd_log_num_revoke, sizeof(u64));
        page = gfs2_get_log_desc(sdp, GFS2_LOG_DESC_REVOKE, length, sdp->sd_log_num_revoke);
-       ld = page_address(page);
        offset = sizeof(struct gfs2_log_descriptor);
 
        list_for_each_entry(bd, head, bd_list) {
@@ -777,12 +770,10 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
        struct address_space *mapping = bd->bd_bh->b_page->mapping;
        struct gfs2_inode *ip = GFS2_I(mapping->host);
 
-       lock_buffer(bd->bd_bh);
-       gfs2_log_lock(sdp);
        if (tr)
                tr->tr_touched = 1;
        if (!list_empty(&bd->bd_list))
-               goto out;
+               return;
        set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags);
        set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
        if (gfs2_is_jdata(ip)) {
@@ -793,9 +784,6 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
        } else {
                list_add_tail(&bd->bd_list, &sdp->sd_log_le_ordered);
        }
-out:
-       gfs2_log_unlock(sdp);
-       unlock_buffer(bd->bd_bh);
 }
 
 /**
index 40c4b0d42fa8fea10b73102b4fd7d155ebf8daa0..c5af8e18f27af8a3b0c899ce1fe5404fede93831 100644 (file)
@@ -497,8 +497,11 @@ int gfs2_quota_hold(struct gfs2_inode *ip, u32 uid, u32 gid)
        struct gfs2_quota_data **qd;
        int error;
 
-       if (ip->i_res == NULL)
-               gfs2_rs_alloc(ip);
+       if (ip->i_res == NULL) {
+               error = gfs2_rs_alloc(ip);
+               if (error)
+                       return error;
+       }
 
        qd = ip->i_res->rs_qa_qd;
 
index 3cc402ce6fea6b3957e82646851e9646fa7cd26b..38fe18f2f055af2e5e842573a475e7b6836bb940 100644 (file)
@@ -553,7 +553,6 @@ void gfs2_free_clones(struct gfs2_rgrpd *rgd)
  */
 int gfs2_rs_alloc(struct gfs2_inode *ip)
 {
-       int error = 0;
        struct gfs2_blkreserv *res;
 
        if (ip->i_res)
@@ -561,7 +560,7 @@ int gfs2_rs_alloc(struct gfs2_inode *ip)
 
        res = kmem_cache_zalloc(gfs2_rsrv_cachep, GFP_NOFS);
        if (!res)
-               error = -ENOMEM;
+               return -ENOMEM;
 
        RB_CLEAR_NODE(&res->rs_node);
 
@@ -571,7 +570,7 @@ int gfs2_rs_alloc(struct gfs2_inode *ip)
        else
                ip->i_res = res;
        up_write(&ip->i_rw_mutex);
-       return error;
+       return 0;
 }
 
 static void dump_rs(struct seq_file *seq, const struct gfs2_blkreserv *rs)
@@ -1263,7 +1262,9 @@ int gfs2_fitrim(struct file *filp, void __user *argp)
        int ret = 0;
        u64 amt;
        u64 trimmed = 0;
+       u64 start, end, minlen;
        unsigned int x;
+       unsigned bs_shift = sdp->sd_sb.sb_bsize_shift;
 
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
@@ -1271,19 +1272,25 @@ int gfs2_fitrim(struct file *filp, void __user *argp)
        if (!blk_queue_discard(q))
                return -EOPNOTSUPP;
 
-       if (argp == NULL) {
-               r.start = 0;
-               r.len = ULLONG_MAX;
-               r.minlen = 0;
-       } else if (copy_from_user(&r, argp, sizeof(r)))
+       if (copy_from_user(&r, argp, sizeof(r)))
                return -EFAULT;
 
        ret = gfs2_rindex_update(sdp);
        if (ret)
                return ret;
 
-       rgd = gfs2_blk2rgrpd(sdp, r.start, 0);
-       rgd_end = gfs2_blk2rgrpd(sdp, r.start + r.len, 0);
+       start = r.start >> bs_shift;
+       end = start + (r.len >> bs_shift);
+       minlen = max_t(u64, r.minlen,
+                      q->limits.discard_granularity) >> bs_shift;
+
+       rgd = gfs2_blk2rgrpd(sdp, start, 0);
+       rgd_end = gfs2_blk2rgrpd(sdp, end - 1, 0);
+
+       if (end <= start ||
+           minlen > sdp->sd_max_rg_data ||
+           start > rgd_end->rd_data0 + rgd_end->rd_data)
+               return -EINVAL;
 
        while (1) {
 
@@ -1295,7 +1302,9 @@ int gfs2_fitrim(struct file *filp, void __user *argp)
                        /* Trim each bitmap in the rgrp */
                        for (x = 0; x < rgd->rd_length; x++) {
                                struct gfs2_bitmap *bi = rgd->rd_bits + x;
-                               ret = gfs2_rgrp_send_discards(sdp, rgd->rd_data0, NULL, bi, r.minlen, &amt);
+                               ret = gfs2_rgrp_send_discards(sdp,
+                                               rgd->rd_data0, NULL, bi, minlen,
+                                               &amt);
                                if (ret) {
                                        gfs2_glock_dq_uninit(&gh);
                                        goto out;
@@ -1324,7 +1333,7 @@ int gfs2_fitrim(struct file *filp, void __user *argp)
 
 out:
        r.len = trimmed << 9;
-       if (argp && copy_to_user(argp, &r, sizeof(r)))
+       if (copy_to_user(argp, &r, sizeof(r)))
                return -EFAULT;
 
        return ret;
index bc737261f234872ad2df43411e6e74296b26b61c..d6488674d916273398b0bf8bd9cd3b2328c8a1fb 100644 (file)
@@ -810,7 +810,8 @@ static void gfs2_dirty_inode(struct inode *inode, int flags)
                        return;
                }
                need_unlock = 1;
-       }
+       } else if (WARN_ON_ONCE(ip->i_gl->gl_state != LM_ST_EXCLUSIVE))
+               return;
 
        if (current->journal_info == NULL) {
                ret = gfs2_trans_begin(sdp, RES_DINODE, 0);
index adbd27875ef957e5b54846d8494865d51ff156be..413627072f368168814f0df6ba340103c45f9e10 100644 (file)
@@ -155,14 +155,22 @@ void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta)
        struct gfs2_sbd *sdp = gl->gl_sbd;
        struct gfs2_bufdata *bd;
 
+       lock_buffer(bh);
+       gfs2_log_lock(sdp);
        bd = bh->b_private;
        if (bd)
                gfs2_assert(sdp, bd->bd_gl == gl);
        else {
+               gfs2_log_unlock(sdp);
+               unlock_buffer(bh);
                gfs2_attach_bufdata(gl, bh, meta);
                bd = bh->b_private;
+               lock_buffer(bh);
+               gfs2_log_lock(sdp);
        }
        lops_add(sdp, bd);
+       gfs2_log_unlock(sdp);
+       unlock_buffer(bh);
 }
 
 void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
index 31c26c4dcc238110de0fa7374f1a2ab51a1541cd..ca4b11ec87a292e92e5d9496f8ac194d97a5bf9f 100644 (file)
@@ -217,7 +217,7 @@ static int nfs_dns_parse(struct cache_detail *cd, char *buf, int buflen)
 {
        char buf1[NFS_DNS_HOSTNAME_MAXLEN+1];
        struct nfs_dns_ent key, *item;
-       unsigned long ttl;
+       unsigned int ttl;
        ssize_t len;
        int ret = -EINVAL;
 
@@ -240,7 +240,8 @@ static int nfs_dns_parse(struct cache_detail *cd, char *buf, int buflen)
        key.namelen = len;
        memset(&key.h, 0, sizeof(key.h));
 
-       ttl = get_expiry(&buf);
+       if (get_uint(&buf, &ttl) < 0)
+               goto out;
        if (ttl == 0)
                goto out;
        key.h.expiry_time = ttl + seconds_since_boot();
index 5c7325c5c5e66b23beacd6fb7485fda5a640dcd9..6fa01aea24889cae08385e5bfe0aab16c742adc8 100644 (file)
@@ -685,7 +685,10 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync)
        if (ctx->cred != NULL)
                put_rpccred(ctx->cred);
        dput(ctx->dentry);
-       nfs_sb_deactive(sb);
+       if (is_sync)
+               nfs_sb_deactive(sb);
+       else
+               nfs_sb_deactive_async(sb);
        kfree(ctx->mdsthreshold);
        kfree(ctx);
 }
index 59b133c5d652df5d2397b1e24e22f390fed459fc..05521cadac2e9821292c8c4eeefa037f5ef0a726 100644 (file)
@@ -351,10 +351,12 @@ extern int __init register_nfs_fs(void);
 extern void __exit unregister_nfs_fs(void);
 extern void nfs_sb_active(struct super_block *sb);
 extern void nfs_sb_deactive(struct super_block *sb);
+extern void nfs_sb_deactive_async(struct super_block *sb);
 
 /* namespace.c */
+#define NFS_PATH_CANONICAL 1
 extern char *nfs_path(char **p, struct dentry *dentry,
-                     char *buffer, ssize_t buflen);
+                     char *buffer, ssize_t buflen, unsigned flags);
 extern struct vfsmount *nfs_d_automount(struct path *path);
 struct vfsmount *nfs_submount(struct nfs_server *, struct dentry *,
                              struct nfs_fh *, struct nfs_fattr *);
@@ -498,7 +500,7 @@ static inline char *nfs_devname(struct dentry *dentry,
                                char *buffer, ssize_t buflen)
 {
        char *dummy;
-       return nfs_path(&dummy, dentry, buffer, buflen);
+       return nfs_path(&dummy, dentry, buffer, buflen, NFS_PATH_CANONICAL);
 }
 
 /*
index 8e65c7f1f87c526707959c0e691e36532406d1fa..015f71f8f62c271ebcd6c6ec3949aeff446ce420 100644 (file)
@@ -181,7 +181,7 @@ int nfs_mount(struct nfs_mount_request *info)
        else
                msg.rpc_proc = &mnt_clnt->cl_procinfo[MOUNTPROC_MNT];
 
-       status = rpc_call_sync(mnt_clnt, &msg, 0);
+       status = rpc_call_sync(mnt_clnt, &msg, RPC_TASK_SOFT|RPC_TASK_TIMEOUT);
        rpc_shutdown_client(mnt_clnt);
 
        if (status < 0)
index 655925373b9161c6a6c64ad157002d10cf8064e2..dd057bc6b65b28d3822229e0c0d5d0777b7955b9 100644 (file)
@@ -33,6 +33,7 @@ int nfs_mountpoint_expiry_timeout = 500 * HZ;
  * @dentry - pointer to dentry
  * @buffer - result buffer
  * @buflen - length of buffer
+ * @flags - options (see below)
  *
  * Helper function for constructing the server pathname
  * by arbitrary hashed dentry.
@@ -40,8 +41,14 @@ int nfs_mountpoint_expiry_timeout = 500 * HZ;
  * This is mainly for use in figuring out the path on the
  * server side when automounting on top of an existing partition
  * and in generating /proc/mounts and friends.
+ *
+ * Supported flags:
+ * NFS_PATH_CANONICAL: ensure there is exactly one slash after
+ *                    the original device (export) name
+ *                    (if unset, the original name is returned verbatim)
  */
-char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen)
+char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen,
+              unsigned flags)
 {
        char *end;
        int namelen;
@@ -74,7 +81,7 @@ rename_retry:
                rcu_read_unlock();
                goto rename_retry;
        }
-       if (*end != '/') {
+       if ((flags & NFS_PATH_CANONICAL) && *end != '/') {
                if (--buflen < 0) {
                        spin_unlock(&dentry->d_lock);
                        rcu_read_unlock();
@@ -91,9 +98,11 @@ rename_retry:
                return end;
        }
        namelen = strlen(base);
-       /* Strip off excess slashes in base string */
-       while (namelen > 0 && base[namelen - 1] == '/')
-               namelen--;
+       if (flags & NFS_PATH_CANONICAL) {
+               /* Strip off excess slashes in base string */
+               while (namelen > 0 && base[namelen - 1] == '/')
+                       namelen--;
+       }
        buflen -= namelen;
        if (buflen < 0) {
                spin_unlock(&dentry->d_lock);
index 79fbb61ce202bcb90df2c8ad0f7f3ecf3bba7aac..1e09eb78543b2d50f9da025c733e52a99957ba64 100644 (file)
@@ -81,7 +81,8 @@ static char *nfs_path_component(const char *nfspath, const char *end)
 static char *nfs4_path(struct dentry *dentry, char *buffer, ssize_t buflen)
 {
        char *limit;
-       char *path = nfs_path(&limit, dentry, buffer, buflen);
+       char *path = nfs_path(&limit, dentry, buffer, buflen,
+                             NFS_PATH_CANONICAL);
        if (!IS_ERR(path)) {
                char *path_component = nfs_path_component(path, limit);
                if (path_component)
index 68b21d81b7acfa79bef010023195c1f45023c82b..5eec4429970c6e98af7a18732794c6fceaba4951 100644 (file)
@@ -339,8 +339,7 @@ static int nfs4_handle_exception(struct nfs_server *server, int errorcode, struc
                        dprintk("%s ERROR: %d Reset session\n", __func__,
                                errorcode);
                        nfs4_schedule_session_recovery(clp->cl_session, errorcode);
-                       exception->retry = 1;
-                       break;
+                       goto wait_on_recovery;
 #endif /* defined(CONFIG_NFS_V4_1) */
                case -NFS4ERR_FILE_OPEN:
                        if (exception->timeout > HZ) {
@@ -1572,9 +1571,11 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata)
        data->timestamp = jiffies;
        if (nfs4_setup_sequence(data->o_arg.server,
                                &data->o_arg.seq_args,
-                               &data->o_res.seq_res, task))
-               return;
-       rpc_call_start(task);
+                               &data->o_res.seq_res,
+                               task) != 0)
+               nfs_release_seqid(data->o_arg.seqid);
+       else
+               rpc_call_start(task);
        return;
 unlock_no_action:
        rcu_read_unlock();
@@ -1748,7 +1749,7 @@ static int nfs4_opendata_access(struct rpc_cred *cred,
 
        /* even though OPEN succeeded, access is denied. Close the file */
        nfs4_close_state(state, fmode);
-       return -NFS4ERR_ACCESS;
+       return -EACCES;
 }
 
 /*
@@ -2196,7 +2197,7 @@ static void nfs4_free_closedata(void *data)
        nfs4_put_open_state(calldata->state);
        nfs_free_seqid(calldata->arg.seqid);
        nfs4_put_state_owner(sp);
-       nfs_sb_deactive(sb);
+       nfs_sb_deactive_async(sb);
        kfree(calldata);
 }
 
@@ -2296,9 +2297,10 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
        if (nfs4_setup_sequence(NFS_SERVER(inode),
                                &calldata->arg.seq_args,
                                &calldata->res.seq_res,
-                               task))
-               goto out;
-       rpc_call_start(task);
+                               task) != 0)
+               nfs_release_seqid(calldata->arg.seqid);
+       else
+               rpc_call_start(task);
 out:
        dprintk("%s: done!\n", __func__);
 }
@@ -4529,6 +4531,7 @@ static void nfs4_locku_done(struct rpc_task *task, void *data)
                        if (nfs4_async_handle_error(task, calldata->server, NULL) == -EAGAIN)
                                rpc_restart_call_prepare(task);
        }
+       nfs_release_seqid(calldata->arg.seqid);
 }
 
 static void nfs4_locku_prepare(struct rpc_task *task, void *data)
@@ -4545,9 +4548,11 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data)
        calldata->timestamp = jiffies;
        if (nfs4_setup_sequence(calldata->server,
                                &calldata->arg.seq_args,
-                               &calldata->res.seq_res, task))
-               return;
-       rpc_call_start(task);
+                               &calldata->res.seq_res,
+                               task) != 0)
+               nfs_release_seqid(calldata->arg.seqid);
+       else
+               rpc_call_start(task);
 }
 
 static const struct rpc_call_ops nfs4_locku_ops = {
@@ -4692,7 +4697,7 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata)
        /* Do we need to do an open_to_lock_owner? */
        if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) {
                if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0)
-                       return;
+                       goto out_release_lock_seqid;
                data->arg.open_stateid = &state->stateid;
                data->arg.new_lock_owner = 1;
                data->res.open_seqid = data->arg.open_seqid;
@@ -4701,10 +4706,15 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata)
        data->timestamp = jiffies;
        if (nfs4_setup_sequence(data->server,
                                &data->arg.seq_args,
-                               &data->res.seq_res, task))
+                               &data->res.seq_res,
+                               task) == 0) {
+               rpc_call_start(task);
                return;
-       rpc_call_start(task);
-       dprintk("%s: done!, ret = %d\n", __func__, data->rpc_status);
+       }
+       nfs_release_seqid(data->arg.open_seqid);
+out_release_lock_seqid:
+       nfs_release_seqid(data->arg.lock_seqid);
+       dprintk("%s: done!, ret = %d\n", __func__, task->tk_status);
 }
 
 static void nfs4_recover_lock_prepare(struct rpc_task *task, void *calldata)
@@ -5667,7 +5677,7 @@ static void nfs4_add_and_init_slots(struct nfs4_slot_table *tbl,
                tbl->slots = new;
                tbl->max_slots = max_slots;
        }
-       tbl->highest_used_slotid = -1;  /* no slot is currently used */
+       tbl->highest_used_slotid = NFS4_NO_SLOT;
        for (i = 0; i < tbl->max_slots; i++)
                tbl->slots[i].seq_nr = ivalue;
        spin_unlock(&tbl->slot_tbl_lock);
index fe624c91bd006ef11f839f61cab54f833286edfa..2878f97bd78d5cf5343b88cfcac9b5a48a1abe60 100644 (file)
@@ -925,8 +925,8 @@ pnfs_find_alloc_layout(struct inode *ino,
        if (likely(nfsi->layout == NULL)) {     /* Won the race? */
                nfsi->layout = new;
                return new;
-       }
-       pnfs_free_layout_hdr(new);
+       } else if (new != NULL)
+               pnfs_free_layout_hdr(new);
 out_existing:
        pnfs_get_layout_hdr(nfsi->layout);
        return nfsi->layout;
index e831bce497663e809e48bb7cc278f5ad6a74ba7b..652d3f7176a98fcc4e70e6f5e3d812e4b3d90b83 100644 (file)
@@ -54,6 +54,7 @@
 #include <linux/parser.h>
 #include <linux/nsproxy.h>
 #include <linux/rcupdate.h>
+#include <linux/kthread.h>
 
 #include <asm/uaccess.h>
 
@@ -415,6 +416,54 @@ void nfs_sb_deactive(struct super_block *sb)
 }
 EXPORT_SYMBOL_GPL(nfs_sb_deactive);
 
+static int nfs_deactivate_super_async_work(void *ptr)
+{
+       struct super_block *sb = ptr;
+
+       deactivate_super(sb);
+       module_put_and_exit(0);
+       return 0;
+}
+
+/*
+ * same effect as deactivate_super, but will do final unmount in kthread
+ * context
+ */
+static void nfs_deactivate_super_async(struct super_block *sb)
+{
+       struct task_struct *task;
+       char buf[INET6_ADDRSTRLEN + 1];
+       struct nfs_server *server = NFS_SB(sb);
+       struct nfs_client *clp = server->nfs_client;
+
+       if (!atomic_add_unless(&sb->s_active, -1, 1)) {
+               rcu_read_lock();
+               snprintf(buf, sizeof(buf),
+                       rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR));
+               rcu_read_unlock();
+
+               __module_get(THIS_MODULE);
+               task = kthread_run(nfs_deactivate_super_async_work, sb,
+                               "%s-deactivate-super", buf);
+               if (IS_ERR(task)) {
+                       pr_err("%s: kthread_run: %ld\n",
+                               __func__, PTR_ERR(task));
+                       /* make synchronous call and hope for the best */
+                       deactivate_super(sb);
+                       module_put(THIS_MODULE);
+               }
+       }
+}
+
+void nfs_sb_deactive_async(struct super_block *sb)
+{
+       struct nfs_server *server = NFS_SB(sb);
+
+       if (atomic_dec_and_test(&server->active))
+               nfs_deactivate_super_async(sb);
+}
+EXPORT_SYMBOL_GPL(nfs_sb_deactive_async);
+
 /*
  * Deliver file system statistics to userspace
  */
@@ -771,7 +820,7 @@ int nfs_show_devname(struct seq_file *m, struct dentry *root)
        int err = 0;
        if (!page)
                return -ENOMEM;
-       devname = nfs_path(&dummy, root, page, PAGE_SIZE);
+       devname = nfs_path(&dummy, root, page, PAGE_SIZE, 0);
        if (IS_ERR(devname))
                err = PTR_ERR(devname);
        else
index 13cea637eff82288f2f5508023a592e60db3fa7a..3f79c77153b8fe827cd24310209301e0132b96ad 100644 (file)
@@ -95,7 +95,7 @@ static void nfs_async_unlink_release(void *calldata)
 
        nfs_dec_sillycount(data->dir);
        nfs_free_unlinkdata(data);
-       nfs_sb_deactive(sb);
+       nfs_sb_deactive_async(sb);
 }
 
 static void nfs_unlink_prepare(struct rpc_task *task, void *calldata)
index f35794b97e8e5cb5cc396af28206d69ca1202935..a50636025364214176fe7cec0cb80757ddc27171 100644 (file)
@@ -21,6 +21,7 @@ static bool should_merge(struct fsnotify_event *old, struct fsnotify_event *new)
                        if ((old->path.mnt == new->path.mnt) &&
                            (old->path.dentry == new->path.dentry))
                                return true;
+                       break;
                case (FSNOTIFY_EVENT_NONE):
                        return true;
                default:
index 4f33c32affe3d2eb4bec9c5ca8d71a33bbc5032a..335206a9c6985fde106d164543efee515bba1433 100644 (file)
@@ -1866,6 +1866,7 @@ xfs_alloc_fix_freelist(
        /*
         * Initialize the args structure.
         */
+       memset(&targs, 0, sizeof(targs));
        targs.tp = tp;
        targs.mp = mp;
        targs.agbp = agbp;
@@ -2207,7 +2208,7 @@ xfs_alloc_read_agf(
  * group or loop over the allocation groups to find the result.
  */
 int                            /* error */
-__xfs_alloc_vextent(
+xfs_alloc_vextent(
        xfs_alloc_arg_t *args)  /* allocation argument structure */
 {
        xfs_agblock_t   agsize; /* allocation group size */
@@ -2417,46 +2418,6 @@ error0:
        return error;
 }
 
-static void
-xfs_alloc_vextent_worker(
-       struct work_struct      *work)
-{
-       struct xfs_alloc_arg    *args = container_of(work,
-                                               struct xfs_alloc_arg, work);
-       unsigned long           pflags;
-
-       /* we are in a transaction context here */
-       current_set_flags_nested(&pflags, PF_FSTRANS);
-
-       args->result = __xfs_alloc_vextent(args);
-       complete(args->done);
-
-       current_restore_flags_nested(&pflags, PF_FSTRANS);
-}
-
-/*
- * Data allocation requests often come in with little stack to work on. Push
- * them off to a worker thread so there is lots of stack to use. Metadata
- * requests, OTOH, are generally from low stack usage paths, so avoid the
- * context switch overhead here.
- */
-int
-xfs_alloc_vextent(
-       struct xfs_alloc_arg    *args)
-{
-       DECLARE_COMPLETION_ONSTACK(done);
-
-       if (!args->userdata)
-               return __xfs_alloc_vextent(args);
-
-
-       args->done = &done;
-       INIT_WORK_ONSTACK(&args->work, xfs_alloc_vextent_worker);
-       queue_work(xfs_alloc_wq, &args->work);
-       wait_for_completion(&done);
-       return args->result;
-}
-
 /*
  * Free an extent.
  * Just break up the extent address and hand off to xfs_free_ag_extent
index 93be4a667ca1692648aec03195b5747bac4239f2..feacb061bab78bb3492ee0ff37eed5cc0fb95894 100644 (file)
@@ -120,9 +120,6 @@ typedef struct xfs_alloc_arg {
        char            isfl;           /* set if is freelist blocks - !acctg */
        char            userdata;       /* set if this is user data */
        xfs_fsblock_t   firstblock;     /* io first block allocated */
-       struct completion *done;
-       struct work_struct work;
-       int             result;
 } xfs_alloc_arg_t;
 
 /*
index f1647caace8fe66eeda2bd51cf5e679028d7b50e..f7876c6d616553d222295624a20f4c168c4c021d 100644 (file)
@@ -121,6 +121,8 @@ xfs_allocbt_free_block(
        xfs_extent_busy_insert(cur->bc_tp, be32_to_cpu(agf->agf_seqno), bno, 1,
                              XFS_EXTENT_BUSY_SKIP_DISCARD);
        xfs_trans_agbtree_delta(cur->bc_tp, -1);
+
+       xfs_trans_binval(cur->bc_tp, bp);
        return 0;
 }
 
index 848ffa77707b98bf272f61fc162f6e361504926e..83d0cf3df930794c307c4adcb33dceb8a5415f7e 100644 (file)
@@ -2437,6 +2437,7 @@ xfs_bmap_btalloc(
         * Normal allocation, done through xfs_alloc_vextent.
         */
        tryagain = isaligned = 0;
+       memset(&args, 0, sizeof(args));
        args.tp = ap->tp;
        args.mp = mp;
        args.fsbno = ap->blkno;
@@ -3082,6 +3083,7 @@ xfs_bmap_extents_to_btree(
         * Convert to a btree with two levels, one record in root.
         */
        XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_BTREE);
+       memset(&args, 0, sizeof(args));
        args.tp = tp;
        args.mp = mp;
        args.firstblock = *firstblock;
@@ -3237,6 +3239,7 @@ xfs_bmap_local_to_extents(
                xfs_buf_t       *bp;    /* buffer for extent block */
                xfs_bmbt_rec_host_t *ep;/* extent record pointer */
 
+               memset(&args, 0, sizeof(args));
                args.tp = tp;
                args.mp = ip->i_mount;
                args.firstblock = *firstblock;
@@ -4616,12 +4619,11 @@ xfs_bmapi_delay(
 
 
 STATIC int
-xfs_bmapi_allocate(
-       struct xfs_bmalloca     *bma,
-       int                     flags)
+__xfs_bmapi_allocate(
+       struct xfs_bmalloca     *bma)
 {
        struct xfs_mount        *mp = bma->ip->i_mount;
-       int                     whichfork = (flags & XFS_BMAPI_ATTRFORK) ?
+       int                     whichfork = (bma->flags & XFS_BMAPI_ATTRFORK) ?
                                                XFS_ATTR_FORK : XFS_DATA_FORK;
        struct xfs_ifork        *ifp = XFS_IFORK_PTR(bma->ip, whichfork);
        int                     tmp_logflags = 0;
@@ -4654,24 +4656,27 @@ xfs_bmapi_allocate(
         * Indicate if this is the first user data in the file, or just any
         * user data.
         */
-       if (!(flags & XFS_BMAPI_METADATA)) {
+       if (!(bma->flags & XFS_BMAPI_METADATA)) {
                bma->userdata = (bma->offset == 0) ?
                        XFS_ALLOC_INITIAL_USER_DATA : XFS_ALLOC_USERDATA;
        }
 
-       bma->minlen = (flags & XFS_BMAPI_CONTIG) ? bma->length : 1;
+       bma->minlen = (bma->flags & XFS_BMAPI_CONTIG) ? bma->length : 1;
 
        /*
         * Only want to do the alignment at the eof if it is userdata and
         * allocation length is larger than a stripe unit.
         */
        if (mp->m_dalign && bma->length >= mp->m_dalign &&
-           !(flags & XFS_BMAPI_METADATA) && whichfork == XFS_DATA_FORK) {
+           !(bma->flags & XFS_BMAPI_METADATA) && whichfork == XFS_DATA_FORK) {
                error = xfs_bmap_isaeof(bma, whichfork);
                if (error)
                        return error;
        }
 
+       if (bma->flags & XFS_BMAPI_STACK_SWITCH)
+               bma->stack_switch = 1;
+
        error = xfs_bmap_alloc(bma);
        if (error)
                return error;
@@ -4706,7 +4711,7 @@ xfs_bmapi_allocate(
         * A wasdelay extent has been initialized, so shouldn't be flagged
         * as unwritten.
         */
-       if (!bma->wasdel && (flags & XFS_BMAPI_PREALLOC) &&
+       if (!bma->wasdel && (bma->flags & XFS_BMAPI_PREALLOC) &&
            xfs_sb_version_hasextflgbit(&mp->m_sb))
                bma->got.br_state = XFS_EXT_UNWRITTEN;
 
@@ -4734,6 +4739,45 @@ xfs_bmapi_allocate(
        return 0;
 }
 
+static void
+xfs_bmapi_allocate_worker(
+       struct work_struct      *work)
+{
+       struct xfs_bmalloca     *args = container_of(work,
+                                               struct xfs_bmalloca, work);
+       unsigned long           pflags;
+
+       /* we are in a transaction context here */
+       current_set_flags_nested(&pflags, PF_FSTRANS);
+
+       args->result = __xfs_bmapi_allocate(args);
+       complete(args->done);
+
+       current_restore_flags_nested(&pflags, PF_FSTRANS);
+}
+
+/*
+ * Some allocation requests often come in with little stack to work on. Push
+ * them off to a worker thread so there is lots of stack to use. Otherwise just
+ * call directly to avoid the context switch overhead here.
+ */
+int
+xfs_bmapi_allocate(
+       struct xfs_bmalloca     *args)
+{
+       DECLARE_COMPLETION_ONSTACK(done);
+
+       if (!args->stack_switch)
+               return __xfs_bmapi_allocate(args);
+
+
+       args->done = &done;
+       INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker);
+       queue_work(xfs_alloc_wq, &args->work);
+       wait_for_completion(&done);
+       return args->result;
+}
+
 STATIC int
 xfs_bmapi_convert_unwritten(
        struct xfs_bmalloca     *bma,
@@ -4919,6 +4963,7 @@ xfs_bmapi_write(
                        bma.conv = !!(flags & XFS_BMAPI_CONVERT);
                        bma.wasdel = wasdelay;
                        bma.offset = bno;
+                       bma.flags = flags;
 
                        /*
                         * There's a 32/64 bit type mismatch between the
@@ -4934,7 +4979,7 @@ xfs_bmapi_write(
 
                        ASSERT(len > 0);
                        ASSERT(bma.length > 0);
-                       error = xfs_bmapi_allocate(&bma, flags);
+                       error = xfs_bmapi_allocate(&bma);
                        if (error)
                                goto error0;
                        if (bma.blkno == NULLFSBLOCK)
index 803b56d7ce16a97b7e5eb8075ba4e7853e4b8d30..5f469c3516ebc28bf836e86c974feb8c61373a4c 100644 (file)
@@ -77,6 +77,7 @@ typedef       struct xfs_bmap_free
  * from written to unwritten, otherwise convert from unwritten to written.
  */
 #define XFS_BMAPI_CONVERT      0x040
+#define XFS_BMAPI_STACK_SWITCH 0x080
 
 #define XFS_BMAPI_FLAGS \
        { XFS_BMAPI_ENTIRE,     "ENTIRE" }, \
@@ -85,7 +86,8 @@ typedef       struct xfs_bmap_free
        { XFS_BMAPI_PREALLOC,   "PREALLOC" }, \
        { XFS_BMAPI_IGSTATE,    "IGSTATE" }, \
        { XFS_BMAPI_CONTIG,     "CONTIG" }, \
-       { XFS_BMAPI_CONVERT,    "CONVERT" }
+       { XFS_BMAPI_CONVERT,    "CONVERT" }, \
+       { XFS_BMAPI_STACK_SWITCH, "STACK_SWITCH" }
 
 
 static inline int xfs_bmapi_aflag(int w)
@@ -133,6 +135,11 @@ typedef struct xfs_bmalloca {
        char                    userdata;/* set if is user data */
        char                    aeof;   /* allocated space at eof */
        char                    conv;   /* overwriting unwritten extents */
+       char                    stack_switch;
+       int                     flags;
+       struct completion       *done;
+       struct work_struct      work;
+       int                     result;
 } xfs_bmalloca_t;
 
 /*
index a8d0ed911196120a80a26bb7232f79d3a5badee1..becf4a97efc65c95240e45c1b05b751919d51317 100644 (file)
@@ -526,7 +526,25 @@ xfs_buf_item_unpin(
                }
                xfs_buf_relse(bp);
        } else if (freed && remove) {
+               /*
+                * There are currently two references to the buffer - the active
+                * LRU reference and the buf log item. What we are about to do
+                * here - simulate a failed IO completion - requires 3
+                * references.
+                *
+                * The LRU reference is removed by the xfs_buf_stale() call. The
+                * buf item reference is removed by the xfs_buf_iodone()
+                * callback that is run by xfs_buf_do_callbacks() during ioend
+                * processing (via the bp->b_iodone callback), and then finally
+                * the ioend processing will drop the IO reference if the buffer
+                * is marked XBF_ASYNC.
+                *
+                * Hence we need to take an additional reference here so that IO
+                * completion processing doesn't free the buffer prematurely.
+                */
                xfs_buf_lock(bp);
+               xfs_buf_hold(bp);
+               bp->b_flags |= XBF_ASYNC;
                xfs_buf_ioerror(bp, EIO);
                XFS_BUF_UNDONE(bp);
                xfs_buf_stale(bp);
index c25b094efbf715186f39a9b7a44466eb0a910374..4beaede43277b15c8d5a28ffbaadb4b573d7a709 100644 (file)
@@ -399,9 +399,26 @@ xfs_growfs_data_private(
 
        /* update secondary superblocks. */
        for (agno = 1; agno < nagcount; agno++) {
-               error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp,
+               error = 0;
+               /*
+                * new secondary superblocks need to be zeroed, not read from
+                * disk as the contents of the new area we are growing into is
+                * completely unknown.
+                */
+               if (agno < oagcount) {
+                       error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp,
                                  XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),
                                  XFS_FSS_TO_BB(mp, 1), 0, &bp);
+               } else {
+                       bp = xfs_trans_get_buf(NULL, mp->m_ddev_targp,
+                                 XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),
+                                 XFS_FSS_TO_BB(mp, 1), 0);
+                       if (bp)
+                               xfs_buf_zero(bp, 0, BBTOB(bp->b_length));
+                       else
+                               error = ENOMEM;
+               }
+
                if (error) {
                        xfs_warn(mp,
                "error %d reading secondary superblock for ag %d",
@@ -423,7 +440,7 @@ xfs_growfs_data_private(
                        break; /* no point in continuing */
                }
        }
-       return 0;
+       return error;
 
  error0:
        xfs_trans_cancel(tp, XFS_TRANS_ABORT);
index 445bf1aef31c16d9e6bd17a8b91e78d7f1763c05..c5c4ef4f2bdbec16d9eb07ff0188921f677384ff 100644 (file)
@@ -250,6 +250,7 @@ xfs_ialloc_ag_alloc(
                                        /* boundary */
        struct xfs_perag *pag;
 
+       memset(&args, 0, sizeof(args));
        args.tp = tp;
        args.mp = tp->t_mountp;
 
index 2778258fcfa239e07dbc79edf6cb4750b7e13dd8..1938b41ee9f51bfef8f0ffad3e8b83e059ebcf41 100644 (file)
@@ -1509,7 +1509,8 @@ xfs_ifree_cluster(
                 * to mark all the active inodes on the buffer stale.
                 */
                bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, blkno,
-                                       mp->m_bsize * blks_per_cluster, 0);
+                                       mp->m_bsize * blks_per_cluster,
+                                       XBF_UNMAPPED);
 
                if (!bp)
                        return ENOMEM;
index 8305f2ac6773a8ee5efd1b0e24546e4194807187..c1df3c623de203f7d941ef0b706c76de270ada68 100644 (file)
@@ -70,7 +70,7 @@ xfs_find_handle(
        int                     hsize;
        xfs_handle_t            handle;
        struct inode            *inode;
-       struct fd               f;
+       struct fd               f = {0};
        struct path             path;
        int                     error;
        struct xfs_inode        *ip;
index 973dff6ad93526292871d3452d758e86b3f077ac..7f537663365b08436f1ad29015b77df33f691109 100644 (file)
@@ -584,7 +584,9 @@ xfs_iomap_write_allocate(
                         * pointer that the caller gave to us.
                         */
                        error = xfs_bmapi_write(tp, ip, map_start_fsb,
-                                               count_fsb, 0, &first_block, 1,
+                                               count_fsb,
+                                               XFS_BMAPI_STACK_SWITCH,
+                                               &first_block, 1,
                                                imap, &nimaps, &free_list);
                        if (error)
                                goto trans_cancel;
index 7f4f9370d0e7438df3820fab9b0026b37292623b..4dad756962d02e1b29c703b5b54ccee07d91fabf 100644 (file)
@@ -2387,14 +2387,27 @@ xlog_state_do_callback(
 
 
                                /*
-                                * update the last_sync_lsn before we drop the
+                                * Completion of a iclog IO does not imply that
+                                * a transaction has completed, as transactions
+                                * can be large enough to span many iclogs. We
+                                * cannot change the tail of the log half way
+                                * through a transaction as this may be the only
+                                * transaction in the log and moving th etail to
+                                * point to the middle of it will prevent
+                                * recovery from finding the start of the
+                                * transaction. Hence we should only update the
+                                * last_sync_lsn if this iclog contains
+                                * transaction completion callbacks on it.
+                                *
+                                * We have to do this before we drop the
                                 * icloglock to ensure we are the only one that
                                 * can update it.
                                 */
                                ASSERT(XFS_LSN_CMP(atomic64_read(&log->l_last_sync_lsn),
                                        be64_to_cpu(iclog->ic_header.h_lsn)) <= 0);
-                               atomic64_set(&log->l_last_sync_lsn,
-                                       be64_to_cpu(iclog->ic_header.h_lsn));
+                               if (iclog->ic_callback)
+                                       atomic64_set(&log->l_last_sync_lsn,
+                                               be64_to_cpu(iclog->ic_header.h_lsn));
 
                        } else
                                ioerrors++;
index 5da3ace352bffe6ca32d16ae76fc131291914a00..d308749fabf126a5b318c5d55f0e58e5589ef14f 100644 (file)
@@ -3541,7 +3541,7 @@ xlog_do_recovery_pass(
                                 *   - order is important.
                                 */
                                error = xlog_bread_offset(log, 0,
-                                               bblks - split_bblks, hbp,
+                                               bblks - split_bblks, dbp,
                                                offset + BBTOB(split_bblks));
                                if (error)
                                        goto bread_err2;
index 5ce0e5fd712e0fe67d0e05b455fffbb85c16fb7c..251a2090a55444cec55ce4f04510b6ef83a69cfb 100644 (file)
 int devpts_new_index(struct inode *ptmx_inode);
 void devpts_kill_index(struct inode *ptmx_inode, int idx);
 /* mknod in devpts */
-int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty);
-/* get tty structure */
-struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number);
+struct inode *devpts_pty_new(struct inode *ptmx_inode, dev_t device, int index,
+               void *priv);
+/* get private structure */
+void *devpts_get_priv(struct inode *pts_inode);
 /* unlink */
-void devpts_pty_kill(struct tty_struct *tty);
+void devpts_pty_kill(struct inode *inode);
 
 #else
 
 /* Dummy stubs in the no-pty case */
 static inline int devpts_new_index(struct inode *ptmx_inode) { return -EINVAL; }
 static inline void devpts_kill_index(struct inode *ptmx_inode, int idx) { }
-static inline int devpts_pty_new(struct inode *ptmx_inode,
-                               struct tty_struct *tty)
+static inline struct inode *devpts_pty_new(struct inode *ptmx_inode,
+               dev_t device, int index, void *priv)
 {
-       return -EINVAL;
+       return ERR_PTR(-EINVAL);
 }
-static inline struct tty_struct *devpts_get_tty(struct inode *pts_inode,
-               int number)
+static inline void *devpts_get_priv(struct inode *pts_inode)
 {
        return NULL;
 }
-static inline void devpts_pty_kill(struct tty_struct *tty) { }
+static inline void devpts_pty_kill(struct inode *inode) { }
 
 #endif
 
similarity index 97%
rename from arch/arm/plat-mxc/include/mach/ipu.h
rename to include/linux/dma/ipu-dma.h
index 539e559d18b2c6f1046f3909e22760d43eaea9b1..18031115c6684f6ca5681aa5e19efd4a546b61ee 100644 (file)
@@ -9,8 +9,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef _IPU_H_
-#define _IPU_H_
+#ifndef __LINUX_DMA_IPU_DMA_H
+#define __LINUX_DMA_IPU_DMA_H
 
 #include <linux/types.h>
 #include <linux/dmaengine.h>
@@ -174,4 +174,4 @@ struct idmac_channel {
 #define to_tx_desc(tx) container_of(tx, struct idmac_tx_desc, txd)
 #define to_idmac_chan(c) container_of(c, struct idmac_channel, dma_chan)
 
-#endif
+#endif /* __LINUX_DMA_IPU_DMA_H */
diff --git a/include/linux/hashtable.h b/include/linux/hashtable.h
new file mode 100644 (file)
index 0000000..227c624
--- /dev/null
@@ -0,0 +1,192 @@
+/*
+ * Statically sized hash table implementation
+ * (C) 2012  Sasha Levin <levinsasha928@gmail.com>
+ */
+
+#ifndef _LINUX_HASHTABLE_H
+#define _LINUX_HASHTABLE_H
+
+#include <linux/list.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/hash.h>
+#include <linux/rculist.h>
+
+#define DEFINE_HASHTABLE(name, bits)                                           \
+       struct hlist_head name[1 << (bits)] =                                   \
+                       { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT }
+
+#define DECLARE_HASHTABLE(name, bits)                                          \
+       struct hlist_head name[1 << (bits)]
+
+#define HASH_SIZE(name) (ARRAY_SIZE(name))
+#define HASH_BITS(name) ilog2(HASH_SIZE(name))
+
+/* Use hash_32 when possible to allow for fast 32bit hashing in 64bit kernels. */
+#define hash_min(val, bits)                                                    \
+       (sizeof(val) <= 4 ? hash_32(val, bits) : hash_long(val, bits))
+
+static inline void __hash_init(struct hlist_head *ht, unsigned int sz)
+{
+       unsigned int i;
+
+       for (i = 0; i < sz; i++)
+               INIT_HLIST_HEAD(&ht[i]);
+}
+
+/**
+ * hash_init - initialize a hash table
+ * @hashtable: hashtable to be initialized
+ *
+ * Calculates the size of the hashtable from the given parameter, otherwise
+ * same as hash_init_size.
+ *
+ * This has to be a macro since HASH_BITS() will not work on pointers since
+ * it calculates the size during preprocessing.
+ */
+#define hash_init(hashtable) __hash_init(hashtable, HASH_SIZE(hashtable))
+
+/**
+ * hash_add - add an object to a hashtable
+ * @hashtable: hashtable to add to
+ * @node: the &struct hlist_node of the object to be added
+ * @key: the key of the object to be added
+ */
+#define hash_add(hashtable, node, key)                                         \
+       hlist_add_head(node, &hashtable[hash_min(key, HASH_BITS(hashtable))])
+
+/**
+ * hash_add_rcu - add an object to a rcu enabled hashtable
+ * @hashtable: hashtable to add to
+ * @node: the &struct hlist_node of the object to be added
+ * @key: the key of the object to be added
+ */
+#define hash_add_rcu(hashtable, node, key)                                     \
+       hlist_add_head_rcu(node, &hashtable[hash_min(key, HASH_BITS(hashtable))])
+
+/**
+ * hash_hashed - check whether an object is in any hashtable
+ * @node: the &struct hlist_node of the object to be checked
+ */
+static inline bool hash_hashed(struct hlist_node *node)
+{
+       return !hlist_unhashed(node);
+}
+
+static inline bool __hash_empty(struct hlist_head *ht, unsigned int sz)
+{
+       unsigned int i;
+
+       for (i = 0; i < sz; i++)
+               if (!hlist_empty(&ht[i]))
+                       return false;
+
+       return true;
+}
+
+/**
+ * hash_empty - check whether a hashtable is empty
+ * @hashtable: hashtable to check
+ *
+ * This has to be a macro since HASH_BITS() will not work on pointers since
+ * it calculates the size during preprocessing.
+ */
+#define hash_empty(hashtable) __hash_empty(hashtable, HASH_SIZE(hashtable))
+
+/**
+ * hash_del - remove an object from a hashtable
+ * @node: &struct hlist_node of the object to remove
+ */
+static inline void hash_del(struct hlist_node *node)
+{
+       hlist_del_init(node);
+}
+
+/**
+ * hash_del_rcu - remove an object from a rcu enabled hashtable
+ * @node: &struct hlist_node of the object to remove
+ */
+static inline void hash_del_rcu(struct hlist_node *node)
+{
+       hlist_del_init_rcu(node);
+}
+
+/**
+ * hash_for_each - iterate over a hashtable
+ * @name: hashtable to iterate
+ * @bkt: integer to use as bucket loop cursor
+ * @node: the &struct list_head to use as a loop cursor for each entry
+ * @obj: the type * to use as a loop cursor for each entry
+ * @member: the name of the hlist_node within the struct
+ */
+#define hash_for_each(name, bkt, node, obj, member)                            \
+       for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\
+               hlist_for_each_entry(obj, node, &name[bkt], member)
+
+/**
+ * hash_for_each_rcu - iterate over a rcu enabled hashtable
+ * @name: hashtable to iterate
+ * @bkt: integer to use as bucket loop cursor
+ * @node: the &struct list_head to use as a loop cursor for each entry
+ * @obj: the type * to use as a loop cursor for each entry
+ * @member: the name of the hlist_node within the struct
+ */
+#define hash_for_each_rcu(name, bkt, node, obj, member)                                \
+       for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\
+               hlist_for_each_entry_rcu(obj, node, &name[bkt], member)
+
+/**
+ * hash_for_each_safe - iterate over a hashtable safe against removal of
+ * hash entry
+ * @name: hashtable to iterate
+ * @bkt: integer to use as bucket loop cursor
+ * @node: the &struct list_head to use as a loop cursor for each entry
+ * @tmp: a &struct used for temporary storage
+ * @obj: the type * to use as a loop cursor for each entry
+ * @member: the name of the hlist_node within the struct
+ */
+#define hash_for_each_safe(name, bkt, node, tmp, obj, member)                  \
+       for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\
+               hlist_for_each_entry_safe(obj, node, tmp, &name[bkt], member)
+
+/**
+ * hash_for_each_possible - iterate over all possible objects hashing to the
+ * same bucket
+ * @name: hashtable to iterate
+ * @obj: the type * to use as a loop cursor for each entry
+ * @node: the &struct list_head to use as a loop cursor for each entry
+ * @member: the name of the hlist_node within the struct
+ * @key: the key of the objects to iterate over
+ */
+#define hash_for_each_possible(name, obj, node, member, key)                   \
+       hlist_for_each_entry(obj, node, &name[hash_min(key, HASH_BITS(name))], member)
+
+/**
+ * hash_for_each_possible_rcu - iterate over all possible objects hashing to the
+ * same bucket in an rcu enabled hashtable
+ * in a rcu enabled hashtable
+ * @name: hashtable to iterate
+ * @obj: the type * to use as a loop cursor for each entry
+ * @node: the &struct list_head to use as a loop cursor for each entry
+ * @member: the name of the hlist_node within the struct
+ * @key: the key of the objects to iterate over
+ */
+#define hash_for_each_possible_rcu(name, obj, node, member, key)               \
+       hlist_for_each_entry_rcu(obj, node, &name[hash_min(key, HASH_BITS(name))], member)
+
+/**
+ * hash_for_each_possible_safe - iterate over all possible objects hashing to the
+ * same bucket safe against removals
+ * @name: hashtable to iterate
+ * @obj: the type * to use as a loop cursor for each entry
+ * @node: the &struct list_head to use as a loop cursor for each entry
+ * @tmp: a &struct used for temporary storage
+ * @member: the name of the hlist_node within the struct
+ * @key: the key of the objects to iterate over
+ */
+#define hash_for_each_possible_safe(name, obj, node, tmp, member, key)         \
+       hlist_for_each_entry_safe(obj, node, tmp,                               \
+               &name[hash_min(key, HASH_BITS(name))], member)
+
+
+#endif
index 93bfc9f9815c7fa178ad70b555e7a2afb86b3f02..ecc554374e440a73df8aaf5b5787f86705e647b0 100644 (file)
  */
 #define KVM_MEMSLOT_INVALID    (1UL << 16)
 
-/*
- * If we support unaligned MMIO, at most one fragment will be split into two:
- */
-#ifdef KVM_UNALIGNED_MMIO
-#  define KVM_EXTRA_MMIO_FRAGMENTS 1
-#else
-#  define KVM_EXTRA_MMIO_FRAGMENTS 0
-#endif
-
-#define KVM_USER_MMIO_SIZE 8
-
-#define KVM_MAX_MMIO_FRAGMENTS \
-       (KVM_MMIO_SIZE / KVM_USER_MMIO_SIZE + KVM_EXTRA_MMIO_FRAGMENTS)
+/* Two fragments for cross MMIO pages. */
+#define KVM_MAX_MMIO_FRAGMENTS 2
 
 /*
  * For the normal pfn, the highest 12 bits should be zero,
similarity index 96%
rename from arch/arm/plat-omap/include/plat/menelaus.h
rename to include/linux/mfd/menelaus.h
index 4a970ec62dd150e0f6a684d10bb109a2202bbe34..f097e89134cbf5d36f04ea88a73f1dc570c2369b 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/arm/plat-omap/include/mach/menelaus.h
- *
  * Functions to access Menelaus power management chip
  */
 
index 7c6a1139d8faf9ad54af671c68cd81ea3dcebf2f..96531664a0612dc6bc006cad026cd795cf6a9aea 100644 (file)
@@ -137,7 +137,7 @@ struct dw_mci {
 
        dma_addr_t              sg_dma;
        void                    *sg_cpu;
-       struct dw_mci_dma_ops   *dma_ops;
+       const struct dw_mci_dma_ops     *dma_ops;
 #ifdef CONFIG_MMC_DW_IDMAC
        unsigned int            ring_size;
 #else
@@ -162,7 +162,7 @@ struct dw_mci {
        u16                     data_offset;
        struct device           *dev;
        struct dw_mci_board     *pdata;
-       struct dw_mci_drv_data  *drv_data;
+       const struct dw_mci_drv_data    *drv_data;
        void                    *priv;
        struct clk              *biu_clk;
        struct clk              *ciu_clk;
@@ -186,7 +186,7 @@ struct dw_mci {
 
        struct regulator        *vmmc;  /* Power regulator */
        unsigned long           irq_flags; /* IRQ flags */
-       unsigned int            irq;
+       int                     irq;
 };
 
 /* DMA ops for Internal/External DMAC interface */
index fa8529a859b8b7637a6b25e76e15ba7848cd9f79..1edcb4dad8c464a7910d126ebcf1b36bcefacb36 100644 (file)
@@ -91,6 +91,7 @@ struct sdhci_host {
        unsigned int quirks2;   /* More deviations from spec. */
 
 #define SDHCI_QUIRK2_HOST_OFF_CARD_ON                  (1<<0)
+#define SDHCI_QUIRK2_HOST_NO_CMD23                     (1<<1)
 
        int irq;                /* Device IRQ */
        void __iomem *ioaddr;   /* Mapped address */
index a1984dd037da8c13d11a18336fdff331c356fc97..e20e3af68fb6acbaf6a51c5aec465bb753a54968 100644 (file)
@@ -28,11 +28,13 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
 #endif
 
 #else /* CONFIG_OF_ADDRESS */
+#ifndef of_address_to_resource
 static inline int of_address_to_resource(struct device_node *dev, int index,
                                         struct resource *r)
 {
        return -EINVAL;
 }
+#endif
 static inline struct device_node *of_find_matching_node_by_address(
                                        struct device_node *from,
                                        const struct of_device_id *matches,
index 63f3c28042396afd1d2333f7bf59e1a78bcf6c54..92c7fd72f63669b0354179a5f8c3370feb347e0f 100644 (file)
@@ -17,5 +17,7 @@ struct imx_ssi_platform_data {
        void (*ac97_warm_reset)(struct snd_ac97 *ac97);
 };
 
+extern int mxc_set_irq_fiq(unsigned int irq, unsigned int type);
+
 #endif /* __MACH_SSI_H */
 
index 1b9080385b4618b2b3c76ab057a7bf271df8d73d..f6d30cc1cb77eeb4681f9bd83f7471973ec17581 100644 (file)
@@ -61,7 +61,9 @@ static inline int imx_dma_is_ipu(struct dma_chan *chan)
 static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
 {
        return strstr(dev_name(chan->device->dev), "sdma") ||
-               !strcmp(dev_name(chan->device->dev), "imx-dma");
+               !strcmp(dev_name(chan->device->dev), "imx1-dma") ||
+               !strcmp(dev_name(chan->device->dev), "imx21-dma") ||
+               !strcmp(dev_name(chan->device->dev), "imx27-dma");
 }
 
 #endif
index e8741c2678d586497d05dd3cfff9b74f89b015e6..5d50b25a73d71374b523ba68b6614e9deb3268a4 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <linux/io.h>
 #include <linux/platform_device.h>
-#include <mach/irqs.h>
 
 #define OMAP1_MPUIO_BASE                       0xfffb5000
 
similarity index 91%
rename from arch/arm/plat-omap/include/plat/led.h
rename to include/linux/platform_data/leds-omap.h
index 25e451e7e2fd9aeba2e133dfc94bfe4216a63494..56c9b2a0ada54f53c2ca56d191b4a54145b2d0ca 100644 (file)
@@ -1,6 +1,4 @@
 /*
- *  arch/arm/plat-omap/include/mach/led.h
- *
  *  Copyright (C) 2006 Samsung Electronics
  *  Kyungmin Park <kyungmin.park@samsung.com>
  *
similarity index 80%
rename from arch/arm/plat-omap/include/plat/mmc.h
rename to include/linux/platform_data/mmc-omap.h
index 8b4e4f2da2f5456c1d05321a641e5e473214fd62..2bf6ea82ff9475dec177262589355b26b33836f5 100644 (file)
@@ -8,27 +8,6 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __OMAP2_MMC_H
-#define __OMAP2_MMC_H
-
-#include <linux/types.h>
-#include <linux/device.h>
-#include <linux/mmc/host.h>
-
-#include <plat/omap_hwmod.h>
-
-#define OMAP15XX_NR_MMC                1
-#define OMAP16XX_NR_MMC                2
-#define OMAP1_MMC_SIZE         0x080
-#define OMAP1_MMC1_BASE                0xfffb7800
-#define OMAP1_MMC2_BASE                0xfffb7c00      /* omap16xx only */
-
-#define OMAP24XX_NR_MMC                2
-#define OMAP2420_MMC_SIZE      OMAP1_MMC_SIZE
-#define OMAP2_MMC1_BASE                0x4809c000
-
-#define OMAP4_MMC_REG_OFFSET   0x100
-
 #define OMAP_MMC_MAX_SLOTS     2
 
 /*
@@ -50,6 +29,8 @@
 #define OMAP_HSMMC_SUPPORTS_DUAL_VOLT          BIT(0)
 #define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ      BIT(1)
 
+struct mmc_card;
+
 struct omap_mmc_dev_attr {
        u8 flags;
 };
@@ -126,6 +107,9 @@ struct omap_mmc_platform_data {
                /* we can put the features above into this variable */
 #define HSMMC_HAS_PBIAS                (1 << 0)
 #define HSMMC_HAS_UPDATED_RESET        (1 << 1)
+#define MMC_OMAP7XX            (1 << 2)
+#define MMC_OMAP15XX           (1 << 3)
+#define MMC_OMAP16XX           (1 << 4)
                unsigned features;
 
                int switch_pin;                 /* gpio (card detect) */
@@ -164,25 +148,3 @@ struct omap_mmc_platform_data {
 
        } slots[OMAP_MMC_MAX_SLOTS];
 };
-
-/* called from board-specific card detection service routine */
-extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
-                                       int is_closed);
-
-#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
-void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
-                               int nr_controllers);
-void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data);
-#else
-static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
-                               int nr_controllers)
-{
-}
-static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
-{
-}
-#endif
-
-extern int omap_msdi_reset(struct omap_hwmod *oh);
-
-#endif
index 1a68c1e5fe537a0b0b52c70521ef8672ad66a4ff..24d32ca34bef0724751e350fe90a48f7faa60281 100644 (file)
@@ -8,9 +8,13 @@
  * published by the Free Software Foundation.
  */
 
-#include <plat/gpmc.h>
+#ifndef        _MTD_NAND_OMAP2_H
+#define        _MTD_NAND_OMAP2_H
+
 #include <linux/mtd/partitions.h>
 
+#define        GPMC_BCH_NUM_REMAINDER  8
+
 enum nand_io {
        NAND_OMAP_PREFETCH_POLLED = 0,  /* prefetch polled mode, default */
        NAND_OMAP_POLLED,               /* polled mode, without prefetch */
@@ -18,10 +22,38 @@ enum nand_io {
        NAND_OMAP_PREFETCH_IRQ          /* prefetch enabled irq mode */
 };
 
+enum omap_ecc {
+               /* 1-bit ecc: stored at end of spare area */
+       OMAP_ECC_HAMMING_CODE_DEFAULT = 0, /* Default, s/w method */
+       OMAP_ECC_HAMMING_CODE_HW, /* gpmc to detect the error */
+               /* 1-bit ecc: stored at beginning of spare area as romcode */
+       OMAP_ECC_HAMMING_CODE_HW_ROMCODE, /* gpmc method & romcode layout */
+       OMAP_ECC_BCH4_CODE_HW, /* 4-bit BCH ecc code */
+       OMAP_ECC_BCH8_CODE_HW, /* 8-bit BCH ecc code */
+};
+
+struct gpmc_nand_regs {
+       void __iomem    *gpmc_status;
+       void __iomem    *gpmc_nand_command;
+       void __iomem    *gpmc_nand_address;
+       void __iomem    *gpmc_nand_data;
+       void __iomem    *gpmc_prefetch_config1;
+       void __iomem    *gpmc_prefetch_config2;
+       void __iomem    *gpmc_prefetch_control;
+       void __iomem    *gpmc_prefetch_status;
+       void __iomem    *gpmc_ecc_config;
+       void __iomem    *gpmc_ecc_control;
+       void __iomem    *gpmc_ecc_size_config;
+       void __iomem    *gpmc_ecc1_result;
+       void __iomem    *gpmc_bch_result0[GPMC_BCH_NUM_REMAINDER];
+       void __iomem    *gpmc_bch_result1[GPMC_BCH_NUM_REMAINDER];
+       void __iomem    *gpmc_bch_result2[GPMC_BCH_NUM_REMAINDER];
+       void __iomem    *gpmc_bch_result3[GPMC_BCH_NUM_REMAINDER];
+};
+
 struct omap_nand_platform_data {
        int                     cs;
        struct mtd_partition    *parts;
-       struct gpmc_timings     *gpmc_t;
        int                     nr_parts;
        bool                    dev_ready;
        enum nand_io            xfer_type;
@@ -30,14 +62,4 @@ struct omap_nand_platform_data {
        struct gpmc_nand_regs   reg;
 };
 
-/* minimum size for IO mapping */
-#define        NAND_IO_SIZE    4
-
-#if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
-extern int gpmc_nand_init(struct omap_nand_platform_data *d);
-#else
-static inline int gpmc_nand_init(struct omap_nand_platform_data *d)
-{
-       return 0;
-}
 #endif
index 2858667d2e4f7505502c5e3a8317ff0bdfb4fbe6..685af7e8b12076d3e295f3136207e8189dc56e41 100644 (file)
@@ -9,17 +9,15 @@
  * published by the Free Software Foundation.
  */
 
+#ifndef        __MTD_ONENAND_OMAP2_H
+#define        __MTD_ONENAND_OMAP2_H
+
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 
 #define ONENAND_SYNC_READ      (1 << 0)
 #define ONENAND_SYNC_READWRITE (1 << 1)
-
-struct onenand_freq_info {
-       u16                     maf_id;
-       u16                     dev_id;
-       u16                     ver_id;
-};
+#define        ONENAND_IN_OMAP34XX     (1 << 2)
 
 struct omap_onenand_platform_data {
        int                     cs;
@@ -27,27 +25,9 @@ struct omap_onenand_platform_data {
        struct mtd_partition    *parts;
        int                     nr_parts;
        int                     (*onenand_setup)(void __iomem *, int *freq_ptr);
-       int             (*get_freq)(const struct onenand_freq_info *freq_info,
-                                   bool *clk_dep);
        int                     dma_channel;
        u8                      flags;
        u8                      regulator_can_sleep;
        u8                      skip_initial_unlocking;
 };
-
-#define ONENAND_MAX_PARTITIONS 8
-
-#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
-       defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
-
-extern void gpmc_onenand_init(struct omap_onenand_platform_data *d);
-
-#else
-
-#define board_onenand_data     NULL
-
-static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d)
-{
-}
-
 #endif
diff --git a/include/linux/platform_data/omap-wd-timer.h b/include/linux/platform_data/omap-wd-timer.h
new file mode 100644 (file)
index 0000000..d75f5f8
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * OMAP2+ WDTIMER-specific function prototypes
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ * Paul Walmsley
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __LINUX_PLATFORM_DATA_OMAP_WD_TIMER_H
+#define __LINUX_PLATFORM_DATA_OMAP_WD_TIMER_H
+
+#include <linux/types.h>
+
+/*
+ * Standardized OMAP reset source bits
+ *
+ * This is a subset of the ones listed in arch/arm/mach-omap2/prm.h
+ * and are the only ones needed in the watchdog driver.
+ */
+#define OMAP_MPU_WD_RST_SRC_ID_SHIFT                           3
+
+/**
+ * struct omap_wd_timer_platform_data - WDTIMER integration to the host SoC
+ * @read_reset_sources - fn ptr for the SoC to indicate the last reset cause
+ *
+ * The function pointed to by @read_reset_sources must return its data
+ * in a standard format - search for RST_SRC_ID_SHIFT in
+ * arch/arm/mach-omap2
+ */
+struct omap_wd_timer_platform_data {
+       u32 (*read_reset_sources)(void);
+};
+
+#endif
diff --git a/include/linux/platform_data/usb-omap.h b/include/linux/platform_data/usb-omap.h
new file mode 100644 (file)
index 0000000..8570bcf
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * usb-omap.h - Platform data for the various OMAP USB IPs
+ *
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * This software is distributed under the terms of the GNU General Public
+ * License ("GPL") version 2, as published by the Free Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define OMAP3_HS_USB_PORTS     3
+
+enum usbhs_omap_port_mode {
+       OMAP_USBHS_PORT_MODE_UNUSED,
+       OMAP_EHCI_PORT_MODE_PHY,
+       OMAP_EHCI_PORT_MODE_TLL,
+       OMAP_EHCI_PORT_MODE_HSIC,
+       OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0,
+       OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM,
+       OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0,
+       OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM,
+       OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0,
+       OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM,
+       OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0,
+       OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM,
+       OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0,
+       OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM
+};
+
+struct usbtll_omap_platform_data {
+       enum usbhs_omap_port_mode               port_mode[OMAP3_HS_USB_PORTS];
+};
+
+struct ehci_hcd_omap_platform_data {
+       enum usbhs_omap_port_mode       port_mode[OMAP3_HS_USB_PORTS];
+       int                             reset_gpio_port[OMAP3_HS_USB_PORTS];
+       struct regulator                *regulator[OMAP3_HS_USB_PORTS];
+       unsigned                        phy_reset:1;
+};
+
+struct ohci_hcd_omap_platform_data {
+       enum usbhs_omap_port_mode       port_mode[OMAP3_HS_USB_PORTS];
+       unsigned                        es2_compatibility:1;
+};
+
+struct usbhs_omap_platform_data {
+       enum usbhs_omap_port_mode               port_mode[OMAP3_HS_USB_PORTS];
+
+       struct ehci_hcd_omap_platform_data      *ehci_data;
+       struct ohci_hcd_omap_platform_data      *ohci_data;
+};
+
+/*-------------------------------------------------------------------------*/
+
+struct omap_musb_board_data {
+       u8      interface_type;
+       u8      mode;
+       u16     power;
+       unsigned extvbus:1;
+       void    (*set_phy_power)(u8 on);
+       void    (*clear_irq)(void);
+       void    (*set_mode)(u8 mode);
+       void    (*reset)(void);
+};
+
+enum musb_interface {
+       MUSB_INTERFACE_ULPI,
+       MUSB_INTERFACE_UTMI
+};
index f2dc6d8fc680f7ae02596558ce4571a675fb3bce..38a99350832744231042de3d1d45f0fc11f3471f 100644 (file)
@@ -54,7 +54,8 @@ struct ptp_clock_request {
  * clock operations
  *
  * @adjfreq:  Adjusts the frequency of the hardware clock.
- *            parameter delta: Desired period change in parts per billion.
+ *            parameter delta: Desired frequency offset from nominal frequency
+ *            in parts per billion
  *
  * @adjtime:  Shifts the time of the hardware clock.
  *            parameter delta: Desired change in nanoseconds.
index 2415a64c5e51d937ba0fc7d20cf78011b1b77dd6..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,2 +0,0 @@
-header-y += md_p.h
-header-y += md_u.h
index fb1abb3367e9520a7e68cf738709e7510abe80f0..358c04bfbe2ad31c691ac07e87b5988395f2c2f3 100644 (file)
    (for example /usr/src/linux/COPYING); if not, write to the Free
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
 */
-
 #ifndef _MD_U_H
 #define _MD_U_H
 
-/*
- * Different major versions are not compatible.
- * Different minor versions are only downward compatible.
- * Different patchlevel versions are downward and upward compatible.
- */
-#define MD_MAJOR_VERSION                0
-#define MD_MINOR_VERSION                90
-/*
- * MD_PATCHLEVEL_VERSION indicates kernel functionality.
- * >=1 means different superblock formats are selectable using SET_ARRAY_INFO
- *     and major_version/minor_version accordingly
- * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
- *     in the super status byte
- * >=3 means that bitmap superblock version 4 is supported, which uses
- *     little-ending representation rather than host-endian
- */
-#define MD_PATCHLEVEL_VERSION           3
-
-/* ioctls */
-
-/* status */
-#define RAID_VERSION           _IOR (MD_MAJOR, 0x10, mdu_version_t)
-#define GET_ARRAY_INFO         _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
-#define GET_DISK_INFO          _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
-#define PRINT_RAID_DEBUG       _IO (MD_MAJOR, 0x13)
-#define RAID_AUTORUN           _IO (MD_MAJOR, 0x14)
-#define GET_BITMAP_FILE                _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
-
-/* configuration */
-#define CLEAR_ARRAY            _IO (MD_MAJOR, 0x20)
-#define ADD_NEW_DISK           _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
-#define HOT_REMOVE_DISK                _IO (MD_MAJOR, 0x22)
-#define SET_ARRAY_INFO         _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
-#define SET_DISK_INFO          _IO (MD_MAJOR, 0x24)
-#define WRITE_RAID_INFO                _IO (MD_MAJOR, 0x25)
-#define UNPROTECT_ARRAY                _IO (MD_MAJOR, 0x26)
-#define PROTECT_ARRAY          _IO (MD_MAJOR, 0x27)
-#define HOT_ADD_DISK           _IO (MD_MAJOR, 0x28)
-#define SET_DISK_FAULTY                _IO (MD_MAJOR, 0x29)
-#define HOT_GENERATE_ERROR     _IO (MD_MAJOR, 0x2a)
-#define SET_BITMAP_FILE                _IOW (MD_MAJOR, 0x2b, int)
+#include <uapi/linux/raid/md_u.h>
 
-/* usage */
-#define RUN_ARRAY              _IOW (MD_MAJOR, 0x30, mdu_param_t)
-/*  0x31 was START_ARRAY  */
-#define STOP_ARRAY             _IO (MD_MAJOR, 0x32)
-#define STOP_ARRAY_RO          _IO (MD_MAJOR, 0x33)
-#define RESTART_ARRAY_RW       _IO (MD_MAJOR, 0x34)
-
-/* 63 partitions with the alternate major number (mdp) */
-#define MdpMinorShift 6
-#ifdef __KERNEL__
 extern int mdp_major;
-#endif
-
-typedef struct mdu_version_s {
-       int major;
-       int minor;
-       int patchlevel;
-} mdu_version_t;
-
-typedef struct mdu_array_info_s {
-       /*
-        * Generic constant information
-        */
-       int major_version;
-       int minor_version;
-       int patch_version;
-       int ctime;
-       int level;
-       int size;
-       int nr_disks;
-       int raid_disks;
-       int md_minor;
-       int not_persistent;
-
-       /*
-        * Generic state information
-        */
-       int utime;              /*  0 Superblock update time                  */
-       int state;              /*  1 State bits (clean, ...)                 */
-       int active_disks;       /*  2 Number of currently active disks        */
-       int working_disks;      /*  3 Number of working disks                 */
-       int failed_disks;       /*  4 Number of failed disks                  */
-       int spare_disks;        /*  5 Number of spare disks                   */
-
-       /*
-        * Personality information
-        */
-       int layout;             /*  0 the array's physical layout             */
-       int chunk_size; /*  1 chunk size in bytes                     */
-
-} mdu_array_info_t;
-
-/* non-obvious values for 'level' */
-#define        LEVEL_MULTIPATH         (-4)
-#define        LEVEL_LINEAR            (-1)
-#define        LEVEL_FAULTY            (-5)
-
-/* we need a value for 'no level specified' and 0
- * means 'raid0', so we need something else.  This is
- * for internal use only
- */
-#define        LEVEL_NONE              (-1000000)
-
-typedef struct mdu_disk_info_s {
-       /*
-        * configuration/status of one particular disk
-        */
-       int number;
-       int major;
-       int minor;
-       int raid_disk;
-       int state;
-
-} mdu_disk_info_t;
-
-typedef struct mdu_start_info_s {
-       /*
-        * configuration/status of one particular disk
-        */
-       int major;
-       int minor;
-       int raid_disk;
-       int state;
-
-} mdu_start_info_t;
-
-typedef struct mdu_bitmap_file_s
-{
-       char pathname[4096];
-} mdu_bitmap_file_t;
-
-typedef struct mdu_param_s
-{
-       int                     personality;    /* 1,2,3,4 */
-       int                     chunk_size;     /* in bytes */
-       int                     max_fault;      /* unused for now */
-} mdu_param_t;
-
 #endif 
-
index f0b4eb47297c8b10a356c96d929e272702a7dd7b..d7ff88fb896715ba58838fe89d329ed0821439bb 100644 (file)
@@ -188,7 +188,9 @@ struct tty_port_operations {
 };
        
 struct tty_port {
+       struct tty_bufhead      buf;            /* Locked internally */
        struct tty_struct       *tty;           /* Back pointer */
+       struct tty_struct       *itty;          /* internal back ptr */
        const struct tty_port_operations *ops;  /* Port operations */
        spinlock_t              lock;           /* Lock protecting tty field */
        int                     blocked_open;   /* Waiting to open */
@@ -197,6 +199,9 @@ struct tty_port {
        wait_queue_head_t       close_wait;     /* Close waiters */
        wait_queue_head_t       delta_msr_wait; /* Modem status change */
        unsigned long           flags;          /* TTY flags ASY_*/
+       unsigned long           iflags;         /* TTYP_ internal flags */
+#define TTYP_FLUSHING                  1  /* Flushing to ldisc in progress */
+#define TTYP_FLUSHPENDING              2  /* Queued buffer flush pending */
        unsigned char           console:1;      /* port is a console */
        struct mutex            mutex;          /* Locking */
        struct mutex            buf_mutex;      /* Buffer alloc lock */
@@ -235,6 +240,7 @@ struct tty_struct {
        struct mutex ldisc_mutex;
        struct tty_ldisc *ldisc;
 
+       struct mutex atomic_write_lock;
        struct mutex legacy_mutex;
        struct mutex termios_mutex;
        spinlock_t ctrl_lock;
@@ -254,7 +260,6 @@ struct tty_struct {
 
        struct tty_struct *link;
        struct fasync_struct *fasync;
-       struct tty_bufhead buf;         /* Locked internally */
        int alt_speed;          /* For magic substitution of 38400 bps */
        wait_queue_head_t write_wait;
        wait_queue_head_t read_wait;
@@ -265,37 +270,10 @@ struct tty_struct {
 
 #define N_TTY_BUF_SIZE 4096
 
-       /*
-        * The following is data for the N_TTY line discipline.  For
-        * historical reasons, this is included in the tty structure.
-        * Mostly locked by the BKL.
-        */
-       unsigned int column;
-       unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1;
        unsigned char closing:1;
-       unsigned char echo_overrun:1;
        unsigned short minimum_to_wake;
-       unsigned long overrun_time;
-       int num_overrun;
-       unsigned long process_char_map[256/(8*sizeof(unsigned long))];
-       char *read_buf;
-       int read_head;
-       int read_tail;
-       int read_cnt;
-       unsigned long read_flags[N_TTY_BUF_SIZE/(8*sizeof(unsigned long))];
-       unsigned char *echo_buf;
-       unsigned int echo_pos;
-       unsigned int echo_cnt;
-       int canon_data;
-       unsigned long canon_head;
-       unsigned int canon_column;
-       struct mutex atomic_read_lock;
-       struct mutex atomic_write_lock;
-       struct mutex output_lock;
-       struct mutex echo_lock;
        unsigned char *write_buf;
        int write_cnt;
-       spinlock_t read_lock;
        /* If the tty has a pending do_SAK, queue it here - akpm */
        struct work_struct SAK_work;
        struct tty_port *port;
@@ -335,8 +313,6 @@ struct tty_file_private {
 #define TTY_PTY_LOCK           16      /* pty private */
 #define TTY_NO_WRITE_SPLIT     17      /* Preserve write boundaries to driver */
 #define TTY_HUPPED             18      /* Post driver->hangup() */
-#define TTY_FLUSHING           19      /* Flushing to ldisc in progress */
-#define TTY_FLUSHPENDING       20      /* Queued buffer flush pending */
 #define TTY_HUPPING            21      /* ->hangup() in progress */
 
 #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
@@ -412,9 +388,9 @@ extern void disassociate_ctty(int priv);
 extern void no_tty(void);
 extern void tty_flip_buffer_push(struct tty_struct *tty);
 extern void tty_flush_to_ldisc(struct tty_struct *tty);
-extern void tty_buffer_free_all(struct tty_struct *tty);
+extern void tty_buffer_free_all(struct tty_port *port);
 extern void tty_buffer_flush(struct tty_struct *tty);
-extern void tty_buffer_init(struct tty_struct *tty);
+extern void tty_buffer_init(struct tty_port *port);
 extern speed_t tty_get_baud_rate(struct tty_struct *tty);
 extern speed_t tty_termios_baud_rate(struct ktermios *termios);
 extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
@@ -535,7 +511,7 @@ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
 /* tty_audit.c */
 #ifdef CONFIG_AUDIT
 extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
-                              size_t size);
+                              size_t size, unsigned icanon);
 extern void tty_audit_exit(void);
 extern void tty_audit_fork(struct signal_struct *sig);
 extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
@@ -544,7 +520,7 @@ extern int tty_audit_push_task(struct task_struct *tsk,
                               kuid_t loginuid, u32 sessionid);
 #else
 static inline void tty_audit_add_data(struct tty_struct *tty,
-                                     unsigned char *data, size_t size)
+               unsigned char *data, size_t size, unsigned icanon)
 {
 }
 static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)
index 9239d033a0a3a94f503d11682bf6324a53179bd8..2002344ed36ad9de8c152b666eff10922ba930b8 100644 (file)
@@ -11,7 +11,7 @@ void tty_schedule_flip(struct tty_struct *tty);
 static inline int tty_insert_flip_char(struct tty_struct *tty,
                                        unsigned char ch, char flag)
 {
-       struct tty_buffer *tb = tty->buf.tail;
+       struct tty_buffer *tb = tty->port->buf.tail;
        if (tb && tb->used < tb->size) {
                tb->flag_buf_ptr[tb->used] = flag;
                tb->char_buf_ptr[tb->used++] = ch;
index f8cd4cf3fad870d97204e3cf281d72e137db146c..7d5b6000378bbbdaf8a4fe7316ab93786429cf3a 100644 (file)
@@ -2651,6 +2651,15 @@ unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
  */
 unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
 
+/**
+ * ieee80211_get_mesh_hdrlen - get mesh extension header length
+ * @meshhdr: the mesh extension header, only the flags field
+ *     (first byte) will be accessed
+ * Returns the length of the extension header, which is always at
+ * least 6 bytes and at most 18 if address 5 and 6 are present.
+ */
+unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
+
 /**
  * DOC: Data path helpers
  *
index bc056687f647f7aa9965d5ec4b297bbe9459e557..93896ad1fcdd70164c4254bd792d9b10da992b68 100644 (file)
@@ -132,6 +132,7 @@ struct snd_card {
        int shutdown;                   /* this card is going down */
        int free_on_last_close;         /* free in context of file_release */
        wait_queue_head_t shutdown_sleep;
+       atomic_t refcount;              /* refcount for disconnection */
        struct device *dev;             /* device assigned to this card */
        struct device *card_dev;        /* cardX object for sysfs */
 
@@ -189,6 +190,7 @@ struct snd_minor {
        const struct file_operations *f_ops;    /* file operations */
        void *private_data;             /* private data for f_ops->open */
        struct device *dev;             /* device for sysfs */
+       struct snd_card *card_ptr;      /* assigned card instance */
 };
 
 /* return a device pointer linked to each sound device as a parent */
@@ -295,6 +297,7 @@ int snd_card_info_done(void);
 int snd_component_add(struct snd_card *card, const char *component);
 int snd_card_file_add(struct snd_card *card, struct file *file);
 int snd_card_file_remove(struct snd_card *card, struct file *file);
+void snd_card_unref(struct snd_card *card);
 
 #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr))
 
index 15ba03bdd7c69e9b4426aa3396ac772512b3e163..d06b6da5c1e3e146d500bae9b012b809d831cb25 100644 (file)
@@ -377,6 +377,14 @@ DECLARE_EVENT_CLASS(xen_mmu_pgd,
 DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_pin);
 DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_unpin);
 
+TRACE_EVENT(xen_mmu_flush_tlb_all,
+           TP_PROTO(int x),
+           TP_ARGS(x),
+           TP_STRUCT__entry(__array(char, x, 0)),
+           TP_fast_assign((void)x),
+           TP_printk("%s", "")
+       );
+
 TRACE_EVENT(xen_mmu_flush_tlb,
            TP_PROTO(int x),
            TP_ARGS(x),
index 8c99ce7202c53bcd93887c93dd8d8e75ebcd8aa2..2c267bcbb85c1c4e31b676127db7686d8d027e09 100644 (file)
@@ -25,7 +25,6 @@
 #define EPOLL_CTL_ADD 1
 #define EPOLL_CTL_DEL 2
 #define EPOLL_CTL_MOD 3
-#define EPOLL_CTL_DISABLE 4
 
 /*
  * Request the handling of system wakeup events so as to prevent system suspends
index aafaa5aa54d46bb9a93a8137a22344408298223f..e2c3d25405d7e20de2dc708088b0399350bd861f 100644 (file)
@@ -1 +1,3 @@
 # UAPI Header export list
+header-y += md_p.h
+header-y += md_u.h
diff --git a/include/uapi/linux/raid/md_u.h b/include/uapi/linux/raid/md_u.h
new file mode 100644 (file)
index 0000000..4133e74
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+   md_u.h : user <=> kernel API between Linux raidtools and RAID drivers
+          Copyright (C) 1998 Ingo Molnar
+         
+   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, or (at your option)
+   any later version.
+   
+   You should have received a copy of the GNU General Public License
+   (for example /usr/src/linux/COPYING); if not, write to the Free
+   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
+*/
+
+#ifndef _UAPI_MD_U_H
+#define _UAPI_MD_U_H
+
+/*
+ * Different major versions are not compatible.
+ * Different minor versions are only downward compatible.
+ * Different patchlevel versions are downward and upward compatible.
+ */
+#define MD_MAJOR_VERSION                0
+#define MD_MINOR_VERSION                90
+/*
+ * MD_PATCHLEVEL_VERSION indicates kernel functionality.
+ * >=1 means different superblock formats are selectable using SET_ARRAY_INFO
+ *     and major_version/minor_version accordingly
+ * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
+ *     in the super status byte
+ * >=3 means that bitmap superblock version 4 is supported, which uses
+ *     little-ending representation rather than host-endian
+ */
+#define MD_PATCHLEVEL_VERSION           3
+
+/* ioctls */
+
+/* status */
+#define RAID_VERSION           _IOR (MD_MAJOR, 0x10, mdu_version_t)
+#define GET_ARRAY_INFO         _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
+#define GET_DISK_INFO          _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
+#define PRINT_RAID_DEBUG       _IO (MD_MAJOR, 0x13)
+#define RAID_AUTORUN           _IO (MD_MAJOR, 0x14)
+#define GET_BITMAP_FILE                _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
+
+/* configuration */
+#define CLEAR_ARRAY            _IO (MD_MAJOR, 0x20)
+#define ADD_NEW_DISK           _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
+#define HOT_REMOVE_DISK                _IO (MD_MAJOR, 0x22)
+#define SET_ARRAY_INFO         _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
+#define SET_DISK_INFO          _IO (MD_MAJOR, 0x24)
+#define WRITE_RAID_INFO                _IO (MD_MAJOR, 0x25)
+#define UNPROTECT_ARRAY                _IO (MD_MAJOR, 0x26)
+#define PROTECT_ARRAY          _IO (MD_MAJOR, 0x27)
+#define HOT_ADD_DISK           _IO (MD_MAJOR, 0x28)
+#define SET_DISK_FAULTY                _IO (MD_MAJOR, 0x29)
+#define HOT_GENERATE_ERROR     _IO (MD_MAJOR, 0x2a)
+#define SET_BITMAP_FILE                _IOW (MD_MAJOR, 0x2b, int)
+
+/* usage */
+#define RUN_ARRAY              _IOW (MD_MAJOR, 0x30, mdu_param_t)
+/*  0x31 was START_ARRAY  */
+#define STOP_ARRAY             _IO (MD_MAJOR, 0x32)
+#define STOP_ARRAY_RO          _IO (MD_MAJOR, 0x33)
+#define RESTART_ARRAY_RW       _IO (MD_MAJOR, 0x34)
+
+/* 63 partitions with the alternate major number (mdp) */
+#define MdpMinorShift 6
+
+typedef struct mdu_version_s {
+       int major;
+       int minor;
+       int patchlevel;
+} mdu_version_t;
+
+typedef struct mdu_array_info_s {
+       /*
+        * Generic constant information
+        */
+       int major_version;
+       int minor_version;
+       int patch_version;
+       int ctime;
+       int level;
+       int size;
+       int nr_disks;
+       int raid_disks;
+       int md_minor;
+       int not_persistent;
+
+       /*
+        * Generic state information
+        */
+       int utime;              /*  0 Superblock update time                  */
+       int state;              /*  1 State bits (clean, ...)                 */
+       int active_disks;       /*  2 Number of currently active disks        */
+       int working_disks;      /*  3 Number of working disks                 */
+       int failed_disks;       /*  4 Number of failed disks                  */
+       int spare_disks;        /*  5 Number of spare disks                   */
+
+       /*
+        * Personality information
+        */
+       int layout;             /*  0 the array's physical layout             */
+       int chunk_size; /*  1 chunk size in bytes                     */
+
+} mdu_array_info_t;
+
+/* non-obvious values for 'level' */
+#define        LEVEL_MULTIPATH         (-4)
+#define        LEVEL_LINEAR            (-1)
+#define        LEVEL_FAULTY            (-5)
+
+/* we need a value for 'no level specified' and 0
+ * means 'raid0', so we need something else.  This is
+ * for internal use only
+ */
+#define        LEVEL_NONE              (-1000000)
+
+typedef struct mdu_disk_info_s {
+       /*
+        * configuration/status of one particular disk
+        */
+       int number;
+       int major;
+       int minor;
+       int raid_disk;
+       int state;
+
+} mdu_disk_info_t;
+
+typedef struct mdu_start_info_s {
+       /*
+        * configuration/status of one particular disk
+        */
+       int major;
+       int minor;
+       int raid_disk;
+       int state;
+
+} mdu_start_info_t;
+
+typedef struct mdu_bitmap_file_s
+{
+       char pathname[4096];
+} mdu_bitmap_file_t;
+
+typedef struct mdu_param_s
+{
+       int                     personality;    /* 1,2,3,4 */
+       int                     chunk_size;     /* in bytes */
+       int                     max_fault;      /* unused for now */
+} mdu_param_t;
+
+#endif /* _UAPI_MD_U_H */
index 3729173b7fbcec618be006af9fa8507824a6db7c..88c829466fc1151c61edac08789939d0c00aba47 100644 (file)
@@ -314,6 +314,19 @@ int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel);
 int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel);
 void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel);
 
+enum omapdss_version {
+       OMAPDSS_VER_UNKNOWN = 0,
+       OMAPDSS_VER_OMAP24xx,
+       OMAPDSS_VER_OMAP34xx_ES1,       /* OMAP3430 ES1.0, 2.0 */
+       OMAPDSS_VER_OMAP34xx_ES3,       /* OMAP3430 ES3.0+ */
+       OMAPDSS_VER_OMAP3630,
+       OMAPDSS_VER_AM35xx,
+       OMAPDSS_VER_OMAP4430_ES1,       /* OMAP4430 ES1.0 */
+       OMAPDSS_VER_OMAP4430_ES2,       /* OMAP4430 ES2.0, 2.1, 2.2 */
+       OMAPDSS_VER_OMAP4,              /* All other OMAP4s */
+       OMAPDSS_VER_OMAP5,
+};
+
 /* Board specific data */
 struct omap_dss_board_info {
        int (*get_context_loss_count)(struct device *dev);
@@ -323,6 +336,7 @@ struct omap_dss_board_info {
        int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask);
        void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask);
        int (*set_min_bus_tput)(struct device *dev, unsigned long r);
+       enum omapdss_version version;
 };
 
 /* Init with the board info */
similarity index 95%
rename from arch/arm/plat-omap/include/plat/vrfb.h
rename to include/video/omapvrfb.h
index 3792bdea2f6dcbb0be40fe8de0387e49efaf1be7..bb0bd89f8bc6b0a83b6fa2ec12610be6e822339a 100644 (file)
@@ -36,6 +36,7 @@ struct vrfb {
 };
 
 #ifdef CONFIG_OMAP2_VRFB
+extern bool omap_vrfb_supported(void);
 extern int omap_vrfb_request_ctx(struct vrfb *vrfb);
 extern void omap_vrfb_release_ctx(struct vrfb *vrfb);
 extern void omap_vrfb_adjust_size(u16 *width, u16 *height,
@@ -49,6 +50,7 @@ extern int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot);
 extern void omap_vrfb_restore_context(void);
 
 #else
+static inline bool omap_vrfb_supported(void) { return false; }
 static inline int omap_vrfb_request_ctx(struct vrfb *vrfb) { return 0; }
 static inline void omap_vrfb_release_ctx(struct vrfb *vrfb) {}
 static inline void omap_vrfb_adjust_size(u16 *width, u16 *height,
index b193fa2f9fddb2ef6670a7e1aa7f27ef4b60edbe..13e43e41637dad471aa9c7033474c57596260371 100644 (file)
@@ -5,6 +5,36 @@
 #include <xen/interface/hvm/params.h>
 #include <asm/xen/hypercall.h>
 
+static const char *param_name(int op)
+{
+#define PARAM(x) [HVM_PARAM_##x] = #x
+       static const char *const names[] = {
+               PARAM(CALLBACK_IRQ),
+               PARAM(STORE_PFN),
+               PARAM(STORE_EVTCHN),
+               PARAM(PAE_ENABLED),
+               PARAM(IOREQ_PFN),
+               PARAM(BUFIOREQ_PFN),
+               PARAM(TIMER_MODE),
+               PARAM(HPET_ENABLED),
+               PARAM(IDENT_PT),
+               PARAM(DM_DOMAIN),
+               PARAM(ACPI_S_STATE),
+               PARAM(VM86_TSS),
+               PARAM(VPT_ALIGN),
+               PARAM(CONSOLE_PFN),
+               PARAM(CONSOLE_EVTCHN),
+       };
+#undef PARAM
+
+       if (op >= ARRAY_SIZE(names))
+               return "unknown";
+
+       if (!names[op])
+               return "reserved";
+
+       return names[op];
+}
 static inline int hvm_get_parameter(int idx, uint64_t *value)
 {
        struct xen_hvm_param xhv;
@@ -14,8 +44,8 @@ static inline int hvm_get_parameter(int idx, uint64_t *value)
        xhv.index = idx;
        r = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv);
        if (r < 0) {
-               printk(KERN_ERR "Cannot get hvm parameter %d: %d!\n",
-                       idx, r);
+               printk(KERN_ERR "Cannot get hvm parameter %s (%d): %d!\n",
+                       param_name(idx), idx, r);
                return r;
        }
        *value = xhv.value;
index 9cf77ab138a68738bb6926b8b31aaf6ba8cd4f6e..e33e09df3cbc61ad11736776ef4138010df1de8e 100644 (file)
@@ -442,9 +442,11 @@ void __init __weak smp_setup_processor_id(void)
 {
 }
 
+# if THREAD_SIZE >= PAGE_SIZE
 void __init __weak thread_info_cache_init(void)
 {
 }
+#endif
 
 /*
  * Set up kernel memory allocators
index 6085f5ef88eaf1fd95159f3db724b16cf43b54d3..6e48c3a43599b6f5d5ce074ec2fbbf8778680ee4 100644 (file)
@@ -2293,12 +2293,17 @@ static void layout_symtab(struct module *mod, struct load_info *info)
        src = (void *)info->hdr + symsect->sh_offset;
        nsrc = symsect->sh_size / sizeof(*src);
 
+       /* strtab always starts with a nul, so offset 0 is the empty string. */
+       strtab_size = 1;
+
        /* Compute total space required for the core symbols' strtab. */
-       for (ndst = i = strtab_size = 1; i < nsrc; ++i, ++src)
-               if (is_core_symbol(src, info->sechdrs, info->hdr->e_shnum)) {
-                       strtab_size += strlen(&info->strtab[src->st_name]) + 1;
+       for (ndst = i = 0; i < nsrc; i++) {
+               if (i == 0 ||
+                   is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum)) {
+                       strtab_size += strlen(&info->strtab[src[i].st_name])+1;
                        ndst++;
                }
+       }
 
        /* Append room for core symbols at end of core part. */
        info->symoffs = ALIGN(mod->core_size, symsect->sh_addralign ?: 1);
@@ -2332,15 +2337,15 @@ static void add_kallsyms(struct module *mod, const struct load_info *info)
        mod->core_symtab = dst = mod->module_core + info->symoffs;
        mod->core_strtab = s = mod->module_core + info->stroffs;
        src = mod->symtab;
-       *dst = *src;
        *s++ = 0;
-       for (ndst = i = 1; i < mod->num_symtab; ++i, ++src) {
-               if (!is_core_symbol(src, info->sechdrs, info->hdr->e_shnum))
-                       continue;
-
-               dst[ndst] = *src;
-               dst[ndst++].st_name = s - mod->core_strtab;
-               s += strlcpy(s, &mod->strtab[src->st_name], KSYM_NAME_LEN) + 1;
+       for (ndst = i = 0; i < mod->num_symtab; i++) {
+               if (i == 0 ||
+                   is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum)) {
+                       dst[ndst] = src[i];
+                       dst[ndst++].st_name = s - mod->core_strtab;
+                       s += strlcpy(s, &mod->strtab[src[i].st_name],
+                                    KSYM_NAME_LEN) + 1;
+               }
        }
        mod->core_num_syms = ndst;
 }
index 2d607f4d1797cb02e0e4fb60453312a8d3491975..22e070f3470a66569f12d917bcf9b655f4817d4d 100644 (file)
@@ -87,6 +87,12 @@ static DEFINE_SEMAPHORE(console_sem);
 struct console *console_drivers;
 EXPORT_SYMBOL_GPL(console_drivers);
 
+#ifdef CONFIG_LOCKDEP
+static struct lockdep_map console_lock_dep_map = {
+       .name = "console_lock"
+};
+#endif
+
 /*
  * This is used for debugging the mess that is the VT code by
  * keeping track if we have the console semaphore held. It's
@@ -1908,12 +1914,14 @@ static int __cpuinit console_cpu_notify(struct notifier_block *self,
  */
 void console_lock(void)
 {
-       BUG_ON(in_interrupt());
+       might_sleep();
+
        down(&console_sem);
        if (console_suspended)
                return;
        console_locked = 1;
        console_may_schedule = 1;
+       mutex_acquire(&console_lock_dep_map, 0, 0, _RET_IP_);
 }
 EXPORT_SYMBOL(console_lock);
 
@@ -1935,6 +1943,7 @@ int console_trylock(void)
        }
        console_locked = 1;
        console_may_schedule = 0;
+       mutex_acquire(&console_lock_dep_map, 0, 1, _RET_IP_);
        return 1;
 }
 EXPORT_SYMBOL(console_trylock);
@@ -2095,6 +2104,7 @@ skip:
                local_irq_restore(flags);
        }
        console_locked = 0;
+       mutex_release(&console_lock_dep_map, 1, _RET_IP_);
 
        /* Release the exclusive_console once it is used */
        if (unlikely(exclusive_console))
index 2624edcfb42095d6e91ae79c7ca30e0e4838a0fd..8b055e9379bc23105dea4e58d6bebe2600756a4b 100644 (file)
@@ -3017,6 +3017,8 @@ static int kswapd(void *p)
                                                &balanced_classzone_idx);
                }
        }
+
+       current->reclaim_state = NULL;
        return 0;
 }
 
index 159aa8bef9e7fe2f89f9b508c39a209aa92d3c0d..3ef1759403b411fe53595e2ddf1eb6314a4f9ef8 100644 (file)
@@ -2300,10 +2300,11 @@ restart:
                        mutex_unlock(&con->mutex);
                        return;
                } else {
-                       con->ops->put(con);
                        dout("con_work %p FAILED to back off %lu\n", con,
                             con->delay);
+                       set_bit(CON_FLAG_BACKOFF, &con->flags);
                }
+               goto done;
        }
 
        if (con->state == CON_STATE_STANDBY) {
@@ -2749,7 +2750,8 @@ static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip)
                msg = con->ops->alloc_msg(con, hdr, skip);
                mutex_lock(&con->mutex);
                if (con->state != CON_STATE_OPEN) {
-                       ceph_msg_put(msg);
+                       if (msg)
+                               ceph_msg_put(msg);
                        return -EAGAIN;
                }
                con->in_msg = msg;
index 09cb3f6dc40c4a573a9597ca851b9a91a09a1c3d..bda6d004f9f0940df66a00170e8a0d6b52dd540a 100644 (file)
@@ -1666,7 +1666,7 @@ static inline int deliver_skb(struct sk_buff *skb,
 
 static inline bool skb_loop_sk(struct packet_type *ptype, struct sk_buff *skb)
 {
-       if (ptype->af_packet_priv == NULL)
+       if (!ptype->af_packet_priv || !skb->sk)
                return false;
 
        if (ptype->id_match)
index 76d4c2c3c89b9d170e89c39fbf0ed5729621a0bc..fad649ae4decbf393c52b614dc8be0aef07e0750 100644 (file)
@@ -2192,7 +2192,8 @@ static int nlmsg_populate_fdb(struct sk_buff *skb,
                        goto skip;
 
                err = nlmsg_populate_fdb_fill(skb, dev, ha->addr,
-                                             portid, seq, 0, NTF_SELF);
+                                             portid, seq,
+                                             RTM_NEWNEIGH, NTF_SELF);
                if (err < 0)
                        return err;
 skip:
index 535584c00f9118fe33a17e79b858e66935f424f9..0c34bfabc11fc8bcb8056a67abf0feb0b652154f 100644 (file)
@@ -892,13 +892,16 @@ static int __inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
                struct inet_diag_req_v2 *r, struct nlattr *bc)
 {
        const struct inet_diag_handler *handler;
+       int err = 0;
 
        handler = inet_diag_lock_handler(r->sdiag_protocol);
        if (!IS_ERR(handler))
                handler->dump(skb, cb, r, bc);
+       else
+               err = PTR_ERR(handler);
        inet_diag_unlock_handler(handler);
 
-       return skb->len;
+       return err ? : skb->len;
 }
 
 static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
index 9e0ffaf1d942624cf44d9693922e13312fc77ff2..a82047282dbbe2513615ae0c0e60dc1c54b2aa92 100644 (file)
@@ -184,7 +184,8 @@ nf_nat_ipv4_out(unsigned int hooknum,
 
                if ((ct->tuplehash[dir].tuple.src.u3.ip !=
                     ct->tuplehash[!dir].tuple.dst.u3.ip) ||
-                   (ct->tuplehash[dir].tuple.src.u.all !=
+                   (ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMP &&
+                    ct->tuplehash[dir].tuple.src.u.all !=
                     ct->tuplehash[!dir].tuple.dst.u.all))
                        if (nf_xfrm_me_harder(skb, AF_INET) < 0)
                                ret = NF_DROP;
@@ -221,6 +222,7 @@ nf_nat_ipv4_local_fn(unsigned int hooknum,
                }
 #ifdef CONFIG_XFRM
                else if (!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) &&
+                        ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMP &&
                         ct->tuplehash[dir].tuple.dst.u.all !=
                         ct->tuplehash[!dir].tuple.src.u.all)
                        if (nf_xfrm_me_harder(skb, AF_INET) < 0)
index 813b43a76fece71e2614878a5830962d55f35a22..834857f3c8713e8d8b80ab7b4f413725ec0ca9b4 100644 (file)
@@ -313,11 +313,13 @@ static void tcp_illinois_info(struct sock *sk, u32 ext,
                        .tcpv_rttcnt = ca->cnt_rtt,
                        .tcpv_minrtt = ca->base_rtt,
                };
-               u64 t = ca->sum_rtt;
 
-               do_div(t, ca->cnt_rtt);
-               info.tcpv_rtt = t;
+               if (info.tcpv_rttcnt > 0) {
+                       u64 t = ca->sum_rtt;
 
+                       do_div(t, info.tcpv_rttcnt);
+                       info.tcpv_rtt = t;
+               }
                nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info);
        }
 }
index 1db6639835877bfef79df2d88034bb0e1fdfa082..2c2b13a999eae522c264a97a3d43baaa45c53c7b 100644 (file)
@@ -4529,6 +4529,9 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size)
        struct tcphdr *th;
        bool fragstolen;
 
+       if (size == 0)
+               return 0;
+
        skb = alloc_skb(size + sizeof(*th), sk->sk_allocation);
        if (!skb)
                goto err;
index 4c752a6e0bcd91b0b932b483a2b9f988908c04a2..53bc5847bfa882a34c3d5a34257ec82a3fe92873 100644 (file)
@@ -864,7 +864,7 @@ static int parse_nl_addr(struct genl_info *info, struct inetpeer_addr *addr,
        }
        a = info->attrs[TCP_METRICS_ATTR_ADDR_IPV6];
        if (a) {
-               if (nla_len(a) != sizeof(sizeof(struct in6_addr)))
+               if (nla_len(a) != sizeof(struct in6_addr))
                        return -EINVAL;
                addr->family = AF_INET6;
                memcpy(addr->addr.a6, nla_data(a), sizeof(addr->addr.a6));
index 0185679c5f536c1fa98d71ac90a2c24cd6481d8f..d5cb3c4e66f888bf056b4103cfd684f8a3e0a7a0 100644 (file)
@@ -1633,9 +1633,9 @@ static size_t ip6gre_get_size(const struct net_device *dev)
                /* IFLA_GRE_OKEY */
                nla_total_size(4) +
                /* IFLA_GRE_LOCAL */
-               nla_total_size(4) +
+               nla_total_size(sizeof(struct in6_addr)) +
                /* IFLA_GRE_REMOTE */
-               nla_total_size(4) +
+               nla_total_size(sizeof(struct in6_addr)) +
                /* IFLA_GRE_TTL */
                nla_total_size(1) +
                /* IFLA_GRE_TOS */
@@ -1659,8 +1659,8 @@ static int ip6gre_fill_info(struct sk_buff *skb, const struct net_device *dev)
            nla_put_be16(skb, IFLA_GRE_OFLAGS, p->o_flags) ||
            nla_put_be32(skb, IFLA_GRE_IKEY, p->i_key) ||
            nla_put_be32(skb, IFLA_GRE_OKEY, p->o_key) ||
-           nla_put(skb, IFLA_GRE_LOCAL, sizeof(struct in6_addr), &p->raddr) ||
-           nla_put(skb, IFLA_GRE_REMOTE, sizeof(struct in6_addr), &p->laddr) ||
+           nla_put(skb, IFLA_GRE_LOCAL, sizeof(struct in6_addr), &p->laddr) ||
+           nla_put(skb, IFLA_GRE_REMOTE, sizeof(struct in6_addr), &p->raddr) ||
            nla_put_u8(skb, IFLA_GRE_TTL, p->hop_limit) ||
            /*nla_put_u8(skb, IFLA_GRE_TOS, t->priority) ||*/
            nla_put_u8(skb, IFLA_GRE_ENCAP_LIMIT, p->encap_limit) ||
index ff36194a71aa7dd0fe0f707cff80afd83e40102e..2edce30ef7338cdf1916eef98b353c7dbbc7bcda 100644 (file)
@@ -535,7 +535,7 @@ static void ndisc_send_unsol_na(struct net_device *dev)
 {
        struct inet6_dev *idev;
        struct inet6_ifaddr *ifa;
-       struct in6_addr mcaddr;
+       struct in6_addr mcaddr = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
 
        idev = in6_dev_get(dev);
        if (!idev)
@@ -543,7 +543,6 @@ static void ndisc_send_unsol_na(struct net_device *dev)
 
        read_lock_bh(&idev->lock);
        list_for_each_entry(ifa, &idev->addr_list, if_list) {
-               addrconf_addr_solict_mult(&ifa->addr, &mcaddr);
                ndisc_send_na(dev, NULL, &mcaddr, &ifa->addr,
                              /*router=*/ !!idev->cnf.forwarding,
                              /*solicited=*/ false, /*override=*/ true,
index e418bd6350a405c9912f09207b876d1151961551..d57dab17a18251fcb8c63fc27c2dddfe8bc2a89e 100644 (file)
@@ -186,7 +186,8 @@ nf_nat_ipv6_out(unsigned int hooknum,
 
                if (!nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.src.u3,
                                      &ct->tuplehash[!dir].tuple.dst.u3) ||
-                   (ct->tuplehash[dir].tuple.src.u.all !=
+                   (ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMPV6 &&
+                    ct->tuplehash[dir].tuple.src.u.all !=
                     ct->tuplehash[!dir].tuple.dst.u.all))
                        if (nf_xfrm_me_harder(skb, AF_INET6) < 0)
                                ret = NF_DROP;
@@ -222,6 +223,7 @@ nf_nat_ipv6_local_fn(unsigned int hooknum,
                }
 #ifdef CONFIG_XFRM
                else if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) &&
+                        ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMPV6 &&
                         ct->tuplehash[dir].tuple.dst.u.all !=
                         ct->tuplehash[!dir].tuple.src.u.all)
                        if (nf_xfrm_me_harder(skb, AF_INET6))
index 18bd9bbbd1c6c0f50d8bf74c947c05f91a4f20cd..22c8ea9511852e963b982ad68ed7066bda262ad2 100644 (file)
@@ -85,7 +85,7 @@ static struct ctl_table nf_ct_frag6_sysctl_table[] = {
        { }
 };
 
-static int __net_init nf_ct_frag6_sysctl_register(struct net *net)
+static int nf_ct_frag6_sysctl_register(struct net *net)
 {
        struct ctl_table *table;
        struct ctl_table_header *hdr;
@@ -127,7 +127,7 @@ static void __net_exit nf_ct_frags6_sysctl_unregister(struct net *net)
 }
 
 #else
-static int __net_init nf_ct_frag6_sysctl_register(struct net *net)
+static int nf_ct_frag6_sysctl_register(struct net *net)
 {
        return 0;
 }
index 37b8b8ba31f7395001cd2f36e234d82878bc22c7..76125c57ee6dddd2396a8a0bef4f19e7720e43ed 100644 (file)
@@ -291,6 +291,7 @@ static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 p
 
 out_del_dev:
        free_netdev(dev);
+       spriv->dev = NULL;
 out_del_session:
        l2tp_session_delete(session);
 out:
index 5f3620f0bc0a651257aa53e28b91c4b2114be637..bf87c70ac6c5fe1e2b920c6db827e1e9da6abe36 100644 (file)
@@ -1108,7 +1108,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
        sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH;
        sdata->u.ibss.ibss_join_req = jiffies;
 
-       memcpy(sdata->u.ibss.ssid, params->ssid, IEEE80211_MAX_SSID_LEN);
+       memcpy(sdata->u.ibss.ssid, params->ssid, params->ssid_len);
        sdata->u.ibss.ssid_len = params->ssid_len;
 
        mutex_unlock(&sdata->u.ibss.mtx);
index 61c621e9273fe70c26978d42433d58fca60a80b8..00ade7feb2e3a3b84af12be5bfad378bd8907182 100644 (file)
@@ -531,6 +531,11 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx)
 
                if (ieee80211_is_action(hdr->frame_control)) {
                        u8 category;
+
+                       /* make sure category field is present */
+                       if (rx->skb->len < IEEE80211_MIN_ACTION_SIZE)
+                               return RX_DROP_MONITOR;
+
                        mgmt = (struct ieee80211_mgmt *)hdr;
                        category = mgmt->u.action.category;
                        if (category != WLAN_CATEGORY_MESH_ACTION &&
@@ -883,14 +888,16 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
                 */
                if (rx->sta && rx->sdata->vif.type == NL80211_IFTYPE_STATION &&
                    ieee80211_is_data_present(hdr->frame_control)) {
-                       u16 ethertype;
-                       u8 *payload;
-
-                       payload = rx->skb->data +
-                               ieee80211_hdrlen(hdr->frame_control);
-                       ethertype = (payload[6] << 8) | payload[7];
-                       if (cpu_to_be16(ethertype) ==
-                           rx->sdata->control_port_protocol)
+                       unsigned int hdrlen;
+                       __be16 ethertype;
+
+                       hdrlen = ieee80211_hdrlen(hdr->frame_control);
+
+                       if (rx->skb->len < hdrlen + 8)
+                               return RX_DROP_MONITOR;
+
+                       skb_copy_bits(rx->skb, hdrlen + 6, &ethertype, 2);
+                       if (ethertype == rx->sdata->control_port_protocol)
                                return RX_CONTINUE;
                }
 
@@ -1462,11 +1469,14 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
 
        hdr = (struct ieee80211_hdr *)rx->skb->data;
        fc = hdr->frame_control;
+
+       if (ieee80211_is_ctl(fc))
+               return RX_CONTINUE;
+
        sc = le16_to_cpu(hdr->seq_ctrl);
        frag = sc & IEEE80211_SCTL_FRAG;
 
        if (likely((!ieee80211_has_morefrags(fc) && frag == 0) ||
-                  (rx->skb)->len < 24 ||
                   is_multicast_ether_addr(hdr->addr1))) {
                /* not fragmented */
                goto out;
@@ -1889,6 +1899,20 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 
        hdr = (struct ieee80211_hdr *) skb->data;
        hdrlen = ieee80211_hdrlen(hdr->frame_control);
+
+       /* make sure fixed part of mesh header is there, also checks skb len */
+       if (!pskb_may_pull(rx->skb, hdrlen + 6))
+               return RX_DROP_MONITOR;
+
+       mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen);
+
+       /* make sure full mesh header is there, also checks skb len */
+       if (!pskb_may_pull(rx->skb,
+                          hdrlen + ieee80211_get_mesh_hdrlen(mesh_hdr)))
+               return RX_DROP_MONITOR;
+
+       /* reload pointers */
+       hdr = (struct ieee80211_hdr *) skb->data;
        mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen);
 
        /* frame is in RMC, don't forward */
@@ -1897,7 +1921,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
            mesh_rmc_check(hdr->addr3, mesh_hdr, rx->sdata))
                return RX_DROP_MONITOR;
 
-       if (!ieee80211_is_data(hdr->frame_control))
+       if (!ieee80211_is_data(hdr->frame_control) ||
+           !(status->rx_flags & IEEE80211_RX_RA_MATCH))
                return RX_CONTINUE;
 
        if (!mesh_hdr->ttl)
@@ -1911,9 +1936,12 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
                if (is_multicast_ether_addr(hdr->addr1)) {
                        mpp_addr = hdr->addr3;
                        proxied_addr = mesh_hdr->eaddr1;
-               } else {
+               } else if (mesh_hdr->flags & MESH_FLAGS_AE_A5_A6) {
+                       /* has_a4 already checked in ieee80211_rx_mesh_check */
                        mpp_addr = hdr->addr4;
                        proxied_addr = mesh_hdr->eaddr2;
+               } else {
+                       return RX_DROP_MONITOR;
                }
 
                rcu_read_lock();
@@ -1941,12 +1969,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
        }
        skb_set_queue_mapping(skb, q);
 
-       if (!(status->rx_flags & IEEE80211_RX_RA_MATCH))
-               goto out;
-
        if (!--mesh_hdr->ttl) {
                IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl);
-               return RX_DROP_MONITOR;
+               goto out;
        }
 
        if (!ifmsh->mshcfg.dot11MeshForwarding)
@@ -2353,6 +2378,10 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
                }
                break;
        case WLAN_CATEGORY_SELF_PROTECTED:
+               if (len < (IEEE80211_MIN_ACTION_SIZE +
+                          sizeof(mgmt->u.action.u.self_prot.action_code)))
+                       break;
+
                switch (mgmt->u.action.u.self_prot.action_code) {
                case WLAN_SP_MESH_PEERING_OPEN:
                case WLAN_SP_MESH_PEERING_CLOSE:
@@ -2371,6 +2400,10 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
                }
                break;
        case WLAN_CATEGORY_MESH_ACTION:
+               if (len < (IEEE80211_MIN_ACTION_SIZE +
+                          sizeof(mgmt->u.action.u.mesh_action.action_code)))
+                       break;
+
                if (!ieee80211_vif_is_mesh(&sdata->vif))
                        break;
                if (mesh_action_is_path_sel(mgmt) &&
@@ -2913,10 +2946,15 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
        if (ieee80211_is_data(fc) || ieee80211_is_mgmt(fc))
                local->dot11ReceivedFragmentCount++;
 
-       if (ieee80211_is_mgmt(fc))
-               err = skb_linearize(skb);
-       else
+       if (ieee80211_is_mgmt(fc)) {
+               /* drop frame if too short for header */
+               if (skb->len < ieee80211_hdrlen(fc))
+                       err = -ENOBUFS;
+               else
+                       err = skb_linearize(skb);
+       } else {
                err = !pskb_may_pull(skb, ieee80211_hdrlen(fc));
+       }
 
        if (err) {
                dev_kfree_skb(skb);
index 94e58687397908ae2ef2f71f5d6b68d78c80aea3..239391807ca9cff116576d07975c2ce31db393d3 100644 (file)
@@ -643,13 +643,41 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
                        break;
                }
 
-               if (id != WLAN_EID_VENDOR_SPECIFIC &&
-                   id != WLAN_EID_QUIET &&
-                   test_bit(id, seen_elems)) {
-                       elems->parse_error = true;
-                       left -= elen;
-                       pos += elen;
-                       continue;
+               switch (id) {
+               case WLAN_EID_SSID:
+               case WLAN_EID_SUPP_RATES:
+               case WLAN_EID_FH_PARAMS:
+               case WLAN_EID_DS_PARAMS:
+               case WLAN_EID_CF_PARAMS:
+               case WLAN_EID_TIM:
+               case WLAN_EID_IBSS_PARAMS:
+               case WLAN_EID_CHALLENGE:
+               case WLAN_EID_RSN:
+               case WLAN_EID_ERP_INFO:
+               case WLAN_EID_EXT_SUPP_RATES:
+               case WLAN_EID_HT_CAPABILITY:
+               case WLAN_EID_HT_OPERATION:
+               case WLAN_EID_VHT_CAPABILITY:
+               case WLAN_EID_VHT_OPERATION:
+               case WLAN_EID_MESH_ID:
+               case WLAN_EID_MESH_CONFIG:
+               case WLAN_EID_PEER_MGMT:
+               case WLAN_EID_PREQ:
+               case WLAN_EID_PREP:
+               case WLAN_EID_PERR:
+               case WLAN_EID_RANN:
+               case WLAN_EID_CHANNEL_SWITCH:
+               case WLAN_EID_EXT_CHANSWITCH_ANN:
+               case WLAN_EID_COUNTRY:
+               case WLAN_EID_PWR_CONSTRAINT:
+               case WLAN_EID_TIMEOUT_INTERVAL:
+                       if (test_bit(id, seen_elems)) {
+                               elems->parse_error = true;
+                               left -= elen;
+                               pos += elen;
+                               continue;
+                       }
+                       break;
                }
 
                if (calc_crc && id < 64 && (filter & (1ULL << id)))
index 1b30b0dee70818c4842b1835964ffc5f59e6b6e3..962795e839ab099ce426a27a1dcd4d887bc56eef 100644 (file)
@@ -753,7 +753,8 @@ static int callforward_do_filter(const union nf_inet_addr *src,
                                   flowi4_to_flowi(&fl1), false)) {
                        if (!afinfo->route(&init_net, (struct dst_entry **)&rt2,
                                           flowi4_to_flowi(&fl2), false)) {
-                               if (rt1->rt_gateway == rt2->rt_gateway &&
+                               if (rt_nexthop(rt1, fl1.daddr) ==
+                                   rt_nexthop(rt2, fl2.daddr) &&
                                    rt1->dst.dev  == rt2->dst.dev)
                                        ret = 1;
                                dst_release(&rt2->dst);
index f0dd83cff90652dc870f5bc720f9ae1a404b8931..9687fa1c2275c76cb7033a83657068406d716de7 100644 (file)
  * grp->index is the index of the group; and grp->slot_shift
  * is the shift for the corresponding (scaled) sigma_i.
  */
-#define QFQ_MAX_INDEX          19
-#define QFQ_MAX_WSHIFT         16
+#define QFQ_MAX_INDEX          24
+#define QFQ_MAX_WSHIFT         12
 
 #define        QFQ_MAX_WEIGHT          (1<<QFQ_MAX_WSHIFT)
-#define QFQ_MAX_WSUM           (2*QFQ_MAX_WEIGHT)
+#define QFQ_MAX_WSUM           (16*QFQ_MAX_WEIGHT)
 
 #define FRAC_BITS              30      /* fixed point arithmetic */
 #define ONE_FP                 (1UL << FRAC_BITS)
 #define IWSUM                  (ONE_FP/QFQ_MAX_WSUM)
 
-#define QFQ_MTU_SHIFT          11
+#define QFQ_MTU_SHIFT          16      /* to support TSO/GSO */
 #define QFQ_MIN_SLOT_SHIFT     (FRAC_BITS + QFQ_MTU_SHIFT - QFQ_MAX_INDEX)
+#define QFQ_MIN_LMAX           256     /* min possible lmax for a class */
 
 /*
  * Possible group states.  These values are used as indexes for the bitmaps
@@ -231,6 +232,32 @@ static void qfq_update_class_params(struct qfq_sched *q, struct qfq_class *cl,
        q->wsum += delta_w;
 }
 
+static void qfq_update_reactivate_class(struct qfq_sched *q,
+                                       struct qfq_class *cl,
+                                       u32 inv_w, u32 lmax, int delta_w)
+{
+       bool need_reactivation = false;
+       int i = qfq_calc_index(inv_w, lmax);
+
+       if (&q->groups[i] != cl->grp && cl->qdisc->q.qlen > 0) {
+               /*
+                * shift cl->F back, to not charge the
+                * class for the not-yet-served head
+                * packet
+                */
+               cl->F = cl->S;
+               /* remove class from its slot in the old group */
+               qfq_deactivate_class(q, cl);
+               need_reactivation = true;
+       }
+
+       qfq_update_class_params(q, cl, lmax, inv_w, delta_w);
+
+       if (need_reactivation) /* activate in new group */
+               qfq_activate_class(q, cl, qdisc_peek_len(cl->qdisc));
+}
+
+
 static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
                            struct nlattr **tca, unsigned long *arg)
 {
@@ -238,7 +265,7 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
        struct qfq_class *cl = (struct qfq_class *)*arg;
        struct nlattr *tb[TCA_QFQ_MAX + 1];
        u32 weight, lmax, inv_w;
-       int i, err;
+       int err;
        int delta_w;
 
        if (tca[TCA_OPTIONS] == NULL) {
@@ -270,16 +297,14 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
 
        if (tb[TCA_QFQ_LMAX]) {
                lmax = nla_get_u32(tb[TCA_QFQ_LMAX]);
-               if (!lmax || lmax > (1UL << QFQ_MTU_SHIFT)) {
+               if (lmax < QFQ_MIN_LMAX || lmax > (1UL << QFQ_MTU_SHIFT)) {
                        pr_notice("qfq: invalid max length %u\n", lmax);
                        return -EINVAL;
                }
        } else
-               lmax = 1UL << QFQ_MTU_SHIFT;
+               lmax = psched_mtu(qdisc_dev(sch));
 
        if (cl != NULL) {
-               bool need_reactivation = false;
-
                if (tca[TCA_RATE]) {
                        err = gen_replace_estimator(&cl->bstats, &cl->rate_est,
                                                    qdisc_root_sleeping_lock(sch),
@@ -291,24 +316,8 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
                if (lmax == cl->lmax && inv_w == cl->inv_w)
                        return 0; /* nothing to update */
 
-               i = qfq_calc_index(inv_w, lmax);
                sch_tree_lock(sch);
-               if (&q->groups[i] != cl->grp && cl->qdisc->q.qlen > 0) {
-                       /*
-                        * shift cl->F back, to not charge the
-                        * class for the not-yet-served head
-                        * packet
-                        */
-                       cl->F = cl->S;
-                       /* remove class from its slot in the old group */
-                       qfq_deactivate_class(q, cl);
-                       need_reactivation = true;
-               }
-
-               qfq_update_class_params(q, cl, lmax, inv_w, delta_w);
-
-               if (need_reactivation) /* activate in new group */
-                       qfq_activate_class(q, cl, qdisc_peek_len(cl->qdisc));
+               qfq_update_reactivate_class(q, cl, inv_w, lmax, delta_w);
                sch_tree_unlock(sch);
 
                return 0;
@@ -663,15 +672,48 @@ static void qfq_make_eligible(struct qfq_sched *q, u64 old_V)
 
 
 /*
- * XXX we should make sure that slot becomes less than 32.
- * This is guaranteed by the input values.
- * roundedS is always cl->S rounded on grp->slot_shift bits.
+ * If the weight and lmax (max_pkt_size) of the classes do not change,
+ * then QFQ guarantees that the slot index is never higher than
+ * 2 + ((1<<QFQ_MTU_SHIFT)/QFQ_MIN_LMAX) * (QFQ_MAX_WEIGHT/QFQ_MAX_WSUM).
+ *
+ * With the current values of the above constants, the index is
+ * then guaranteed to never be higher than 2 + 256 * (1 / 16) = 18.
+ *
+ * When the weight of a class is increased or the lmax of the class is
+ * decreased, a new class with smaller slot size may happen to be
+ * activated. The activation of this class should be properly delayed
+ * to when the service of the class has finished in the ideal system
+ * tracked by QFQ. If the activation of the class is not delayed to
+ * this reference time instant, then this class may be unjustly served
+ * before other classes waiting for service. This may cause
+ * (unfrequently) the above bound to the slot index to be violated for
+ * some of these unlucky classes.
+ *
+ * Instead of delaying the activation of the new class, which is quite
+ * complex, the following inaccurate but simple solution is used: if
+ * the slot index is higher than QFQ_MAX_SLOTS-2, then the timestamps
+ * of the class are shifted backward so as to let the slot index
+ * become equal to QFQ_MAX_SLOTS-2. This threshold is used because, if
+ * the slot index is above it, then the data structure implementing
+ * the bucket list either gets immediately corrupted or may get
+ * corrupted on a possible next packet arrival that causes the start
+ * time of the group to be shifted backward.
  */
 static void qfq_slot_insert(struct qfq_group *grp, struct qfq_class *cl,
                            u64 roundedS)
 {
        u64 slot = (roundedS - grp->S) >> grp->slot_shift;
-       unsigned int i = (grp->front + slot) % QFQ_MAX_SLOTS;
+       unsigned int i; /* slot index in the bucket list */
+
+       if (unlikely(slot > QFQ_MAX_SLOTS - 2)) {
+               u64 deltaS = roundedS - grp->S -
+                       ((u64)(QFQ_MAX_SLOTS - 2)<<grp->slot_shift);
+               cl->S -= deltaS;
+               cl->F -= deltaS;
+               slot = QFQ_MAX_SLOTS - 2;
+       }
+
+       i = (grp->front + slot) % QFQ_MAX_SLOTS;
 
        hlist_add_head(&cl->next, &grp->slots[i]);
        __set_bit(slot, &grp->full_slots);
@@ -892,6 +934,13 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
        }
        pr_debug("qfq_enqueue: cl = %x\n", cl->common.classid);
 
+       if (unlikely(cl->lmax < qdisc_pkt_len(skb))) {
+               pr_debug("qfq: increasing maxpkt from %u to %u for class %u",
+                         cl->lmax, qdisc_pkt_len(skb), cl->common.classid);
+               qfq_update_reactivate_class(q, cl, cl->inv_w,
+                                           qdisc_pkt_len(skb), 0);
+       }
+
        err = qdisc_enqueue(skb, cl->qdisc);
        if (unlikely(err != NET_XMIT_SUCCESS)) {
                pr_debug("qfq_enqueue: enqueue failed %d\n", err);
index 59d16ea927f0f83d706d3a59c79d13be0a95c1e8..a60d1f8b41c5e2330e837265e175202aba322fcb 100644 (file)
@@ -974,7 +974,7 @@ SCTP_STATIC int sctp_setsockopt_bindx(struct sock* sk,
        void *addr_buf;
        struct sctp_af *af;
 
-       SCTP_DEBUG_PRINTK("sctp_setsocktopt_bindx: sk %p addrs %p"
+       SCTP_DEBUG_PRINTK("sctp_setsockopt_bindx: sk %p addrs %p"
                          " addrs_size %d opt %d\n", sk, addrs, addrs_size, op);
 
        if (unlikely(addrs_size <= 0))
index 5a3d675d2f2f9f3971b4707474cc511ad328ac2a..a9c0bbccad6bfb787b4ff1630a1eb7a28918e634 100644 (file)
@@ -172,7 +172,7 @@ out_free:
                xprt_free_allocation(req);
 
        dprintk("RPC:       setup backchannel transport failed\n");
-       return -1;
+       return -ENOMEM;
 }
 EXPORT_SYMBOL_GPL(xprt_setup_backchannel);
 
index 111ff8300ae52ed43226f3ec8ab079bdb2e00b9c..b36f0fcd9bdfe76d04adf287687190ada3e9ccca 100644 (file)
@@ -116,7 +116,6 @@ void tipc_handler_stop(void)
                return;
 
        handler_enabled = 0;
-       tasklet_disable(&tipc_tasklet);
        tasklet_kill(&tipc_tasklet);
 
        spin_lock_bh(&qitem_lock);
index 443d4d7deea299c7e997045d22d8b2b146d2c877..3f72530520883ae4aa510516bf7a4ce641c646d8 100644 (file)
@@ -526,8 +526,7 @@ int wiphy_register(struct wiphy *wiphy)
                for (i = 0; i < sband->n_channels; i++) {
                        sband->channels[i].orig_flags =
                                sband->channels[i].flags;
-                       sband->channels[i].orig_mag =
-                               sband->channels[i].max_antenna_gain;
+                       sband->channels[i].orig_mag = INT_MAX;
                        sband->channels[i].orig_mpwr =
                                sband->channels[i].max_power;
                        sband->channels[i].band = band;
index 3b8cbbc214db563ba962ecda1e49fe6929c263cc..bcc7d7ee5a516b8263c93a2556ab079d6d369280 100644 (file)
@@ -908,7 +908,7 @@ static void handle_channel(struct wiphy *wiphy,
                        map_regdom_flags(reg_rule->flags) | bw_flags;
                chan->max_antenna_gain = chan->orig_mag =
                        (int) MBI_TO_DBI(power_rule->max_antenna_gain);
-               chan->max_power = chan->orig_mpwr =
+               chan->max_reg_power = chan->max_power = chan->orig_mpwr =
                        (int) MBM_TO_DBM(power_rule->max_eirp);
                return;
        }
@@ -1331,7 +1331,8 @@ static void handle_channel_custom(struct wiphy *wiphy,
 
        chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags;
        chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain);
-       chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp);
+       chan->max_reg_power = chan->max_power =
+               (int) MBM_TO_DBM(power_rule->max_eirp);
 }
 
 static void handle_band_custom(struct wiphy *wiphy, enum ieee80211_band band,
index ef35f4ef2aa623d16f3556a5e3f4709fba363db4..2762e8329986afd57efd3f7735d1904e221ab05e 100644 (file)
@@ -309,23 +309,21 @@ unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb)
 }
 EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
 
-static int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
+unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
 {
        int ae = meshhdr->flags & MESH_FLAGS_AE;
-       /* 7.1.3.5a.2 */
+       /* 802.11-2012, 8.2.4.7.3 */
        switch (ae) {
+       default:
        case 0:
                return 6;
        case MESH_FLAGS_AE_A4:
                return 12;
        case MESH_FLAGS_AE_A5_A6:
                return 18;
-       case (MESH_FLAGS_AE_A4 | MESH_FLAGS_AE_A5_A6):
-               return 24;
-       default:
-               return 6;
        }
 }
+EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen);
 
 int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
                           enum nl80211_iftype iftype)
@@ -373,6 +371,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
                        /* make sure meshdr->flags is on the linear part */
                        if (!pskb_may_pull(skb, hdrlen + 1))
                                return -1;
+                       if (meshdr->flags & MESH_FLAGS_AE_A4)
+                               return -1;
                        if (meshdr->flags & MESH_FLAGS_AE_A5_A6) {
                                skb_copy_bits(skb, hdrlen +
                                        offsetof(struct ieee80211s_hdr, eaddr1),
@@ -397,6 +397,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
                        /* make sure meshdr->flags is on the linear part */
                        if (!pskb_may_pull(skb, hdrlen + 1))
                                return -1;
+                       if (meshdr->flags & MESH_FLAGS_AE_A5_A6)
+                               return -1;
                        if (meshdr->flags & MESH_FLAGS_AE_A4)
                                skb_copy_bits(skb, hdrlen +
                                        offsetof(struct ieee80211s_hdr, eaddr1),
index dda4b2b619275517826af60a61de2edb731f5524..ecbb44797e28226e85027c277435d053415aec8c 100644 (file)
@@ -16,8 +16,9 @@ PHONY += $(modules)
 __modinst: $(modules)
        @:
 
+# Don't stop modules_install if we can't sign external modules.
 quiet_cmd_modules_install = INSTALL $@
-      cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; $(mod_sign_cmd) $(2)/$(notdir $@)
+      cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD))
 
 # Modules built outside the kernel source tree go into extra by default
 INSTALL_MOD_DIR ?= extra
index 21a9f5de0a2120c26b5f3bd0e70529078766a247..f18750e3bd6c290b285464b193d7d65972b6de19 100755 (executable)
@@ -1890,8 +1890,10 @@ sub process {
                }
 
                if ($realfile =~ m@^(drivers/net/|net/)@ &&
-                   $rawline !~ m@^\+[ \t]*(\/\*|\*\/)@ &&
-                   $rawline =~ m@^\+[ \t]*.+\*\/[ \t]*$@) {
+                   $rawline !~ m@^\+[ \t]*\*/[ \t]*$@ &&       #trailing */
+                   $rawline !~ m@^\+.*/\*.*\*/[ \t]*$@ &&      #inline /*...*/
+                   $rawline !~ m@^\+.*\*{2,}/[ \t]*$@ &&       #trailing **/
+                   $rawline =~ m@^\+[ \t]*.+\*\/[ \t]*$@) {    #non blank */
                        WARN("NETWORKING_BLOCK_COMMENT_STYLE",
                             "networking block comments put the trailing */ on a separate line\n" . $herecurr);
                }
index c40ae573346dd140031af773c532dd4f32f32240..ad11dc994792b4bb080c49a7036b8761731e5a1d 100644 (file)
@@ -100,12 +100,15 @@ static int snd_compr_open(struct inode *inode, struct file *f)
 
        if (dirn != compr->direction) {
                pr_err("this device doesn't support this direction\n");
+               snd_card_unref(compr->card);
                return -EINVAL;
        }
 
        data = kzalloc(sizeof(*data), GFP_KERNEL);
-       if (!data)
+       if (!data) {
+               snd_card_unref(compr->card);
                return -ENOMEM;
+       }
        data->stream.ops = compr->ops;
        data->stream.direction = dirn;
        data->stream.private_data = compr->private_data;
@@ -113,6 +116,7 @@ static int snd_compr_open(struct inode *inode, struct file *f)
        runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
        if (!runtime) {
                kfree(data);
+               snd_card_unref(compr->card);
                return -ENOMEM;
        }
        runtime->state = SNDRV_PCM_STATE_OPEN;
@@ -126,7 +130,8 @@ static int snd_compr_open(struct inode *inode, struct file *f)
                kfree(runtime);
                kfree(data);
        }
-       return ret;
+       snd_card_unref(compr->card);
+       return 0;
 }
 
 static int snd_compr_free(struct inode *inode, struct file *f)
index 7e86a5b9f3b572f9c97f351027ed4e1b9b7b75b3..8c7c2c9bba61e4dd421eb6a0c797bd0cf17b81ae 100644 (file)
@@ -86,6 +86,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
        write_lock_irqsave(&card->ctl_files_rwlock, flags);
        list_add_tail(&ctl->list, &card->ctl_files);
        write_unlock_irqrestore(&card->ctl_files_rwlock, flags);
+       snd_card_unref(card);
        return 0;
 
       __error:
@@ -93,6 +94,8 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
       __error2:
        snd_card_file_remove(card, file);
       __error1:
+       if (card)
+               snd_card_unref(card);
        return err;
 }
 
@@ -1434,6 +1437,8 @@ static ssize_t snd_ctl_read(struct file *file, char __user *buffer,
                        spin_unlock_irq(&ctl->read_lock);
                        schedule();
                        remove_wait_queue(&ctl->change_sleep, &wait);
+                       if (ctl->card->shutdown)
+                               return -ENODEV;
                        if (signal_pending(current))
                                return -ERESTARTSYS;
                        spin_lock_irq(&ctl->read_lock);
index 75ea16f35b1aa1e1db985802e923c86e28f69af3..3f7f6628cf7b1704ed7cdb4094703416697af0a0 100644 (file)
@@ -100,8 +100,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
        if (hw == NULL)
                return -ENODEV;
 
-       if (!try_module_get(hw->card->module))
+       if (!try_module_get(hw->card->module)) {
+               snd_card_unref(hw->card);
                return -EFAULT;
+       }
 
        init_waitqueue_entry(&wait, current);
        add_wait_queue(&hw->open_wait, &wait);
@@ -129,6 +131,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
                mutex_unlock(&hw->open_mutex);
                schedule();
                mutex_lock(&hw->open_mutex);
+               if (hw->card->shutdown) {
+                       err = -ENODEV;
+                       break;
+               }
                if (signal_pending(current)) {
                        err = -ERESTARTSYS;
                        break;
@@ -148,6 +154,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
        mutex_unlock(&hw->open_mutex);
        if (err < 0)
                module_put(hw->card->module);
+       snd_card_unref(hw->card);
        return err;
 }
 
@@ -459,12 +466,15 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device)
                mutex_unlock(&register_mutex);
                return -EINVAL;
        }
+       mutex_lock(&hwdep->open_mutex);
+       wake_up(&hwdep->open_wait);
 #ifdef CONFIG_SND_OSSEMUL
        if (hwdep->ossreg)
                snd_unregister_oss_device(hwdep->oss_type, hwdep->card, hwdep->device);
 #endif
        snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device);
        list_del_init(&hwdep->list);
+       mutex_unlock(&hwdep->open_mutex);
        mutex_unlock(&register_mutex);
        return 0;
 }
index d8ec849af128ed1d248effdd2f606baa52a5f06d..7b012d15c2cf1599e92d0ddc832a6b0ece653e9e 100644 (file)
@@ -213,6 +213,7 @@ int snd_card_create(int idx, const char *xid,
        spin_lock_init(&card->files_lock);
        INIT_LIST_HEAD(&card->files_list);
        init_waitqueue_head(&card->shutdown_sleep);
+       atomic_set(&card->refcount, 0);
 #ifdef CONFIG_PM
        mutex_init(&card->power_lock);
        init_waitqueue_head(&card->power_sleep);
@@ -446,21 +447,36 @@ static int snd_card_do_free(struct snd_card *card)
        return 0;
 }
 
+/**
+ * snd_card_unref - release the reference counter
+ * @card: the card instance
+ *
+ * Decrements the reference counter.  When it reaches to zero, wake up
+ * the sleeper and call the destructor if needed.
+ */
+void snd_card_unref(struct snd_card *card)
+{
+       if (atomic_dec_and_test(&card->refcount)) {
+               wake_up(&card->shutdown_sleep);
+               if (card->free_on_last_close)
+                       snd_card_do_free(card);
+       }
+}
+EXPORT_SYMBOL(snd_card_unref);
+
 int snd_card_free_when_closed(struct snd_card *card)
 {
-       int free_now = 0;
-       int ret = snd_card_disconnect(card);
-       if (ret)
-               return ret;
+       int ret;
 
-       spin_lock(&card->files_lock);
-       if (list_empty(&card->files_list))
-               free_now = 1;
-       else
-               card->free_on_last_close = 1;
-       spin_unlock(&card->files_lock);
+       atomic_inc(&card->refcount);
+       ret = snd_card_disconnect(card);
+       if (ret) {
+               atomic_dec(&card->refcount);
+               return ret;
+       }
 
-       if (free_now)
+       card->free_on_last_close = 1;
+       if (atomic_dec_and_test(&card->refcount))
                snd_card_do_free(card);
        return 0;
 }
@@ -474,7 +490,7 @@ int snd_card_free(struct snd_card *card)
                return ret;
 
        /* wait, until all devices are ready for the free operation */
-       wait_event(card->shutdown_sleep, list_empty(&card->files_list));
+       wait_event(card->shutdown_sleep, !atomic_read(&card->refcount));
        snd_card_do_free(card);
        return 0;
 }
@@ -886,6 +902,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file)
                return -ENODEV;
        }
        list_add(&mfile->list, &card->files_list);
+       atomic_inc(&card->refcount);
        spin_unlock(&card->files_lock);
        return 0;
 }
@@ -908,7 +925,6 @@ EXPORT_SYMBOL(snd_card_file_add);
 int snd_card_file_remove(struct snd_card *card, struct file *file)
 {
        struct snd_monitor_file *mfile, *found = NULL;
-       int last_close = 0;
 
        spin_lock(&card->files_lock);
        list_for_each_entry(mfile, &card->files_list, list) {
@@ -923,19 +939,13 @@ int snd_card_file_remove(struct snd_card *card, struct file *file)
                        break;
                }
        }
-       if (list_empty(&card->files_list))
-               last_close = 1;
        spin_unlock(&card->files_lock);
-       if (last_close) {
-               wake_up(&card->shutdown_sleep);
-               if (card->free_on_last_close)
-                       snd_card_do_free(card);
-       }
        if (!found) {
                snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file);
                return -ENOENT;
        }
        kfree(found);
+       snd_card_unref(card);
        return 0;
 }
 
index 29f6ded02555568498473fb37547c9e7b0b96c2b..e8a1d18774b2073f997746f6d6f16881a1ecc4bc 100644 (file)
@@ -52,14 +52,19 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file)
                                         SNDRV_OSS_DEVICE_TYPE_MIXER);
        if (card == NULL)
                return -ENODEV;
-       if (card->mixer_oss == NULL)
+       if (card->mixer_oss == NULL) {
+               snd_card_unref(card);
                return -ENODEV;
+       }
        err = snd_card_file_add(card, file);
-       if (err < 0)
+       if (err < 0) {
+               snd_card_unref(card);
                return err;
+       }
        fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL);
        if (fmixer == NULL) {
                snd_card_file_remove(card, file);
+               snd_card_unref(card);
                return -ENOMEM;
        }
        fmixer->card = card;
@@ -68,8 +73,10 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file)
        if (!try_module_get(card->module)) {
                kfree(fmixer);
                snd_card_file_remove(card, file);
+               snd_card_unref(card);
                return -EFAULT;
        }
+       snd_card_unref(card);
        return 0;
 }
 
index 08fde0060fd9377ee9f5e12dc1113858c73b3d20..4c1cc51772e6f18e9ab03671069c738471ca8c04 100644 (file)
@@ -2441,6 +2441,10 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
                mutex_unlock(&pcm->open_mutex);
                schedule();
                mutex_lock(&pcm->open_mutex);
+               if (pcm->card->shutdown) {
+                       err = -ENODEV;
+                       break;
+               }
                if (signal_pending(current)) {
                        err = -ERESTARTSYS;
                        break;
@@ -2450,6 +2454,7 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
        mutex_unlock(&pcm->open_mutex);
        if (err < 0)
                goto __error;
+       snd_card_unref(pcm->card);
        return err;
 
       __error:
@@ -2457,6 +2462,8 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
       __error2:
        snd_card_file_remove(pcm->card, file);
       __error1:
+       if (pcm)
+               snd_card_unref(pcm->card);
        return err;
 }
 
index f2991940b271df46ef503173750a89d874fec6ad..030102caeee96b8080d9af6f2c99217278ec5a86 100644 (file)
@@ -1086,11 +1086,19 @@ static int snd_pcm_dev_disconnect(struct snd_device *device)
        if (list_empty(&pcm->list))
                goto unlock;
 
+       mutex_lock(&pcm->open_mutex);
+       wake_up(&pcm->open_wait);
        list_del_init(&pcm->list);
        for (cidx = 0; cidx < 2; cidx++)
-               for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)
-                       if (substream->runtime)
+               for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) {
+                       snd_pcm_stream_lock_irq(substream);
+                       if (substream->runtime) {
                                substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED;
+                               wake_up(&substream->runtime->sleep);
+                               wake_up(&substream->runtime->tsleep);
+                       }
+                       snd_pcm_stream_unlock_irq(substream);
+               }
        list_for_each_entry(notify, &snd_pcm_notify_list, list) {
                notify->n_disconnect(pcm);
        }
@@ -1110,6 +1118,7 @@ static int snd_pcm_dev_disconnect(struct snd_device *device)
                        pcm->streams[cidx].chmap_kctl = NULL;
                }
        }
+       mutex_unlock(&pcm->open_mutex);
  unlock:
        mutex_unlock(&register_mutex);
        return 0;
index 5e12e5bacbba36cdf64c41a1d6e7e3d984902cf9..f9ddecf2f4cd7a17ebc0d5f0ba92405c03ab904a 100644 (file)
@@ -369,6 +369,14 @@ static int period_to_usecs(struct snd_pcm_runtime *runtime)
        return usecs;
 }
 
+static void snd_pcm_set_state(struct snd_pcm_substream *substream, int state)
+{
+       snd_pcm_stream_lock_irq(substream);
+       if (substream->runtime->status->state != SNDRV_PCM_STATE_DISCONNECTED)
+               substream->runtime->status->state = state;
+       snd_pcm_stream_unlock_irq(substream);
+}
+
 static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
                             struct snd_pcm_hw_params *params)
 {
@@ -452,7 +460,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
                runtime->boundary *= 2;
 
        snd_pcm_timer_resolution_change(substream);
-       runtime->status->state = SNDRV_PCM_STATE_SETUP;
+       snd_pcm_set_state(substream, SNDRV_PCM_STATE_SETUP);
 
        if (pm_qos_request_active(&substream->latency_pm_qos_req))
                pm_qos_remove_request(&substream->latency_pm_qos_req);
@@ -464,7 +472,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
        /* hardware might be unusable from this time,
           so we force application to retry to set
           the correct hardware parameter settings */
-       runtime->status->state = SNDRV_PCM_STATE_OPEN;
+       snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);
        if (substream->ops->hw_free != NULL)
                substream->ops->hw_free(substream);
        return err;
@@ -512,7 +520,7 @@ static int snd_pcm_hw_free(struct snd_pcm_substream *substream)
                return -EBADFD;
        if (substream->ops->hw_free)
                result = substream->ops->hw_free(substream);
-       runtime->status->state = SNDRV_PCM_STATE_OPEN;
+       snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);
        pm_qos_remove_request(&substream->latency_pm_qos_req);
        return result;
 }
@@ -1320,7 +1328,7 @@ static void snd_pcm_post_prepare(struct snd_pcm_substream *substream, int state)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
        runtime->control->appl_ptr = runtime->status->hw_ptr;
-       runtime->status->state = SNDRV_PCM_STATE_PREPARED;
+       snd_pcm_set_state(substream, SNDRV_PCM_STATE_PREPARED);
 }
 
 static struct action_ops snd_pcm_action_prepare = {
@@ -1510,6 +1518,10 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream,
                down_read(&snd_pcm_link_rwsem);
                snd_pcm_stream_lock_irq(substream);
                remove_wait_queue(&to_check->sleep, &wait);
+               if (card->shutdown) {
+                       result = -ENODEV;
+                       break;
+               }
                if (tout == 0) {
                        if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED)
                                result = -ESTRPIPE;
@@ -1634,6 +1646,7 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
        write_unlock_irq(&snd_pcm_link_rwlock);
        up_write(&snd_pcm_link_rwsem);
  _nolock:
+       snd_card_unref(substream1->pcm->card);
        fput_light(file, fput_needed);
        if (res < 0)
                kfree(group);
@@ -2108,7 +2121,10 @@ static int snd_pcm_playback_open(struct inode *inode, struct file *file)
                return err;
        pcm = snd_lookup_minor_data(iminor(inode),
                                    SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
-       return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK);
+       err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK);
+       if (pcm)
+               snd_card_unref(pcm->card);
+       return err;
 }
 
 static int snd_pcm_capture_open(struct inode *inode, struct file *file)
@@ -2119,7 +2135,10 @@ static int snd_pcm_capture_open(struct inode *inode, struct file *file)
                return err;
        pcm = snd_lookup_minor_data(iminor(inode),
                                    SNDRV_DEVICE_TYPE_PCM_CAPTURE);
-       return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE);
+       err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE);
+       if (pcm)
+               snd_card_unref(pcm->card);
+       return err;
 }
 
 static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream)
@@ -2156,6 +2175,10 @@ static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream)
                mutex_unlock(&pcm->open_mutex);
                schedule();
                mutex_lock(&pcm->open_mutex);
+               if (pcm->card->shutdown) {
+                       err = -ENODEV;
+                       break;
+               }
                if (signal_pending(current)) {
                        err = -ERESTARTSYS;
                        break;
index ebf6e49ad3d461ba843131d903b0c66cc7840ba4..1bb95aeea084d33cd8225c53257058a23c25cf4e 100644 (file)
@@ -379,8 +379,10 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
        if (rmidi == NULL)
                return -ENODEV;
 
-       if (!try_module_get(rmidi->card->module))
+       if (!try_module_get(rmidi->card->module)) {
+               snd_card_unref(rmidi->card);
                return -ENXIO;
+       }
 
        mutex_lock(&rmidi->open_mutex);
        card = rmidi->card;
@@ -422,6 +424,10 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
                mutex_unlock(&rmidi->open_mutex);
                schedule();
                mutex_lock(&rmidi->open_mutex);
+               if (rmidi->card->shutdown) {
+                       err = -ENODEV;
+                       break;
+               }
                if (signal_pending(current)) {
                        err = -ERESTARTSYS;
                        break;
@@ -440,6 +446,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
 #endif
        file->private_data = rawmidi_file;
        mutex_unlock(&rmidi->open_mutex);
+       snd_card_unref(rmidi->card);
        return 0;
 
  __error:
@@ -447,6 +454,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
  __error_card:
        mutex_unlock(&rmidi->open_mutex);
        module_put(rmidi->card->module);
+       snd_card_unref(rmidi->card);
        return err;
 }
 
@@ -991,6 +999,8 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun
                        spin_unlock_irq(&runtime->lock);
                        schedule();
                        remove_wait_queue(&runtime->sleep, &wait);
+                       if (rfile->rmidi->card->shutdown)
+                               return -ENODEV;
                        if (signal_pending(current))
                                return result > 0 ? result : -ERESTARTSYS;
                        if (!runtime->avail)
@@ -1234,6 +1244,8 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf,
                        spin_unlock_irq(&runtime->lock);
                        timeout = schedule_timeout(30 * HZ);
                        remove_wait_queue(&runtime->sleep, &wait);
+                       if (rfile->rmidi->card->shutdown)
+                               return -ENODEV;
                        if (signal_pending(current))
                                return result > 0 ? result : -ERESTARTSYS;
                        if (!runtime->avail && !timeout)
@@ -1609,9 +1621,20 @@ static int snd_rawmidi_dev_register(struct snd_device *device)
 static int snd_rawmidi_dev_disconnect(struct snd_device *device)
 {
        struct snd_rawmidi *rmidi = device->device_data;
+       int dir;
 
        mutex_lock(&register_mutex);
+       mutex_lock(&rmidi->open_mutex);
+       wake_up(&rmidi->open_wait);
        list_del_init(&rmidi->list);
+       for (dir = 0; dir < 2; dir++) {
+               struct snd_rawmidi_substream *s;
+               list_for_each_entry(s, &rmidi->streams[dir].substreams, list) {
+                       if (s->runtime)
+                               wake_up(&s->runtime->sleep);
+               }
+       }
+
 #ifdef CONFIG_SND_OSSEMUL
        if (rmidi->ossreg) {
                if ((int)rmidi->device == midi_map[rmidi->card->number]) {
@@ -1626,6 +1649,7 @@ static int snd_rawmidi_dev_disconnect(struct snd_device *device)
        }
 #endif /* CONFIG_SND_OSSEMUL */
        snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device);
+       mutex_unlock(&rmidi->open_mutex);
        mutex_unlock(&register_mutex);
        return 0;
 }
index 643976000ce825d1857fd3a3192fadeff0da4e5b..70ccdab7415320e3b20a2aba6c5837f42962f758 100644 (file)
@@ -98,6 +98,10 @@ static void snd_request_other(int minor)
  *
  * Checks that a minor device with the specified type is registered, and returns
  * its user data pointer.
+ *
+ * This function increments the reference counter of the card instance
+ * if an associated instance with the given minor number and type is found.
+ * The caller must call snd_card_unref() appropriately later.
  */
 void *snd_lookup_minor_data(unsigned int minor, int type)
 {
@@ -108,9 +112,11 @@ void *snd_lookup_minor_data(unsigned int minor, int type)
                return NULL;
        mutex_lock(&sound_mutex);
        mreg = snd_minors[minor];
-       if (mreg && mreg->type == type)
+       if (mreg && mreg->type == type) {
                private_data = mreg->private_data;
-       else
+               if (private_data && mreg->card_ptr)
+                       atomic_inc(&mreg->card_ptr->refcount);
+       } else
                private_data = NULL;
        mutex_unlock(&sound_mutex);
        return private_data;
@@ -275,6 +281,7 @@ int snd_register_device_for_dev(int type, struct snd_card *card, int dev,
        preg->device = dev;
        preg->f_ops = f_ops;
        preg->private_data = private_data;
+       preg->card_ptr = card;
        mutex_lock(&sound_mutex);
 #ifdef CONFIG_SND_DYNAMIC_MINORS
        minor = snd_find_free_minor(type);
index e9528333e36d01e6e0282255639da08b7174e505..726a49ac97253d50634313265abc5699480c7e71 100644 (file)
@@ -40,6 +40,9 @@
 static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS];
 static DEFINE_MUTEX(sound_oss_mutex);
 
+/* NOTE: This function increments the refcount of the associated card like
+ * snd_lookup_minor_data(); the caller must call snd_card_unref() appropriately
+ */
 void *snd_lookup_oss_minor_data(unsigned int minor, int type)
 {
        struct snd_minor *mreg;
@@ -49,9 +52,11 @@ void *snd_lookup_oss_minor_data(unsigned int minor, int type)
                return NULL;
        mutex_lock(&sound_oss_mutex);
        mreg = snd_oss_minors[minor];
-       if (mreg && mreg->type == type)
+       if (mreg && mreg->type == type) {
                private_data = mreg->private_data;
-       else
+               if (private_data && mreg->card_ptr)
+                       atomic_inc(&mreg->card_ptr->refcount);
+       } else
                private_data = NULL;
        mutex_unlock(&sound_oss_mutex);
        return private_data;
@@ -123,6 +128,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev,
        preg->device = dev;
        preg->f_ops = f_ops;
        preg->private_data = private_data;
+       preg->card_ptr = card;
        mutex_lock(&sound_oss_mutex);
        snd_oss_minors[minor] = preg;
        minor_unit = SNDRV_MINOR_OSS_DEVICE(minor);
index ef68d710d08cfc13121089ae5f86f97dfb813ebb..e04e750a77ed4bac80875bf05e979bbd946f2219 100644 (file)
@@ -426,7 +426,7 @@ static struct snd_kcontrol_new snd_ak4113_iec958_controls[] = {
 },
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
-       .name =         "IEC958 Preample Capture Default",
+       .name =         "IEC958 Preamble Capture Default",
        .access =       SNDRV_CTL_ELEM_ACCESS_READ |
                SNDRV_CTL_ELEM_ACCESS_VOLATILE,
        .info =         snd_ak4113_spdif_pinfo,
index 816e7d225fb0a626147eb6d339d141edede00dc9..5bf4fca19e48656916180ecc353109018b771aa3 100644 (file)
@@ -401,7 +401,7 @@ static struct snd_kcontrol_new snd_ak4114_iec958_controls[] = {
 },
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
-       .name =         "IEC958 Preample Capture Default",
+       .name =         "IEC958 Preamble Capture Default",
        .access =       SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
        .info =         snd_ak4114_spdif_pinfo,
        .get =          snd_ak4114_spdif_pget,
index b4b2a51fc117a98b667e10de335a86c5e2c1ce00..40e33c9f2b095f1eb7488729afe20f1f991d994f 100644 (file)
@@ -380,7 +380,7 @@ static struct snd_kcontrol_new snd_ak4117_iec958_controls[] = {
 },
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
-       .name =         "IEC958 Preample Capture Default",
+       .name =         "IEC958 Preamble Capture Default",
        .access =       SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
        .info =         snd_ak4117_spdif_pinfo,
        .get =          snd_ak4117_spdif_pget,
index 5d0e568fdea1b39e6a4c94f9c4fa360edffa5ede..50169bcfd90370a92d64eadb3deee907618acc0b 100644 (file)
@@ -2655,6 +2655,8 @@ static struct ess_device_list pm_whitelist[] __devinitdata = {
        { TYPE_MAESTRO2E, 0x1179 },
        { TYPE_MAESTRO2E, 0x14c0 },     /* HP omnibook 4150 */
        { TYPE_MAESTRO2E, 0x1558 },
+       { TYPE_MAESTRO2E, 0x125d },     /* a PCI card, e.g. Terratec DMX */
+       { TYPE_MAESTRO2, 0x125d },      /* a PCI card, e.g. SF64-PCE2 */
 };
 
 static struct ess_device_list mpu_blacklist[] __devinitdata = {
index 72b085ae7d469e14559267558e515a578e3142dd..cd2dbaf1be786c61a3a1a446d7df5836d9622f35 100644 (file)
@@ -3563,6 +3563,8 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
        /* Teradici */
        { PCI_DEVICE(0x6549, 0x1200),
          .driver_data = AZX_DRIVER_TERA | AZX_DCAPS_NO_64BIT },
+       { PCI_DEVICE(0x6549, 0x2200),
+         .driver_data = AZX_DRIVER_TERA | AZX_DCAPS_NO_64BIT },
        /* Creative X-Fi (CA0110-IBG) */
        /* CTHDA chips */
        { PCI_DEVICE(0x1102, 0x0010),
index cdd43eadbc67425e80237b7da979c778b6bd835b..1eeba738666634329d17a76149618c1c6f3e8c26 100644 (file)
@@ -545,6 +545,7 @@ static int ad198x_build_pcms(struct hda_codec *codec)
        if (spec->multiout.dig_out_nid) {
                info++;
                codec->num_pcms++;
+               codec->spdif_status_reset = 1;
                info->name = "AD198x Digital";
                info->pcm_type = HDA_PCM_TYPE_SPDIF;
                info->stream[SNDRV_PCM_STREAM_PLAYBACK] = ad198x_pcm_digital_playback;
index 61a71131711c734556249b17fc61fc51f1218c1a..d5f3a26d608db72f1e4ef3f596392eb5a4f25a67 100644 (file)
@@ -101,8 +101,8 @@ enum {
 #define CS420X_VENDOR_NID      0x11
 #define CS_DIG_OUT1_PIN_NID    0x10
 #define CS_DIG_OUT2_PIN_NID    0x15
-#define CS_DMIC1_PIN_NID       0x12
-#define CS_DMIC2_PIN_NID       0x0e
+#define CS_DMIC1_PIN_NID       0x0e
+#define CS_DMIC2_PIN_NID       0x12
 
 /* coef indices */
 #define IDX_SPDIF_STAT         0x0000
@@ -1079,14 +1079,18 @@ static void init_input(struct hda_codec *codec)
                        cs_automic(codec, NULL);
 
                coef = 0x000a; /* ADC1/2 - Digital and Analog Soft Ramp */
+               cs_vendor_coef_set(codec, IDX_ADC_CFG, coef);
+
+               coef = cs_vendor_coef_get(codec, IDX_BEEP_CFG);
                if (is_active_pin(codec, CS_DMIC2_PIN_NID))
-                       coef |= 0x0500; /* DMIC2 2 chan on, GPIO1 off */
+                       coef |= 1 << 4; /* DMIC2 2 chan on, GPIO1 off */
                if (is_active_pin(codec, CS_DMIC1_PIN_NID))
-                       coef |= 0x1800; /* DMIC1 2 chan on, GPIO0 off
+                       coef |= 1 << 3; /* DMIC1 2 chan on, GPIO0 off
                                         * No effect if SPDIF_OUT2 is
                                         * selected in IDX_SPDIF_CTL.
                                        */
-               cs_vendor_coef_set(codec, IDX_ADC_CFG, coef);
+
+               cs_vendor_coef_set(codec, IDX_BEEP_CFG, coef);
        } else {
                if (spec->mic_detect)
                        cs_automic(codec, NULL);
@@ -1107,7 +1111,7 @@ static const struct hda_verb cs_coef_init_verbs[] = {
          | 0x0400 /* Disable Coefficient Auto increment */
          )},
        /* Beep */
-       {0x11, AC_VERB_SET_COEF_INDEX, IDX_DAC_CFG},
+       {0x11, AC_VERB_SET_COEF_INDEX, IDX_BEEP_CFG},
        {0x11, AC_VERB_SET_PROC_COEF, 0x0007}, /* Enable Beep thru DAC1/2/3 */
 
        {} /* terminator */
@@ -1728,8 +1732,7 @@ static int cs421x_mux_enum_put(struct snd_kcontrol *kcontrol,
 
 }
 
-static struct snd_kcontrol_new cs421x_capture_source = {
-
+static const struct snd_kcontrol_new cs421x_capture_source = {
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
        .name = "Capture Source",
        .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -1946,7 +1949,7 @@ static int cs421x_suspend(struct hda_codec *codec)
 }
 #endif
 
-static struct hda_codec_ops cs421x_patch_ops = {
+static const struct hda_codec_ops cs421x_patch_ops = {
        .build_controls = cs421x_build_controls,
        .build_pcms = cs_build_pcms,
        .init = cs421x_init,
index f7397ad02a0dedbc872cbd7560704d4eb84cbb19..c0ce3b1f04b4aafdcb61af4daa7bf85d942a787d 100644 (file)
@@ -5840,7 +5840,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
        return alc_parse_auto_config(codec, alc269_ignore, ssids);
 }
 
-static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
+static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
 {
        int val = alc_read_coef_idx(codec, 0x04);
        if (power_up)
@@ -5857,10 +5857,10 @@ static void alc269_shutup(struct hda_codec *codec)
        if (spec->codec_variant != ALC269_TYPE_ALC269VB)
                return;
 
-       if ((alc_get_coef0(codec) & 0x00ff) == 0x017)
-               alc269_toggle_power_output(codec, 0);
-       if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
-               alc269_toggle_power_output(codec, 0);
+       if (spec->codec_variant == ALC269_TYPE_ALC269VB)
+               alc269vb_toggle_power_output(codec, 0);
+       if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
+                       (alc_get_coef0(codec) & 0x00ff) == 0x018) {
                msleep(150);
        }
 }
@@ -5870,24 +5870,22 @@ static int alc269_resume(struct hda_codec *codec)
 {
        struct alc_spec *spec = codec->spec;
 
-       if (spec->codec_variant == ALC269_TYPE_ALC269VB ||
+       if (spec->codec_variant == ALC269_TYPE_ALC269VB)
+               alc269vb_toggle_power_output(codec, 0);
+       if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
                        (alc_get_coef0(codec) & 0x00ff) == 0x018) {
-               alc269_toggle_power_output(codec, 0);
                msleep(150);
        }
 
        codec->patch_ops.init(codec);
 
-       if (spec->codec_variant == ALC269_TYPE_ALC269VB ||
+       if (spec->codec_variant == ALC269_TYPE_ALC269VB)
+               alc269vb_toggle_power_output(codec, 1);
+       if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
                        (alc_get_coef0(codec) & 0x00ff) == 0x017) {
-               alc269_toggle_power_output(codec, 1);
                msleep(200);
        }
 
-       if (spec->codec_variant == ALC269_TYPE_ALC269VB ||
-                       (alc_get_coef0(codec) & 0x00ff) == 0x018)
-               alc269_toggle_power_output(codec, 1);
-
        snd_hda_codec_resume_amp(codec);
        snd_hda_codec_resume_cache(codec);
        hda_call_check_power_status(codec, 0x01);
@@ -7079,6 +7077,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = {
          .patch = patch_alc662 },
        { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
        { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
+       { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
        { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
        { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
        { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
@@ -7096,6 +7095,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = {
        { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
        { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
        { .id = 0x10ec0899, .name = "ALC898", .patch = patch_alc882 },
+       { .id = 0x10ec0900, .name = "ALC1150", .patch = patch_alc882 },
        {} /* terminator */
 };
 
index 770013ff556f6be0500b14039a8e60df2fa74b2a..9ba8af05617080f8081a5a69d68bcaec81cfb847 100644 (file)
@@ -1763,6 +1763,8 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
                          "HP", STAC_HP_ZEPHYR),
        SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660,
                          "HP Mini", STAC_92HD83XXX_HP_LED),
+       SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x144E,
+                         "HP Pavilion dv5", STAC_92HD83XXX_HP_INV_LED),
        {} /* terminator */
 };
 
index 72a2f60b087c8ba066b52e5aaf4cda500227471f..019e1a00414a460cb7a43c8c6bf142ecc2f01d38 100644 (file)
@@ -1809,11 +1809,11 @@ static int via_auto_fill_dac_nids(struct hda_codec *codec)
 {
        struct via_spec *spec = codec->spec;
        const struct auto_pin_cfg *cfg = &spec->autocfg;
-       int i, dac_num;
+       int i;
        hda_nid_t nid;
 
+       spec->multiout.num_dacs = 0;
        spec->multiout.dac_nids = spec->private_dac_nids;
-       dac_num = 0;
        for (i = 0; i < cfg->line_outs; i++) {
                hda_nid_t dac = 0;
                nid = cfg->line_out_pins[i];
@@ -1824,16 +1824,13 @@ static int via_auto_fill_dac_nids(struct hda_codec *codec)
                if (!i && parse_output_path(codec, nid, dac, 1,
                                            &spec->out_mix_path))
                        dac = spec->out_mix_path.path[0];
-               if (dac) {
-                       spec->private_dac_nids[i] = dac;
-                       dac_num++;
-               }
+               if (dac)
+                       spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
        }
        if (!spec->out_path[0].depth && spec->out_mix_path.depth) {
                spec->out_path[0] = spec->out_mix_path;
                spec->out_mix_path.depth = 0;
        }
-       spec->multiout.num_dacs = dac_num;
        return 0;
 }
 
@@ -3628,6 +3625,7 @@ static void set_widgets_power_state_vt2002P(struct hda_codec *codec)
  */
 enum {
        VIA_FIXUP_INTMIC_BOOST,
+       VIA_FIXUP_ASUS_G75,
 };
 
 static void via_fixup_intmic_boost(struct hda_codec *codec,
@@ -3642,13 +3640,35 @@ static const struct hda_fixup via_fixups[] = {
                .type = HDA_FIXUP_FUNC,
                .v.func = via_fixup_intmic_boost,
        },
+       [VIA_FIXUP_ASUS_G75] = {
+               .type = HDA_FIXUP_PINS,
+               .v.pins = (const struct hda_pintbl[]) {
+                       /* set 0x24 and 0x33 as speakers */
+                       { 0x24, 0x991301f0 },
+                       { 0x33, 0x991301f1 }, /* subwoofer */
+                       { }
+               }
+       },
 };
 
 static const struct snd_pci_quirk vt2002p_fixups[] = {
+       SND_PCI_QUIRK(0x1043, 0x1487, "Asus G75", VIA_FIXUP_ASUS_G75),
        SND_PCI_QUIRK(0x1043, 0x8532, "Asus X202E", VIA_FIXUP_INTMIC_BOOST),
        {}
 };
 
+/* NIDs 0x24 and 0x33 on VT1802 have connections to non-existing NID 0x3e
+ * Replace this with mixer NID 0x1c
+ */
+static void fix_vt1802_connections(struct hda_codec *codec)
+{
+       static hda_nid_t conn_24[] = { 0x14, 0x1c };
+       static hda_nid_t conn_33[] = { 0x1c };
+
+       snd_hda_override_conn_list(codec, 0x24, ARRAY_SIZE(conn_24), conn_24);
+       snd_hda_override_conn_list(codec, 0x33, ARRAY_SIZE(conn_33), conn_33);
+}
+
 /* patch for vt2002P */
 static int patch_vt2002P(struct hda_codec *codec)
 {
@@ -3663,6 +3683,8 @@ static int patch_vt2002P(struct hda_codec *codec)
        spec->aa_mix_nid = 0x21;
        override_mic_boost(codec, 0x2b, 0, 3, 40);
        override_mic_boost(codec, 0x29, 0, 3, 40);
+       if (spec->codec_type == VT1802)
+               fix_vt1802_connections(codec);
        add_secret_dac_path(codec);
 
        snd_hda_pick_fixup(codec, NULL, vt2002p_fixups, via_fixups);
index 3050a52792532ad3a58303f54a800dcc7c0ab883..245d874891ba25c2d993ea9de44536e0ab27ae6e 100644 (file)
@@ -2859,7 +2859,12 @@ static int snd_vt1724_resume(struct device *dev)
                ice->set_spdif_clock(ice, 0);
        } else {
                /* internal on-card clock */
-               snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 1);
+               int rate;
+               if (ice->cur_rate)
+                       rate = ice->cur_rate;
+               else
+                       rate = ice->pro_rate_default;
+               snd_vt1724_set_pro_rate(ice, rate, 1);
        }
 
        update_spdif_bits(ice, ice->pm_saved_spdif_ctrl);
index f1cd1e387801bee9d73692f02ec7a2bca546ca28..748e36c66603a7f9928f70a6f13ea8e64b875f76 100644 (file)
@@ -3979,7 +3979,8 @@ static int snd_hdspm_get_sync_check(struct snd_kcontrol *kcontrol,
                case 8: /* SYNC IN */
                        val = hdspm_sync_in_sync_check(hdspm); break;
                default:
-                       val = hdspm_s1_sync_check(hdspm, ucontrol->id.index-1);
+                       val = hdspm_s1_sync_check(hdspm,
+                                       kcontrol->private_value-1);
                }
                break;
 
@@ -4899,7 +4900,7 @@ snd_hdspm_proc_read_madi(struct snd_info_entry * entry,
                insel = "Coaxial";
                break;
        default:
-               insel = "Unkown";
+               insel = "Unknown";
        }
 
        snd_iprintf(buffer,
index 61599298fb26c32bdb193e1be0ccb33d2490a0af..4d8db3685e961bfb44a05074e3f7bae3acb5952a 100644 (file)
@@ -763,7 +763,7 @@ static int cs42l52_set_sysclk(struct snd_soc_dai *codec_dai,
        if ((freq >= CS42L52_MIN_CLK) && (freq <= CS42L52_MAX_CLK)) {
                cs42l52->sysclk = freq;
        } else {
-               dev_err(codec->dev, "Invalid freq paramter\n");
+               dev_err(codec->dev, "Invalid freq parameter\n");
                return -EINVAL;
        }
        return 0;
index 3fddc7ad1127eb9408bc6d2cddd7499e7b03ec39..b2b2b37131bddc4acfb8fb0e51a9bba220da9907 100644 (file)
@@ -3722,7 +3722,7 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data)
        } while (count--);
 
        if (count == 0)
-               dev_warn(codec->dev, "No impedence range reported for jack\n");
+               dev_warn(codec->dev, "No impedance range reported for jack\n");
 
 #ifndef CONFIG_SND_SOC_WM8994_MODULE
        trace_snd_soc_jack_irq(dev_name(codec->dev));
index 22c6130957ba429626004f310469ac94444f56be..9ffc9e66308f297a5e9a6ed39c7a3ddece48b9d2 100644 (file)
@@ -29,7 +29,6 @@
 
 #include <asm/fiq.h>
 
-#include <mach/irqs.h>
 #include <linux/platform_data/asoc-imx-ssi.h>
 
 #include "imx-ssi.h"
index 006f7d465ed2dda2f3122b307cb40820aef37a5d..dd566444e3c3b61b832a62e3763645393fcfbd88 100644 (file)
@@ -48,7 +48,6 @@
 #include <sound/soc.h>
 
 #include <linux/platform_data/asoc-imx-ssi.h>
-#include <mach/hardware.h>
 
 #include "imx-ssi.h"
 
index fad350682ca2ea1a7c2e68a5afe58932c3a36a53..c1900b2a6f2887e6a5529c3efa4df5963f1d2815 100644 (file)
@@ -25,8 +25,6 @@
 #include <sound/soc.h>
 
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
-#include <mach/gpio.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
 
 #include "omap-mcbsp.h"
index 521bfc3d2b2b3aae49ad00f5efd02a96c298b5a7..230b8c14484842ac961dd651320ebe072a9cc8bd 100644 (file)
@@ -29,7 +29,6 @@
 #include <sound/soc.h>
 
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
index 68f2cd1a92061504bd332c683d286c8ffe8414eb..5a6aeaf552a89666672e4bc2a46a3106ba26a532 100644 (file)
@@ -464,9 +464,9 @@ static __devinit int asoc_dmic_probe(struct platform_device *pdev)
 
        mutex_init(&dmic->mutex);
 
-       dmic->fclk = clk_get(dmic->dev, "dmic_fck");
+       dmic->fclk = clk_get(dmic->dev, "fck");
        if (IS_ERR(dmic->fclk)) {
-               dev_err(dmic->dev, "cant get dmic_fck\n");
+               dev_err(dmic->dev, "cant get fck\n");
                return -ENODEV;
        }
 
index 340874ebf9ae79cb550cbfe54e81850802448e16..52977aa303554d54113530805e421f450db68e33 100644 (file)
 #include <sound/dmaengine_pcm.h>
 #include <sound/soc.h>
 
-#include <plat/cpu.h>
 #include "omap-pcm.h"
 
+#ifdef CONFIG_ARCH_OMAP1
+#define pcm_omap1510() cpu_is_omap1510()
+#else
+#define pcm_omap1510() 0
+#endif
+
 static const struct snd_pcm_hardware omap_pcm_hardware = {
        .info                   = SNDRV_PCM_INFO_MMAP |
                                  SNDRV_PCM_INFO_MMAP_VALID |
@@ -159,7 +164,7 @@ static snd_pcm_uframes_t omap_pcm_pointer(struct snd_pcm_substream *substream)
 {
        snd_pcm_uframes_t offset;
 
-       if (cpu_is_omap1510())
+       if (pcm_omap1510())
                offset = snd_dmaengine_pcm_pointer_no_residue(substream);
        else
                offset = snd_dmaengine_pcm_pointer(substream);
index 3960e8df9c76c7b8a53dbf55425a81a6d6a5789b..06ef8d67ed1ccdf163627d65ee02304d0ca5fbb7 100644 (file)
@@ -28,7 +28,6 @@
 #include <sound/soc.h>
 
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
index 597cae769cea2817af8e7d6ad01ef26b8754dbc1..b462a2c9385f04e5ade66cc2b38fa427a6b668cc 100644 (file)
@@ -31,8 +31,6 @@
 #include <sound/jack.h>
 
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
-#include <mach/gpio.h>
 #include <linux/platform_data/gpio-omap.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
 
index 677b567935f8055b6899f74e276bd4c0a39dd213..1ff6bb9ade5c98fd1ac644b0567f42f367d543d8 100644 (file)
 
 #include <linux/clk.h>
 #include <linux/platform_device.h>
+#include <linux/gpio.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/soc.h>
 
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
-#include <mach/gpio.h>
-#include <mach/board-zoom.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
+#include <linux/platform_data/gpio-omap.h>
 
 /* Register descriptions for twl4030 codec part */
 #include <linux/mfd/twl4030-audio.h>
index 561bb74fd364ae388cb8dc2af548e014b0bb801b..282f0fc9fed1ef768bffc7f457b38de5dd39a429 100644 (file)
@@ -339,7 +339,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
        }
 
        mutex_init(&chip->mutex);
-       mutex_init(&chip->shutdown_mutex);
+       init_rwsem(&chip->shutdown_rwsem);
        chip->index = idx;
        chip->dev = dev;
        chip->card = card;
@@ -560,7 +560,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
 
        card = chip->card;
        mutex_lock(&register_mutex);
-       mutex_lock(&chip->shutdown_mutex);
+       down_write(&chip->shutdown_rwsem);
        chip->shutdown = 1;
        chip->num_interfaces--;
        if (chip->num_interfaces <= 0) {
@@ -582,11 +582,11 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
                        snd_usb_mixer_disconnect(p);
                }
                usb_chip[chip->index] = NULL;
-               mutex_unlock(&chip->shutdown_mutex);
+               up_write(&chip->shutdown_rwsem);
                mutex_unlock(&register_mutex);
                snd_card_free_when_closed(card);
        } else {
-               mutex_unlock(&chip->shutdown_mutex);
+               up_write(&chip->shutdown_rwsem);
                mutex_unlock(&register_mutex);
        }
 }
@@ -618,16 +618,20 @@ int snd_usb_autoresume(struct snd_usb_audio *chip)
 {
        int err = -ENODEV;
 
+       down_read(&chip->shutdown_rwsem);
        if (!chip->shutdown && !chip->probing)
                err = usb_autopm_get_interface(chip->pm_intf);
+       up_read(&chip->shutdown_rwsem);
 
        return err;
 }
 
 void snd_usb_autosuspend(struct snd_usb_audio *chip)
 {
+       down_read(&chip->shutdown_rwsem);
        if (!chip->shutdown && !chip->probing)
                usb_autopm_put_interface(chip->pm_intf);
+       up_read(&chip->shutdown_rwsem);
 }
 
 static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)
index afa4f9e9b27a2673b1fc955d680859cb7f964f02..814cb357ff88235dd87f37425985602867e3f5d5 100644 (file)
@@ -126,6 +126,7 @@ struct snd_usb_substream {
        struct snd_usb_endpoint *sync_endpoint;
        unsigned long flags;
        bool need_setup_ep;             /* (re)configure EP at prepare? */
+       unsigned int speed;             /* USB_SPEED_XXX */
 
        u64 formats;                    /* format bitmasks (all or'ed) */
        unsigned int num_formats;               /* number of supported audio formats (list) */
index 7f78c6d782b079d621d007f7c757e7cfd93587c7..34de6f2faf6120b492eb65208b9c9805aafe44e3 100644 (file)
@@ -35,6 +35,7 @@
 
 #define EP_FLAG_ACTIVATED      0
 #define EP_FLAG_RUNNING                1
+#define EP_FLAG_STOPPING       2
 
 /*
  * snd_usb_endpoint is a model that abstracts everything related to an
@@ -502,10 +503,20 @@ static int wait_clear_urbs(struct snd_usb_endpoint *ep)
        if (alive)
                snd_printk(KERN_ERR "timeout: still %d active urbs on EP #%x\n",
                                        alive, ep->ep_num);
+       clear_bit(EP_FLAG_STOPPING, &ep->flags);
 
        return 0;
 }
 
+/* sync the pending stop operation;
+ * this function itself doesn't trigger the stop operation
+ */
+void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep)
+{
+       if (ep && test_bit(EP_FLAG_STOPPING, &ep->flags))
+               wait_clear_urbs(ep);
+}
+
 /*
  * unlink active urbs.
  */
@@ -918,6 +929,8 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep,
 
                if (wait)
                        wait_clear_urbs(ep);
+               else
+                       set_bit(EP_FLAG_STOPPING, &ep->flags);
        }
 }
 
index 6376ccf10fd470688daf103b37ff74bcf67af3ea..3d4c9705041ff5074c609dd2bfb303781a523c4e 100644 (file)
@@ -19,6 +19,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
 int  snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep);
 void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep,
                           int force, int can_sleep, int wait);
+void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep);
 int  snd_usb_endpoint_activate(struct snd_usb_endpoint *ep);
 int  snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep);
 void snd_usb_endpoint_free(struct list_head *head);
index fe56c9da38e9e6c78cdd6706f09e9639d8a502ab..298070e8f2d4e354da19dbca3e3d704a7b799321 100644 (file)
@@ -287,25 +287,32 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, int v
        unsigned char buf[2];
        int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1;
        int timeout = 10;
-       int err;
+       int idx = 0, err;
 
        err = snd_usb_autoresume(cval->mixer->chip);
        if (err < 0)
                return -EIO;
+       down_read(&chip->shutdown_rwsem);
        while (timeout-- > 0) {
+               if (chip->shutdown)
+                       break;
+               idx = snd_usb_ctrl_intf(chip) | (cval->id << 8);
                if (snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request,
                                    USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-                                   validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),
-                                   buf, val_len) >= val_len) {
+                                   validx, idx, buf, val_len) >= val_len) {
                        *value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len));
-                       snd_usb_autosuspend(cval->mixer->chip);
-                       return 0;
+                       err = 0;
+                       goto out;
                }
        }
-       snd_usb_autosuspend(cval->mixer->chip);
        snd_printdd(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
-                   request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type);
-       return -EINVAL;
+                   request, validx, idx, cval->val_type);
+       err = -EINVAL;
+
+ out:
+       up_read(&chip->shutdown_rwsem);
+       snd_usb_autosuspend(cval->mixer->chip);
+       return err;
 }
 
 static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret)
@@ -313,7 +320,7 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v
        struct snd_usb_audio *chip = cval->mixer->chip;
        unsigned char buf[2 + 3*sizeof(__u16)]; /* enough space for one range */
        unsigned char *val;
-       int ret, size;
+       int idx = 0, ret, size;
        __u8 bRequest;
 
        if (request == UAC_GET_CUR) {
@@ -330,16 +337,22 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v
        if (ret)
                goto error;
 
-       ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest,
+       down_read(&chip->shutdown_rwsem);
+       if (chip->shutdown)
+               ret = -ENODEV;
+       else {
+               idx = snd_usb_ctrl_intf(chip) | (cval->id << 8);
+               ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest,
                              USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-                             validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),
-                             buf, size);
+                             validx, idx, buf, size);
+       }
+       up_read(&chip->shutdown_rwsem);
        snd_usb_autosuspend(chip);
 
        if (ret < 0) {
 error:
                snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
-                          request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type);
+                          request, validx, idx, cval->val_type);
                return ret;
        }
 
@@ -417,7 +430,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
 {
        struct snd_usb_audio *chip = cval->mixer->chip;
        unsigned char buf[2];
-       int val_len, err, timeout = 10;
+       int idx = 0, val_len, err, timeout = 10;
 
        if (cval->mixer->protocol == UAC_VERSION_1) {
                val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1;
@@ -440,19 +453,27 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
        err = snd_usb_autoresume(chip);
        if (err < 0)
                return -EIO;
-       while (timeout-- > 0)
+       down_read(&chip->shutdown_rwsem);
+       while (timeout-- > 0) {
+               if (chip->shutdown)
+                       break;
+               idx = snd_usb_ctrl_intf(chip) | (cval->id << 8);
                if (snd_usb_ctl_msg(chip->dev,
                                    usb_sndctrlpipe(chip->dev, 0), request,
                                    USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-                                   validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),
-                                   buf, val_len) >= 0) {
-                       snd_usb_autosuspend(chip);
-                       return 0;
+                                   validx, idx, buf, val_len) >= 0) {
+                       err = 0;
+                       goto out;
                }
-       snd_usb_autosuspend(chip);
+       }
        snd_printdd(KERN_ERR "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n",
-                   request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type, buf[0], buf[1]);
-       return -EINVAL;
+                   request, validx, idx, cval->val_type, buf[0], buf[1]);
+       err = -EINVAL;
+
+ out:
+       up_read(&chip->shutdown_rwsem);
+       snd_usb_autosuspend(chip);
+       return err;
 }
 
 static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int value)
index 690000db0ec01bb97e215f1b8470bd278a544ebd..ae2b7143522097bffd2a6060721d4f3db6b8000e 100644 (file)
@@ -283,6 +283,11 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
        if (value > 1)
                return -EINVAL;
        changed = value != mixer->audigy2nx_leds[index];
+       down_read(&mixer->chip->shutdown_rwsem);
+       if (mixer->chip->shutdown) {
+               err = -ENODEV;
+               goto out;
+       }
        if (mixer->chip->usb_id == USB_ID(0x041e, 0x3042))
                err = snd_usb_ctl_msg(mixer->chip->dev,
                              usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
@@ -299,6 +304,8 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
                              usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
                              USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
                              value, index + 2, NULL, 0);
+ out:
+       up_read(&mixer->chip->shutdown_rwsem);
        if (err < 0)
                return err;
        mixer->audigy2nx_leds[index] = value;
@@ -392,11 +399,16 @@ static void snd_audigy2nx_proc_read(struct snd_info_entry *entry,
 
        for (i = 0; jacks[i].name; ++i) {
                snd_iprintf(buffer, "%s: ", jacks[i].name);
-               err = snd_usb_ctl_msg(mixer->chip->dev,
+               down_read(&mixer->chip->shutdown_rwsem);
+               if (mixer->chip->shutdown)
+                       err = 0;
+               else
+                       err = snd_usb_ctl_msg(mixer->chip->dev,
                                      usb_rcvctrlpipe(mixer->chip->dev, 0),
                                      UAC_GET_MEM, USB_DIR_IN | USB_TYPE_CLASS |
                                      USB_RECIP_INTERFACE, 0,
                                      jacks[i].unitid << 8, buf, 3);
+               up_read(&mixer->chip->shutdown_rwsem);
                if (err == 3 && (buf[0] == 3 || buf[0] == 6))
                        snd_iprintf(buffer, "%02x %02x\n", buf[1], buf[2]);
                else
@@ -426,10 +438,15 @@ static int snd_xonar_u1_switch_put(struct snd_kcontrol *kcontrol,
        else
                new_status = old_status & ~0x02;
        changed = new_status != old_status;
-       err = snd_usb_ctl_msg(mixer->chip->dev,
+       down_read(&mixer->chip->shutdown_rwsem);
+       if (mixer->chip->shutdown)
+               err = -ENODEV;
+       else
+               err = snd_usb_ctl_msg(mixer->chip->dev,
                              usb_sndctrlpipe(mixer->chip->dev, 0), 0x08,
                              USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
                              50, 0, &new_status, 1);
+       up_read(&mixer->chip->shutdown_rwsem);
        if (err < 0)
                return err;
        mixer->xonar_u1_status = new_status;
@@ -468,11 +485,17 @@ static int snd_nativeinstruments_control_get(struct snd_kcontrol *kcontrol,
        u8 bRequest = (kcontrol->private_value >> 16) & 0xff;
        u16 wIndex = kcontrol->private_value & 0xffff;
        u8 tmp;
+       int ret;
 
-       int ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest,
+       down_read(&mixer->chip->shutdown_rwsem);
+       if (mixer->chip->shutdown)
+               ret = -ENODEV;
+       else
+               ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest,
                                  USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
                                  0, cpu_to_le16(wIndex),
                                  &tmp, sizeof(tmp), 1000);
+       up_read(&mixer->chip->shutdown_rwsem);
 
        if (ret < 0) {
                snd_printk(KERN_ERR
@@ -493,11 +516,17 @@ static int snd_nativeinstruments_control_put(struct snd_kcontrol *kcontrol,
        u8 bRequest = (kcontrol->private_value >> 16) & 0xff;
        u16 wIndex = kcontrol->private_value & 0xffff;
        u16 wValue = ucontrol->value.integer.value[0];
+       int ret;
 
-       int ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest,
+       down_read(&mixer->chip->shutdown_rwsem);
+       if (mixer->chip->shutdown)
+               ret = -ENODEV;
+       else
+               ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest,
                                  USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
                                  cpu_to_le16(wValue), cpu_to_le16(wIndex),
                                  NULL, 0, 1000);
+       up_read(&mixer->chip->shutdown_rwsem);
 
        if (ret < 0) {
                snd_printk(KERN_ERR
@@ -656,11 +685,16 @@ static int snd_ftu_eff_switch_get(struct snd_kcontrol *kctl,
                return -EINVAL;
 
 
-       err = snd_usb_ctl_msg(chip->dev,
+       down_read(&mixer->chip->shutdown_rwsem);
+       if (mixer->chip->shutdown)
+               err = -ENODEV;
+       else
+               err = snd_usb_ctl_msg(chip->dev,
                        usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR,
                        USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
                        validx << 8, snd_usb_ctrl_intf(chip) | (id << 8),
                        value, val_len);
+       up_read(&mixer->chip->shutdown_rwsem);
        if (err < 0)
                return err;
 
@@ -703,11 +737,16 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl,
 
        if (!pval->is_cached) {
                /* Read current value */
-               err = snd_usb_ctl_msg(chip->dev,
+               down_read(&mixer->chip->shutdown_rwsem);
+               if (mixer->chip->shutdown)
+                       err = -ENODEV;
+               else
+                       err = snd_usb_ctl_msg(chip->dev,
                                usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR,
                                USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
                                validx << 8, snd_usb_ctrl_intf(chip) | (id << 8),
                                value, val_len);
+               up_read(&mixer->chip->shutdown_rwsem);
                if (err < 0)
                        return err;
 
@@ -719,11 +758,16 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl,
        if (cur_val != new_val) {
                value[0] = new_val;
                value[1] = 0;
-               err = snd_usb_ctl_msg(chip->dev,
+               down_read(&mixer->chip->shutdown_rwsem);
+               if (mixer->chip->shutdown)
+                       err = -ENODEV;
+               else
+                       err = snd_usb_ctl_msg(chip->dev,
                                usb_sndctrlpipe(chip->dev, 0), UAC_SET_CUR,
                                USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
                                validx << 8, snd_usb_ctrl_intf(chip) | (id << 8),
                                value, val_len);
+               up_read(&mixer->chip->shutdown_rwsem);
                if (err < 0)
                        return err;
 
index 55e19e1b80ec4eeb282c91cea482ef7434cf8dce..5c12a3fe8c3e8dfae0af6388b9ee3ea8c6c16047 100644 (file)
@@ -71,6 +71,8 @@ static snd_pcm_uframes_t snd_usb_pcm_pointer(struct snd_pcm_substream *substream
        unsigned int hwptr_done;
 
        subs = (struct snd_usb_substream *)substream->runtime->private_data;
+       if (subs->stream->chip->shutdown)
+               return SNDRV_PCM_POS_XRUN;
        spin_lock(&subs->lock);
        hwptr_done = subs->hwptr_done;
        substream->runtime->delay = snd_usb_pcm_delay(subs,
@@ -444,7 +446,6 @@ static int configure_endpoint(struct snd_usb_substream *subs)
 {
        int ret;
 
-       mutex_lock(&subs->stream->chip->shutdown_mutex);
        /* format changed */
        stop_endpoints(subs, 0, 0, 0);
        ret = snd_usb_endpoint_set_params(subs->data_endpoint,
@@ -455,7 +456,7 @@ static int configure_endpoint(struct snd_usb_substream *subs)
                                          subs->cur_audiofmt,
                                          subs->sync_endpoint);
        if (ret < 0)
-               goto unlock;
+               return ret;
 
        if (subs->sync_endpoint)
                ret = snd_usb_endpoint_set_params(subs->data_endpoint,
@@ -465,9 +466,6 @@ static int configure_endpoint(struct snd_usb_substream *subs)
                                                  subs->cur_rate,
                                                  subs->cur_audiofmt,
                                                  NULL);
-
-unlock:
-       mutex_unlock(&subs->stream->chip->shutdown_mutex);
        return ret;
 }
 
@@ -505,7 +503,13 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
                return -EINVAL;
        }
 
-       if ((ret = set_format(subs, fmt)) < 0)
+       down_read(&subs->stream->chip->shutdown_rwsem);
+       if (subs->stream->chip->shutdown)
+               ret = -ENODEV;
+       else
+               ret = set_format(subs, fmt);
+       up_read(&subs->stream->chip->shutdown_rwsem);
+       if (ret < 0)
                return ret;
 
        subs->interface = fmt->iface;
@@ -527,10 +531,12 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream)
        subs->cur_audiofmt = NULL;
        subs->cur_rate = 0;
        subs->period_bytes = 0;
-       mutex_lock(&subs->stream->chip->shutdown_mutex);
-       stop_endpoints(subs, 0, 1, 1);
-       deactivate_endpoints(subs);
-       mutex_unlock(&subs->stream->chip->shutdown_mutex);
+       down_read(&subs->stream->chip->shutdown_rwsem);
+       if (!subs->stream->chip->shutdown) {
+               stop_endpoints(subs, 0, 1, 1);
+               deactivate_endpoints(subs);
+       }
+       up_read(&subs->stream->chip->shutdown_rwsem);
        return snd_pcm_lib_free_vmalloc_buffer(substream);
 }
 
@@ -552,12 +558,22 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
                return -ENXIO;
        }
 
-       if (snd_BUG_ON(!subs->data_endpoint))
-               return -EIO;
+       down_read(&subs->stream->chip->shutdown_rwsem);
+       if (subs->stream->chip->shutdown) {
+               ret = -ENODEV;
+               goto unlock;
+       }
+       if (snd_BUG_ON(!subs->data_endpoint)) {
+               ret = -EIO;
+               goto unlock;
+       }
+
+       snd_usb_endpoint_sync_pending_stop(subs->sync_endpoint);
+       snd_usb_endpoint_sync_pending_stop(subs->data_endpoint);
 
        ret = set_format(subs, subs->cur_audiofmt);
        if (ret < 0)
-               return ret;
+               goto unlock;
 
        iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface);
        alts = &iface->altsetting[subs->cur_audiofmt->altset_idx];
@@ -567,12 +583,12 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
                                       subs->cur_audiofmt,
                                       subs->cur_rate);
        if (ret < 0)
-               return ret;
+               goto unlock;
 
        if (subs->need_setup_ep) {
                ret = configure_endpoint(subs);
                if (ret < 0)
-                       return ret;
+                       goto unlock;
                subs->need_setup_ep = false;
        }
 
@@ -592,9 +608,11 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
        /* for playback, submit the URBs now; otherwise, the first hwptr_done
         * updates for all URBs would happen at the same time when starting */
        if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK)
-               return start_endpoints(subs, 1);
+               ret = start_endpoints(subs, 1);
 
-       return 0;
+ unlock:
+       up_read(&subs->stream->chip->shutdown_rwsem);
+       return ret;
 }
 
 static struct snd_pcm_hardware snd_usb_hardware =
@@ -647,7 +665,7 @@ static int hw_check_valid_format(struct snd_usb_substream *subs,
                return 0;
        }
        /* check whether the period time is >= the data packet interval */
-       if (snd_usb_get_speed(subs->dev) != USB_SPEED_FULL) {
+       if (subs->speed != USB_SPEED_FULL) {
                ptime = 125 * (1 << fp->datainterval);
                if (ptime > pt->max || (ptime == pt->max && pt->openmax)) {
                        hwc_debug("   > check: ptime %u > max %u\n", ptime, pt->max);
@@ -925,7 +943,7 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre
                return err;
 
        param_period_time_if_needed = SNDRV_PCM_HW_PARAM_PERIOD_TIME;
-       if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL)
+       if (subs->speed == USB_SPEED_FULL)
                /* full speed devices have fixed data packet interval */
                ptmin = 1000;
        if (ptmin == 1000)
index ebc1a5b5b3f1ba79c4c25ea66aadd34fd053e6d6..d218f763501fcdb9c4d038826a4bb12b14e4197b 100644 (file)
@@ -108,7 +108,7 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s
                        }
                        snd_iprintf(buffer, "\n");
                }
-               if (snd_usb_get_speed(subs->dev) != USB_SPEED_FULL)
+               if (subs->speed != USB_SPEED_FULL)
                        snd_iprintf(buffer, "    Data packet interval: %d us\n",
                                    125 * (1 << fp->datainterval));
                // snd_iprintf(buffer, "    Max Packet Size = %d\n", fp->maxpacksize);
@@ -124,7 +124,7 @@ static void proc_dump_ep_status(struct snd_usb_substream *subs,
                return;
        snd_iprintf(buffer, "    Packet Size = %d\n", ep->curpacksize);
        snd_iprintf(buffer, "    Momentary freq = %u Hz (%#x.%04x)\n",
-                   snd_usb_get_speed(subs->dev) == USB_SPEED_FULL
+                   subs->speed == USB_SPEED_FULL
                    ? get_full_speed_hz(ep->freqm)
                    : get_high_speed_hz(ep->freqm),
                    ep->freqm >> 16, ep->freqm & 0xffff);
index 083ed81160e58b094ee8f4fca637371aa5b5fff4..1de0c8c002a8a2d35bc80e7de9a9c764a5945fc2 100644 (file)
@@ -90,6 +90,7 @@ static void snd_usb_init_substream(struct snd_usb_stream *as,
        subs->direction = stream;
        subs->dev = as->chip->dev;
        subs->txfr_quirk = as->chip->txfr_quirk;
+       subs->speed = snd_usb_get_speed(subs->dev);
 
        snd_usb_set_pcm_ops(as->pcm, stream);
 
index b8233ebe250f88648cc0baf2f6cfcfd13aa6de8f..ef42797f56fb56adf950eef3b764c5533263a8d9 100644 (file)
@@ -37,7 +37,7 @@ struct snd_usb_audio {
        struct usb_interface *pm_intf;
        u32 usb_id;
        struct mutex mutex;
-       struct mutex shutdown_mutex;
+       struct rw_semaphore shutdown_rwsem;
        unsigned int shutdown:1;
        unsigned int probing:1;
        unsigned int autosuspended:1;   
index 43480149119ee773f0a32cc8abe995903609fd11..85baf11e2acd7d11aa4990a0f7f53f8d28689a20 100644 (file)
@@ -1,4 +1,4 @@
-TARGETS = breakpoints kcmp mqueue vm cpu-hotplug memory-hotplug epoll
+TARGETS = breakpoints kcmp mqueue vm cpu-hotplug memory-hotplug
 
 all:
        for TARGET in $(TARGETS); do \
diff --git a/tools/testing/selftests/epoll/Makefile b/tools/testing/selftests/epoll/Makefile
deleted file mode 100644 (file)
index 19806ed..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-# Makefile for epoll selftests
-
-all: test_epoll
-%: %.c
-       gcc -pthread -g -o $@ $^
-
-run_tests: all
-       ./test_epoll
-
-clean:
-       $(RM) test_epoll
diff --git a/tools/testing/selftests/epoll/test_epoll.c b/tools/testing/selftests/epoll/test_epoll.c
deleted file mode 100644 (file)
index f752539..0000000
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- *  tools/testing/selftests/epoll/test_epoll.c
- *
- *  Copyright 2012 Adobe Systems Incorporated
- *
- *  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.
- *
- *  Paton J. Lewis <palewis@adobe.com>
- *
- */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/epoll.h>
-#include <sys/socket.h>
-
-/*
- * A pointer to an epoll_item_private structure will be stored in the epoll
- * item's event structure so that we can get access to the epoll_item_private
- * data after calling epoll_wait:
- */
-struct epoll_item_private {
-       int index;  /* Position of this struct within the epoll_items array. */
-       int fd;
-       uint32_t events;
-       pthread_mutex_t mutex;  /* Guards the following variables... */
-       int stop;
-       int status;  /* Stores any error encountered while handling item. */
-       /* The following variable allows us to test whether we have encountered
-          a problem while attempting to cancel and delete the associated
-          event. When the test program exits, 'deleted' should be exactly
-          one. If it is greater than one, then the failed test reflects a real
-          world situation where we would have tried to access the epoll item's
-          private data after deleting it: */
-       int deleted;
-};
-
-struct epoll_item_private *epoll_items;
-
-/*
- * Delete the specified item from the epoll set. In a real-world secneario this
- * is where we would free the associated data structure, but in this testing
- * environment we retain the structure so that we can test for double-deletion:
- */
-void delete_item(int index)
-{
-       __sync_fetch_and_add(&epoll_items[index].deleted, 1);
-}
-
-/*
- * A pointer to a read_thread_data structure will be passed as the argument to
- * each read thread:
- */
-struct read_thread_data {
-       int stop;
-       int status;  /* Indicates any error encountered by the read thread. */
-       int epoll_set;
-};
-
-/*
- * The function executed by the read threads:
- */
-void *read_thread_function(void *function_data)
-{
-       struct read_thread_data *thread_data =
-               (struct read_thread_data *)function_data;
-       struct epoll_event event_data;
-       struct epoll_item_private *item_data;
-       char socket_data;
-
-       /* Handle events until we encounter an error or this thread's 'stop'
-          condition is set: */
-       while (1) {
-               int result = epoll_wait(thread_data->epoll_set,
-                                       &event_data,
-                                       1,      /* Number of desired events */
-                                       1000);  /* Timeout in ms */
-               if (result < 0) {
-                       /* Breakpoints signal all threads. Ignore that while
-                          debugging: */
-                       if (errno == EINTR)
-                               continue;
-                       thread_data->status = errno;
-                       return 0;
-               } else if (thread_data->stop)
-                       return 0;
-               else if (result == 0)  /* Timeout */
-                       continue;
-
-               /* We need the mutex here because checking for the stop
-                  condition and re-enabling the epoll item need to be done
-                  together as one atomic operation when EPOLL_CTL_DISABLE is
-                  available: */
-               item_data = (struct epoll_item_private *)event_data.data.ptr;
-               pthread_mutex_lock(&item_data->mutex);
-
-               /* Remove the item from the epoll set if we want to stop
-                  handling that event: */
-               if (item_data->stop)
-                       delete_item(item_data->index);
-               else {
-                       /* Clear the data that was written to the other end of
-                          our non-blocking socket: */
-                       do {
-                               if (read(item_data->fd, &socket_data, 1) < 1) {
-                                       if ((errno == EAGAIN) ||
-                                           (errno == EWOULDBLOCK))
-                                               break;
-                                       else
-                                               goto error_unlock;
-                               }
-                       } while (item_data->events & EPOLLET);
-
-                       /* The item was one-shot, so re-enable it: */
-                       event_data.events = item_data->events;
-                       if (epoll_ctl(thread_data->epoll_set,
-                                                 EPOLL_CTL_MOD,
-                                                 item_data->fd,
-                                                 &event_data) < 0)
-                               goto error_unlock;
-               }
-
-               pthread_mutex_unlock(&item_data->mutex);
-       }
-
-error_unlock:
-       thread_data->status = item_data->status = errno;
-       pthread_mutex_unlock(&item_data->mutex);
-       return 0;
-}
-
-/*
- * A pointer to a write_thread_data structure will be passed as the argument to
- * the write thread:
- */
-struct write_thread_data {
-       int stop;
-       int status;  /* Indicates any error encountered by the write thread. */
-       int n_fds;
-       int *fds;
-};
-
-/*
- * The function executed by the write thread. It writes a single byte to each
- * socket in turn until the stop condition for this thread is set. If writing to
- * a socket would block (i.e. errno was EAGAIN), we leave that socket alone for
- * the moment and just move on to the next socket in the list. We don't care
- * about the order in which we deliver events to the epoll set. In fact we don't
- * care about the data we're writing to the pipes at all; we just want to
- * trigger epoll events:
- */
-void *write_thread_function(void *function_data)
-{
-       const char data = 'X';
-       int index;
-       struct write_thread_data *thread_data =
-               (struct write_thread_data *)function_data;
-       while (!thread_data->stop)
-               for (index = 0;
-                    !thread_data->stop && (index < thread_data->n_fds);
-                    ++index)
-                       if ((write(thread_data->fds[index], &data, 1) < 1) &&
-                               (errno != EAGAIN) &&
-                               (errno != EWOULDBLOCK)) {
-                               thread_data->status = errno;
-                               return;
-                       }
-}
-
-/*
- * Arguments are currently ignored:
- */
-int main(int argc, char **argv)
-{
-       const int n_read_threads = 100;
-       const int n_epoll_items = 500;
-       int index;
-       int epoll_set = epoll_create1(0);
-       struct write_thread_data write_thread_data = {
-               0, 0, n_epoll_items, malloc(n_epoll_items * sizeof(int))
-       };
-       struct read_thread_data *read_thread_data =
-               malloc(n_read_threads * sizeof(struct read_thread_data));
-       pthread_t *read_threads = malloc(n_read_threads * sizeof(pthread_t));
-       pthread_t write_thread;
-
-       printf("-----------------\n");
-       printf("Runing test_epoll\n");
-       printf("-----------------\n");
-
-       epoll_items = malloc(n_epoll_items * sizeof(struct epoll_item_private));
-
-       if (epoll_set < 0 || epoll_items == 0 || write_thread_data.fds == 0 ||
-               read_thread_data == 0 || read_threads == 0)
-               goto error;
-
-       if (sysconf(_SC_NPROCESSORS_ONLN) < 2) {
-               printf("Error: please run this test on a multi-core system.\n");
-               goto error;
-       }
-
-       /* Create the socket pairs and epoll items: */
-       for (index = 0; index < n_epoll_items; ++index) {
-               int socket_pair[2];
-               struct epoll_event event_data;
-               if (socketpair(AF_UNIX,
-                              SOCK_STREAM | SOCK_NONBLOCK,
-                              0,
-                              socket_pair) < 0)
-                       goto error;
-               write_thread_data.fds[index] = socket_pair[0];
-               epoll_items[index].index = index;
-               epoll_items[index].fd = socket_pair[1];
-               if (pthread_mutex_init(&epoll_items[index].mutex, NULL) != 0)
-                       goto error;
-               /* We always use EPOLLONESHOT because this test is currently
-                  structured to demonstrate the need for EPOLL_CTL_DISABLE,
-                  which only produces useful information in the EPOLLONESHOT
-                  case (without EPOLLONESHOT, calling epoll_ctl with
-                  EPOLL_CTL_DISABLE will never return EBUSY). If support for
-                  testing events without EPOLLONESHOT is desired, it should
-                  probably be implemented in a separate unit test. */
-               epoll_items[index].events = EPOLLIN | EPOLLONESHOT;
-               if (index < n_epoll_items / 2)
-                       epoll_items[index].events |= EPOLLET;
-               epoll_items[index].stop = 0;
-               epoll_items[index].status = 0;
-               epoll_items[index].deleted = 0;
-               event_data.events = epoll_items[index].events;
-               event_data.data.ptr = &epoll_items[index];
-               if (epoll_ctl(epoll_set,
-                             EPOLL_CTL_ADD,
-                             epoll_items[index].fd,
-                             &event_data) < 0)
-                       goto error;
-       }
-
-       /* Create and start the read threads: */
-       for (index = 0; index < n_read_threads; ++index) {
-               read_thread_data[index].stop = 0;
-               read_thread_data[index].status = 0;
-               read_thread_data[index].epoll_set = epoll_set;
-               if (pthread_create(&read_threads[index],
-                                  NULL,
-                                  read_thread_function,
-                                  &read_thread_data[index]) != 0)
-                       goto error;
-       }
-
-       if (pthread_create(&write_thread,
-                          NULL,
-                          write_thread_function,
-                          &write_thread_data) != 0)
-               goto error;
-
-       /* Cancel all event pollers: */
-#ifdef EPOLL_CTL_DISABLE
-       for (index = 0; index < n_epoll_items; ++index) {
-               pthread_mutex_lock(&epoll_items[index].mutex);
-               ++epoll_items[index].stop;
-               if (epoll_ctl(epoll_set,
-                             EPOLL_CTL_DISABLE,
-                             epoll_items[index].fd,
-                             NULL) == 0)
-                       delete_item(index);
-               else if (errno != EBUSY) {
-                       pthread_mutex_unlock(&epoll_items[index].mutex);
-                       goto error;
-               }
-               /* EBUSY means events were being handled; allow the other thread
-                  to delete the item. */
-               pthread_mutex_unlock(&epoll_items[index].mutex);
-       }
-#else
-       for (index = 0; index < n_epoll_items; ++index) {
-               pthread_mutex_lock(&epoll_items[index].mutex);
-               ++epoll_items[index].stop;
-               pthread_mutex_unlock(&epoll_items[index].mutex);
-               /* Wait in case a thread running read_thread_function is
-                  currently executing code between epoll_wait and
-                  pthread_mutex_lock with this item. Note that a longer delay
-                  would make double-deletion less likely (at the expense of
-                  performance), but there is no guarantee that any delay would
-                  ever be sufficient. Note also that we delete all event
-                  pollers at once for testing purposes, but in a real-world
-                  environment we are likely to want to be able to cancel event
-                  pollers at arbitrary times. Therefore we can't improve this
-                  situation by just splitting this loop into two loops
-                  (i.e. signal 'stop' for all items, sleep, and then delete all
-                  items). We also can't fix the problem via EPOLL_CTL_DEL
-                  because that command can't prevent the case where some other
-                  thread is executing read_thread_function within the region
-                  mentioned above: */
-               usleep(1);
-               pthread_mutex_lock(&epoll_items[index].mutex);
-               if (!epoll_items[index].deleted)
-                       delete_item(index);
-               pthread_mutex_unlock(&epoll_items[index].mutex);
-       }
-#endif
-
-       /* Shut down the read threads: */
-       for (index = 0; index < n_read_threads; ++index)
-               __sync_fetch_and_add(&read_thread_data[index].stop, 1);
-       for (index = 0; index < n_read_threads; ++index) {
-               if (pthread_join(read_threads[index], NULL) != 0)
-                       goto error;
-               if (read_thread_data[index].status)
-                       goto error;
-       }
-
-       /* Shut down the write thread: */
-       __sync_fetch_and_add(&write_thread_data.stop, 1);
-       if ((pthread_join(write_thread, NULL) != 0) || write_thread_data.status)
-               goto error;
-
-       /* Check for final error conditions: */
-       for (index = 0; index < n_epoll_items; ++index) {
-               if (epoll_items[index].status != 0)
-                       goto error;
-               if (pthread_mutex_destroy(&epoll_items[index].mutex) < 0)
-                       goto error;
-       }
-       for (index = 0; index < n_epoll_items; ++index)
-               if (epoll_items[index].deleted != 1) {
-                       printf("Error: item data deleted %1d times.\n",
-                                  epoll_items[index].deleted);
-                       goto error;
-               }
-
-       printf("[PASS]\n");
-       return 0;
-
- error:
-       printf("[FAIL]\n");
-       return errno;
-}