]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge branch 'imx/imx6q' into next/soc
authorArnd Bergmann <arnd@arndb.de>
Wed, 2 Nov 2011 01:46:55 +0000 (02:46 +0100)
committerArnd Bergmann <arnd@arndb.de>
Wed, 2 Nov 2011 01:46:55 +0000 (02:46 +0100)
Conflicts:
Documentation/devicetree/bindings/arm/fsl.txt
arch/arm/Kconfig
arch/arm/Kconfig.debug
arch/arm/plat-mxc/include/mach/common.h

634 files changed:
Documentation/devicetree/bindings/arm/calxeda.txt [new file with mode: 0644]
Documentation/devicetree/bindings/arm/fsl.txt
Documentation/devicetree/bindings/arm/l2cc.txt [new file with mode: 0644]
Documentation/devicetree/bindings/arm/omap/dsp.txt [new file with mode: 0644]
Documentation/devicetree/bindings/arm/omap/iva.txt [new file with mode: 0644]
Documentation/devicetree/bindings/arm/omap/l3-noc.txt [new file with mode: 0644]
Documentation/devicetree/bindings/arm/omap/mpu.txt [new file with mode: 0644]
Documentation/devicetree/bindings/arm/omap/omap.txt [new file with mode: 0644]
Documentation/devicetree/bindings/arm/picoxcell.txt [new file with mode: 0644]
Documentation/devicetree/bindings/tty/serial/msm_serial.txt [new file with mode: 0644]
Documentation/kernel-parameters.txt
Documentation/networking/scaling.txt
MAINTAINERS
Makefile
arch/arm/Kconfig
arch/arm/Kconfig.debug
arch/arm/Makefile
arch/arm/boot/dts/at91sam9g20.dtsi [new file with mode: 0644]
arch/arm/boot/dts/at91sam9g45.dtsi [new file with mode: 0644]
arch/arm/boot/dts/at91sam9m10g45ek.dts [new file with mode: 0644]
arch/arm/boot/dts/highbank.dts [new file with mode: 0644]
arch/arm/boot/dts/imx51-babbage.dts [new file with mode: 0644]
arch/arm/boot/dts/imx51.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx53-ard.dts [new file with mode: 0644]
arch/arm/boot/dts/imx53-evk.dts [new file with mode: 0644]
arch/arm/boot/dts/imx53-qsb.dts [new file with mode: 0644]
arch/arm/boot/dts/imx53-smd.dts [new file with mode: 0644]
arch/arm/boot/dts/imx53.dtsi [new file with mode: 0644]
arch/arm/boot/dts/msm8660-surf.dts [new file with mode: 0644]
arch/arm/boot/dts/omap3-beagle.dts [new file with mode: 0644]
arch/arm/boot/dts/omap3.dtsi [new file with mode: 0644]
arch/arm/boot/dts/omap4-panda.dts [new file with mode: 0644]
arch/arm/boot/dts/omap4-sdp.dts [new file with mode: 0644]
arch/arm/boot/dts/omap4.dtsi [new file with mode: 0644]
arch/arm/boot/dts/picoxcell-pc3x2.dtsi [new file with mode: 0644]
arch/arm/boot/dts/picoxcell-pc3x3.dtsi [new file with mode: 0644]
arch/arm/boot/dts/picoxcell-pc7302-pc3x2.dts [new file with mode: 0644]
arch/arm/boot/dts/picoxcell-pc7302-pc3x3.dts [new file with mode: 0644]
arch/arm/boot/dts/usb_a9g20.dts [new file with mode: 0644]
arch/arm/common/gic.c
arch/arm/common/scoop.c
arch/arm/common/vic.c
arch/arm/include/asm/device.h
arch/arm/include/asm/ecard.h
arch/arm/include/asm/gpio.h
arch/arm/include/asm/hardware/cache-l2x0.h
arch/arm/include/asm/hardware/iop3xx-gpio.h
arch/arm/include/asm/io.h
arch/arm/include/asm/localtimer.h
arch/arm/include/asm/outercache.h
arch/arm/kernel/asm-offsets.c
arch/arm/kernel/ecard.c
arch/arm/kernel/perf_event_v7.c
arch/arm/mach-at91/Kconfig
arch/arm/mach-at91/Makefile
arch/arm/mach-at91/Makefile.boot
arch/arm/mach-at91/at91cap9_devices.c
arch/arm/mach-at91/at91rm9200_devices.c
arch/arm/mach-at91/at91sam9260.c
arch/arm/mach-at91/at91sam9260_devices.c
arch/arm/mach-at91/at91sam9261_devices.c
arch/arm/mach-at91/at91sam9263_devices.c
arch/arm/mach-at91/at91sam9g45.c
arch/arm/mach-at91/at91sam9g45_devices.c
arch/arm/mach-at91/at91sam9rl_devices.c
arch/arm/mach-at91/board-1arm.c
arch/arm/mach-at91/board-afeb-9260v1.c
arch/arm/mach-at91/board-cam60.c
arch/arm/mach-at91/board-cap9adk.c
arch/arm/mach-at91/board-carmeva.c
arch/arm/mach-at91/board-cpu9krea.c
arch/arm/mach-at91/board-cpuat91.c
arch/arm/mach-at91/board-csb337.c
arch/arm/mach-at91/board-csb637.c
arch/arm/mach-at91/board-dt.c [new file with mode: 0644]
arch/arm/mach-at91/board-eb9200.c
arch/arm/mach-at91/board-ecbat91.c
arch/arm/mach-at91/board-kafa.c
arch/arm/mach-at91/board-kb9202.c
arch/arm/mach-at91/board-neocore926.c
arch/arm/mach-at91/board-picotux200.c
arch/arm/mach-at91/board-qil-a9260.c
arch/arm/mach-at91/board-rm9200dk.c
arch/arm/mach-at91/board-rm9200ek.c
arch/arm/mach-at91/board-sam9-l9260.c
arch/arm/mach-at91/board-sam9260ek.c
arch/arm/mach-at91/board-sam9261ek.c
arch/arm/mach-at91/board-sam9263ek.c
arch/arm/mach-at91/board-sam9g20ek.c
arch/arm/mach-at91/board-sam9m10g45ek.c
arch/arm/mach-at91/board-sam9rlek.c
arch/arm/mach-at91/board-usb-a9260.c
arch/arm/mach-at91/board-usb-a9263.c
arch/arm/mach-at91/board-yl-9200.c
arch/arm/mach-at91/gpio.c
arch/arm/mach-at91/include/mach/gpio.h
arch/arm/mach-at91/leds.c
arch/arm/mach-at91/pm.c
arch/arm/mach-davinci/Makefile
arch/arm/mach-davinci/da830.c
arch/arm/mach-davinci/da850.c
arch/arm/mach-davinci/dm355.c
arch/arm/mach-davinci/dm365.c
arch/arm/mach-davinci/dm644x.c
arch/arm/mach-davinci/dm646x.c
arch/arm/mach-davinci/include/mach/gpio-davinci.h [new file with mode: 0644]
arch/arm/mach-davinci/include/mach/gpio.h
arch/arm/mach-davinci/tnetv107x.c
arch/arm/mach-ebsa110/include/mach/io.h
arch/arm/mach-ep93xx/core.c
arch/arm/mach-ep93xx/edb93xx.c
arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h [moved from arch/arm/mach-ep93xx/include/mach/gpio.h with 87% similarity]
arch/arm/mach-ep93xx/simone.c
arch/arm/mach-ep93xx/snappercl15.c
arch/arm/mach-exynos4/include/mach/gpio.h
arch/arm/mach-footbridge/include/mach/io.h
arch/arm/mach-gemini/include/mach/gpio.h
arch/arm/mach-highbank/Makefile [new file with mode: 0644]
arch/arm/mach-highbank/Makefile.boot [new file with mode: 0644]
arch/arm/mach-highbank/clock.c [new file with mode: 0644]
arch/arm/mach-highbank/core.h [new file with mode: 0644]
arch/arm/mach-highbank/highbank.c [new file with mode: 0644]
arch/arm/mach-highbank/hotplug.c [new file with mode: 0644]
arch/arm/mach-highbank/include/mach/debug-macro.S [new file with mode: 0644]
arch/arm/mach-highbank/include/mach/entry-macro.S [new file with mode: 0644]
arch/arm/mach-highbank/include/mach/gpio.h [new file with mode: 0644]
arch/arm/mach-highbank/include/mach/io.h [new file with mode: 0644]
arch/arm/mach-highbank/include/mach/irqs.h [new file with mode: 0644]
arch/arm/mach-highbank/include/mach/memory.h [new file with mode: 0644]
arch/arm/mach-highbank/include/mach/system.h [new file with mode: 0644]
arch/arm/mach-highbank/include/mach/timex.h [new file with mode: 0644]
arch/arm/mach-highbank/include/mach/uncompress.h [new file with mode: 0644]
arch/arm/mach-highbank/include/mach/vmalloc.h [new file with mode: 0644]
arch/arm/mach-highbank/lluart.c [new file with mode: 0644]
arch/arm/mach-highbank/localtimer.c [new file with mode: 0644]
arch/arm/mach-highbank/platsmp.c [new file with mode: 0644]
arch/arm/mach-highbank/pm.c [new file with mode: 0644]
arch/arm/mach-highbank/sysregs.h [new file with mode: 0644]
arch/arm/mach-highbank/system.c [new file with mode: 0644]
arch/arm/mach-imx/iomux-imx31.c
arch/arm/mach-imx/mach-mx27ads.c
arch/arm/mach-integrator/include/mach/io.h
arch/arm/mach-ixp2000/core.c
arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h [moved from arch/arm/mach-ixp2000/include/mach/gpio.h with 95% similarity]
arch/arm/mach-ixp2000/ixdp2x00.c
arch/arm/mach-ixp4xx/dsmg600-setup.c
arch/arm/mach-ixp4xx/fsg-setup.c
arch/arm/mach-ixp4xx/include/mach/gpio.h
arch/arm/mach-ixp4xx/include/mach/io.h
arch/arm/mach-ixp4xx/nas100d-setup.c
arch/arm/mach-ixp4xx/nslu2-setup.c
arch/arm/mach-kirkwood/irq.c
arch/arm/mach-kirkwood/mpp.c
arch/arm/mach-ks8695/Makefile
arch/arm/mach-ks8695/board-acs5k.c
arch/arm/mach-ks8695/board-dsm320.c
arch/arm/mach-ks8695/board-micrel.c
arch/arm/mach-ks8695/devices.c
arch/arm/mach-ks8695/include/mach/gpio-ks8695.h [new file with mode: 0644]
arch/arm/mach-ks8695/include/mach/gpio.h
arch/arm/mach-ks8695/leds.c
arch/arm/mach-lpc32xx/Makefile
arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h [new file with mode: 0644]
arch/arm/mach-lpc32xx/include/mach/gpio.h
arch/arm/mach-lpc32xx/phy3250.c
arch/arm/mach-mmp/aspenite.c
arch/arm/mach-mmp/brownstone.c
arch/arm/mach-mmp/gplugd.c
arch/arm/mach-mmp/include/mach/gpio-pxa.h [new file with mode: 0644]
arch/arm/mach-mmp/include/mach/gpio.h
arch/arm/mach-mmp/jasper.c
arch/arm/mach-mmp/mmp2.c
arch/arm/mach-mmp/pxa168.c
arch/arm/mach-mmp/pxa910.c
arch/arm/mach-mmp/tavorevb.c
arch/arm/mach-msm/board-msm7x27.c
arch/arm/mach-msm/board-msm7x30.c
arch/arm/mach-msm/board-msm8x60.c
arch/arm/mach-msm/board-qsd8x50.c
arch/arm/mach-msm/board-sapphire.c
arch/arm/mach-msm/board-trout-mmc.c
arch/arm/mach-msm/board-trout-panel.c
arch/arm/mach-msm/include/mach/gpio.h
arch/arm/mach-mv78xx0/irq.c
arch/arm/mach-mv78xx0/mpp.c
arch/arm/mach-mx5/Kconfig
arch/arm/mach-mx5/Makefile
arch/arm/mach-mx5/board-mx51_babbage.c
arch/arm/mach-mx5/board-mx53_ard.c
arch/arm/mach-mx5/board-mx53_evk.c
arch/arm/mach-mx5/board-mx53_loco.c
arch/arm/mach-mx5/board-mx53_smd.c
arch/arm/mach-mx5/clock-mx51-mx53.c
arch/arm/mach-mx5/imx51-dt.c [new file with mode: 0644]
arch/arm/mach-mx5/imx53-dt.c [new file with mode: 0644]
arch/arm/mach-mxs/include/mach/gpio.h
arch/arm/mach-nomadik/board-nhk8815.c
arch/arm/mach-nomadik/cpu-8815.c
arch/arm/mach-nomadik/i2c-8815nhk.c
arch/arm/mach-nomadik/include/mach/gpio.h
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/devices.c
arch/arm/mach-omap1/fpga.c
arch/arm/mach-omap1/irq.c
arch/arm/mach-omap1/leds-h2p2-debug.c
arch/arm/mach-omap1/leds-osk.c
arch/arm/mach-omap1/leds.c
arch/arm/mach-omap1/mcbsp.c
arch/arm/mach-omap1/serial.c
arch/arm/mach-omap1/timer.c [new file with mode: 0644]
arch/arm/mach-omap2/Kconfig
arch/arm/mach-omap2/Makefile
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.c
arch/arm/mach-omap2/board-ti8168evm.c
arch/arm/mach-omap2/board-zoom.c
arch/arm/mach-omap2/clock2420_data.c
arch/arm/mach-omap2/clock2430_data.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
arch/arm/mach-omap2/clockdomain44xx.c
arch/arm/mach-omap2/clockdomains2420_data.c [new file with mode: 0644]
arch/arm/mach-omap2/clockdomains2430_data.c [new file with mode: 0644]
arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
arch/arm/mach-omap2/clockdomains3xxx_data.c [new file with mode: 0644]
arch/arm/mach-omap2/clockdomains44xx_data.c
arch/arm/mach-omap2/common.c
arch/arm/mach-omap2/devices.c
arch/arm/mach-omap2/display.c
arch/arm/mach-omap2/dma.c
arch/arm/mach-omap2/gpio.c
arch/arm/mach-omap2/hsmmc.c
arch/arm/mach-omap2/hwspinlock.c
arch/arm/mach-omap2/id.c
arch/arm/mach-omap2/io.c
arch/arm/mach-omap2/irq.c
arch/arm/mach-omap2/mcbsp.c
arch/arm/mach-omap2/omap_hwmod.c
arch/arm/mach-omap2/omap_hwmod_2420_data.c
arch/arm/mach-omap2/omap_hwmod_2430_data.c
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
arch/arm/mach-omap2/omap_hwmod_44xx_data.c
arch/arm/mach-omap2/omap_l3_noc.c
arch/arm/mach-omap2/omap_l3_noc.h
arch/arm/mach-omap2/omap_l3_smx.c
arch/arm/mach-omap2/omap_l3_smx.h
arch/arm/mach-omap2/omap_twl.c
arch/arm/mach-omap2/opp.c
arch/arm/mach-omap2/pm.c
arch/arm/mach-omap2/pm24xx.c
arch/arm/mach-omap2/pm34xx.c
arch/arm/mach-omap2/powerdomain-common.c
arch/arm/mach-omap2/powerdomain.c
arch/arm/mach-omap2/powerdomain.h
arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c
arch/arm/mach-omap2/powerdomains2xxx_data.c
arch/arm/mach-omap2/powerdomains3xxx_data.c
arch/arm/mach-omap2/powerdomains44xx_data.c
arch/arm/mach-omap2/prm2xxx_3xxx.c
arch/arm/mach-omap2/prm2xxx_3xxx.h
arch/arm/mach-omap2/prm44xx.c
arch/arm/mach-omap2/prm44xx.h
arch/arm/mach-omap2/serial.c
arch/arm/mach-omap2/smartreflex-class3.c
arch/arm/mach-omap2/smartreflex.c
arch/arm/mach-omap2/sr_device.c
arch/arm/mach-omap2/timer.c
arch/arm/mach-omap2/usb-musb.c
arch/arm/mach-omap2/vc.c [new file with mode: 0644]
arch/arm/mach-omap2/vc.h
arch/arm/mach-omap2/vc3xxx_data.c
arch/arm/mach-omap2/vc44xx_data.c
arch/arm/mach-omap2/voltage.c
arch/arm/mach-omap2/voltage.h
arch/arm/mach-omap2/voltagedomains2xxx_data.c [new file with mode: 0644]
arch/arm/mach-omap2/voltagedomains3xxx_data.c
arch/arm/mach-omap2/voltagedomains44xx_data.c
arch/arm/mach-omap2/vp.c [new file with mode: 0644]
arch/arm/mach-omap2/vp.h
arch/arm/mach-omap2/vp3xxx_data.c
arch/arm/mach-omap2/vp44xx_data.c
arch/arm/mach-orion5x/db88f5281-setup.c
arch/arm/mach-orion5x/dns323-setup.c
arch/arm/mach-orion5x/irq.c
arch/arm/mach-orion5x/kurobox_pro-setup.c
arch/arm/mach-orion5x/mv2120-setup.c
arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
arch/arm/mach-orion5x/rd88f5182-setup.c
arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
arch/arm/mach-orion5x/terastation_pro2-setup.c
arch/arm/mach-orion5x/ts209-setup.c
arch/arm/mach-orion5x/ts409-setup.c
arch/arm/mach-orion5x/wnr854t-setup.c
arch/arm/mach-orion5x/wrt350n-v2-setup.c
arch/arm/mach-picoxcell/Makefile [new file with mode: 0644]
arch/arm/mach-picoxcell/Makefile.boot [new file with mode: 0644]
arch/arm/mach-picoxcell/common.c [new file with mode: 0644]
arch/arm/mach-picoxcell/common.h [new file with mode: 0644]
arch/arm/mach-picoxcell/include/mach/debug-macro.S [new file with mode: 0644]
arch/arm/mach-picoxcell/include/mach/entry-macro.S [new file with mode: 0644]
arch/arm/mach-picoxcell/include/mach/gpio.h [new file with mode: 0644]
arch/arm/mach-picoxcell/include/mach/hardware.h [new file with mode: 0644]
arch/arm/mach-picoxcell/include/mach/io.h [new file with mode: 0644]
arch/arm/mach-picoxcell/include/mach/irqs.h [new file with mode: 0644]
arch/arm/mach-picoxcell/include/mach/map.h [new file with mode: 0644]
arch/arm/mach-picoxcell/include/mach/memory.h [new file with mode: 0644]
arch/arm/mach-picoxcell/include/mach/picoxcell_soc.h [new file with mode: 0644]
arch/arm/mach-picoxcell/include/mach/system.h [new file with mode: 0644]
arch/arm/mach-picoxcell/include/mach/timex.h [new file with mode: 0644]
arch/arm/mach-picoxcell/include/mach/uncompress.h [new file with mode: 0644]
arch/arm/mach-picoxcell/include/mach/vmalloc.h [new file with mode: 0644]
arch/arm/mach-picoxcell/io.c [new file with mode: 0644]
arch/arm/mach-picoxcell/time.c [new file with mode: 0644]
arch/arm/mach-pnx4008/gpio.c
arch/arm/mach-pnx4008/include/mach/gpio-pnx4008.h [moved from arch/arm/mach-pnx4008/include/mach/gpio.h with 99% similarity]
arch/arm/mach-pnx4008/serial.c
arch/arm/mach-pxa/cm-x255.c
arch/arm/mach-pxa/generic.c
arch/arm/mach-pxa/include/mach/gpio-pxa.h [new file with mode: 0644]
arch/arm/mach-pxa/include/mach/gpio.h
arch/arm/mach-pxa/include/mach/littleton.h
arch/arm/mach-pxa/irq.c
arch/arm/mach-pxa/lpd270.c
arch/arm/mach-pxa/lubbock.c
arch/arm/mach-pxa/mainstone.c
arch/arm/mach-pxa/mfp-pxa2xx.c
arch/arm/mach-pxa/pcm990-baseboard.c
arch/arm/mach-pxa/pxa25x.c
arch/arm/mach-pxa/pxa27x.c
arch/arm/mach-pxa/pxa3xx.c
arch/arm/mach-pxa/pxa95x.c
arch/arm/mach-pxa/saarb.c
arch/arm/mach-realview/include/mach/gpio.h
arch/arm/mach-rpc/include/mach/hardware.h
arch/arm/mach-rpc/include/mach/io.h
arch/arm/mach-rpc/riscpc.c
arch/arm/mach-s3c2410/include/mach/gpio.h
arch/arm/mach-s3c2410/include/mach/h1940-latch.h
arch/arm/mach-s3c2410/include/mach/io.h
arch/arm/mach-s3c2410/s3c2410.c
arch/arm/mach-s3c2412/s3c2412.c
arch/arm/mach-s3c2416/s3c2416.c
arch/arm/mach-s3c2440/s3c2440.c
arch/arm/mach-s3c2440/s3c2442.c
arch/arm/mach-s3c64xx/include/mach/gpio.h
arch/arm/mach-s5p64x0/include/mach/gpio.h
arch/arm/mach-s5pc100/include/mach/gpio.h
arch/arm/mach-s5pv210/include/mach/gpio.h
arch/arm/mach-sa1100/Makefile
arch/arm/mach-sa1100/generic.c
arch/arm/mach-sa1100/include/mach/gpio.h
arch/arm/mach-sa1100/include/mach/io.h
arch/arm/mach-shmobile/include/mach/gpio.h
arch/arm/mach-tegra/board-harmony-pcie.c
arch/arm/mach-tegra/board-harmony.h
arch/arm/mach-tegra/board-paz00.h
arch/arm/mach-tegra/board-seaboard.h
arch/arm/mach-tegra/board-trimslice-pinmux.c
arch/arm/mach-tegra/board-trimslice.h
arch/arm/mach-tegra/cpu-tegra.c
arch/arm/mach-tegra/include/mach/gpio-tegra.h [new file with mode: 0644]
arch/arm/mach-tegra/include/mach/gpio.h
arch/arm/mach-tegra/usb_phy.c
arch/arm/mach-u300/Kconfig
arch/arm/mach-u300/core.c
arch/arm/mach-u300/include/mach/gpio-u300.h [new file with mode: 0644]
arch/arm/mach-u300/include/mach/gpio.h
arch/arm/mach-u300/include/mach/irqs.h
arch/arm/mach-u300/mmc.c
arch/arm/mach-ux500/Kconfig
arch/arm/mach-ux500/board-mop500-pins.c
arch/arm/mach-ux500/board-mop500-u8500uib.c
arch/arm/mach-ux500/board-mop500.c
arch/arm/mach-ux500/board-u5500-sdi.c
arch/arm/mach-ux500/board-u5500.c
arch/arm/mach-ux500/cpu-db5500.c
arch/arm/mach-ux500/cpu-db8500.c
arch/arm/mach-ux500/devices-common.c
arch/arm/mach-ux500/include/mach/gpio.h
arch/arm/mach-versatile/include/mach/gpio.h
arch/arm/mach-vexpress/include/mach/io.h
arch/arm/mach-vt8500/include/mach/gpio.h
arch/arm/mach-vt8500/include/mach/io.h
arch/arm/mach-w90x900/include/mach/gpio.h
arch/arm/mm/Kconfig
arch/arm/mm/cache-l2x0.c
arch/arm/mm/init.c
arch/arm/plat-mxc/include/mach/common.h
arch/arm/plat-mxc/include/mach/gpio.h
arch/arm/plat-nomadik/include/plat/gpio-nomadik.h [moved from arch/arm/plat-nomadik/include/plat/gpio.h with 82% similarity]
arch/arm/plat-omap/debug-devices.c
arch/arm/plat-omap/debug-leds.c
arch/arm/plat-omap/devices.c
arch/arm/plat-omap/dmtimer.c
arch/arm/plat-omap/i2c.c
arch/arm/plat-omap/include/plat/clock.h
arch/arm/plat-omap/include/plat/common.h
arch/arm/plat-omap/include/plat/cpu.h
arch/arm/plat-omap/include/plat/dmtimer.h
arch/arm/plat-omap/include/plat/gpio.h
arch/arm/plat-omap/include/plat/io.h
arch/arm/plat-omap/include/plat/mcbsp.h
arch/arm/plat-omap/include/plat/omap_device.h
arch/arm/plat-omap/include/plat/omap_hwmod.h
arch/arm/plat-omap/include/plat/voltage.h [new file with mode: 0644]
arch/arm/plat-omap/mcbsp.c
arch/arm/plat-omap/omap_device.c
arch/arm/plat-orion/include/plat/gpio.h
arch/arm/plat-pxa/Makefile
arch/arm/plat-pxa/include/plat/gpio-pxa.h [new file with mode: 0644]
arch/arm/plat-pxa/include/plat/gpio.h
arch/arm/plat-s5p/irq-gpioint.c
arch/arm/plat-spear/include/plat/gpio.h
arch/mips/Kconfig
arch/mips/alchemy/common/platform.c
arch/mips/alchemy/common/power.c
arch/mips/alchemy/devboards/bcsr.c
arch/mips/alchemy/devboards/db1200/setup.c
arch/mips/ar7/irq.c
arch/mips/bcm63xx/irq.c
arch/mips/cobalt/irq.c
arch/mips/dec/setup.c
arch/mips/emma/markeins/irq.c
arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h
arch/mips/include/asm/mach-powertv/dma-coherence.h
arch/mips/include/asm/stackframe.h
arch/mips/jz4740/gpio.c
arch/mips/kernel/ftrace.c
arch/mips/kernel/i8259.c
arch/mips/kernel/linux32.c
arch/mips/kernel/scall64-n32.S
arch/mips/kernel/scall64-o32.S
arch/mips/kernel/signal.c
arch/mips/kernel/traps.c
arch/mips/kernel/vpe.c
arch/mips/lantiq/irq.c
arch/mips/lantiq/xway/ebu.c
arch/mips/lantiq/xway/pmu.c
arch/mips/lasat/interrupt.c
arch/mips/loongson/fuloong-2e/irq.c
arch/mips/loongson/lemote-2f/irq.c
arch/mips/mm/mmap.c
arch/mips/mm/tlbex.c
arch/mips/mti-malta/malta-int.c
arch/mips/netlogic/xlr/Makefile
arch/mips/pci/pci-lantiq.c
arch/mips/pci/pci-rc32434.c
arch/mips/pmc-sierra/msp71xx/msp_irq.c
arch/mips/pnx8550/common/int.c
arch/mips/sgi-ip22/ip22-int.c
arch/mips/sni/rm200.c
arch/mips/vr41xx/common/irq.c
arch/sparc/include/asm/pgtsrmmu.h
arch/sparc/kernel/pci.c
arch/sparc/kernel/signal32.c
arch/sparc/kernel/signal_32.c
arch/sparc/kernel/signal_64.c
arch/sparc/mm/leon_mm.c
arch/tile/kernel/intvec_32.S
arch/tile/lib/atomic_asm_32.S
arch/x86/kernel/vsyscall_64.c
arch/x86/mm/init.c
arch/x86/pci/acpi.c
arch/x86/platform/mrst/mrst.c
crypto/ghash-generic.c
drivers/ata/pata_at91.c
drivers/gpio/Kconfig
drivers/gpio/Makefile
drivers/gpio/gpio-davinci.c [moved from arch/arm/mach-davinci/gpio.c with 98% similarity]
drivers/gpio/gpio-ep93xx.c
drivers/gpio/gpio-ks8695.c [moved from arch/arm/mach-ks8695/gpio.c with 99% similarity]
drivers/gpio/gpio-lpc32xx.c [moved from arch/arm/mach-lpc32xx/gpiolib.c with 99% similarity]
drivers/gpio/gpio-nomadik.c
drivers/gpio/gpio-omap.c
drivers/gpio/gpio-pca953x.c
drivers/gpio/gpio-pxa.c [moved from arch/arm/plat-pxa/gpio.c with 99% similarity]
drivers/gpio/gpio-sa1100.c [moved from arch/arm/mach-sa1100/gpio.c with 96% similarity]
drivers/gpio/gpio-tegra.c
drivers/gpio/gpio-tnetv107x.c [moved from arch/arm/mach-davinci/gpio-tnetv107x.c with 100% similarity]
drivers/gpio/gpio-u300.c
drivers/gpu/drm/radeon/atom.c
drivers/gpu/drm/radeon/atom.h
drivers/gpu/drm/radeon/atombios_crtc.c
drivers/gpu/drm/radeon/atombios_dp.c
drivers/gpu/drm/radeon/radeon_connectors.c
drivers/gpu/drm/radeon/radeon_encoders.c
drivers/gpu/drm/ttm/ttm_bo_util.c
drivers/hwmon/w83627ehf.c
drivers/i2c/busses/i2c-ixp2000.c
drivers/ide/Kconfig
drivers/ide/at91_ide.c
drivers/input/keyboard/omap-keypad.c
drivers/input/tablet/wacom_wac.c
drivers/iommu/intel-iommu.c
drivers/md/dm-crypt.c
drivers/md/dm-flakey.c
drivers/md/dm-kcopyd.c
drivers/md/dm-raid.c
drivers/md/dm-table.c
drivers/md/md.c
drivers/md/md.h
drivers/md/multipath.c
drivers/md/raid1.c
drivers/md/raid10.c
drivers/md/raid5.c
drivers/media/video/v4l2-dev.c
drivers/mfd/menelaus.c
drivers/mmc/host/omap.c
drivers/mmc/host/sdhci-tegra.c
drivers/mtd/nand/ams-delta.c
drivers/mtd/onenand/omap2.c
drivers/net/arm/at91_ether.c
drivers/net/bnx2x/bnx2x.h
drivers/net/bnx2x/bnx2x_cmn.h
drivers/net/bonding/bond_main.c
drivers/net/can/mscan/mscan.c
drivers/net/macvlan.c
drivers/net/mlx4/en_tx.c
drivers/net/netconsole.c
drivers/net/pptp.c
drivers/net/r8169.c
drivers/net/smsc911x.c
drivers/net/tg3.c
drivers/of/base.c
drivers/pcmcia/pxa2xx_vpac270.c
drivers/scsi/libsas/sas_expander.c
drivers/scsi/qla2xxx/qla_os.c
drivers/spi/spi-atmel.c
drivers/staging/octeon/ethernet-rx.c
drivers/tty/serial/atmel_serial.c
drivers/tty/serial/lantiq.c
drivers/tty/serial/msm_serial.c
drivers/usb/host/ohci-pnx4008.c
drivers/usb/musb/davinci.c
drivers/video/atmel_lcdfb.c
drivers/video/omap/lcd_apollon.c
drivers/video/omap/lcd_h3.c
drivers/video/omap/lcd_inn1610.c
drivers/video/omap/lcd_ldp.c
drivers/video/omap/lcd_osk.c
drivers/video/omap/lcd_overo.c
drivers/video/omap/lcd_palmtt.c
drivers/video/pnx4008/sdum.c
fs/btrfs/ioctl.c
fs/cifs/connect.c
fs/xfs/xfs_buf_item.c
fs/xfs/xfs_dquot_item.c
fs/xfs/xfs_inode_item.c
fs/xfs/xfs_linux.h
fs/xfs/xfs_super.c
fs/xfs/xfs_trans.h
fs/xfs/xfs_trans_ail.c
fs/xfs/xfs_trans_priv.h
include/linux/device-mapper.h
include/linux/of.h
include/net/ip_vs.h
include/net/udplite.h
kernel/posix-cpu-timers.c
kernel/sys.c
mm/migrate.c
net/bluetooth/l2cap_sock.c
net/bluetooth/rfcomm/sock.c
net/bluetooth/sco.c
net/bridge/br_device.c
net/bridge/br_if.c
net/bridge/br_netlink.c
net/bridge/br_private.h
net/core/fib_rules.c
net/ipv4/tcp_input.c
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_minisocks.c
net/ipv6/af_inet6.c
net/ipv6/tcp_ipv6.c
net/l2tp/l2tp_core.c
net/netfilter/ipvs/ip_vs_ctl.c
net/netfilter/ipvs/ip_vs_sync.c
net/netfilter/nf_conntrack_proto_gre.c
net/x25/af_x25.c
net/x25/x25_dev.c
net/x25/x25_facilities.c
net/x25/x25_in.c
net/x25/x25_link.c
net/x25/x25_subr.c
security/security.c
sound/pci/hda/hda_intel.c
sound/pci/hda/patch_conexant.c

diff --git a/Documentation/devicetree/bindings/arm/calxeda.txt b/Documentation/devicetree/bindings/arm/calxeda.txt
new file mode 100644 (file)
index 0000000..4755caa
--- /dev/null
@@ -0,0 +1,8 @@
+Calxeda Highbank Platforms Device Tree Bindings
+-----------------------------------------------
+
+Boards with Calxeda Cortex-A9 based Highbank SOC shall have the following
+properties.
+
+Required root node properties:
+    - compatible = "calxeda,highbank";
index 345bfc036561baf3f5130c541ccae035bf93038e..c9848ad0e2e3c65967d5c047284a399987b32f33 100644 (file)
@@ -1,6 +1,26 @@
 Freescale i.MX Platforms Device Tree Bindings
 -----------------------------------------------
 
+i.MX51 Babbage Board
+Required root node properties:
+    - compatible = "fsl,imx51-babbage", "fsl,imx51";
+
+i.MX53 Automotive Reference Design Board
+Required root node properties:
+    - compatible = "fsl,imx53-ard", "fsl,imx53";
+
+i.MX53 Evaluation Kit
+Required root node properties:
+    - compatible = "fsl,imx53-evk", "fsl,imx53";
+
+i.MX53 Quick Start Board
+Required root node properties:
+    - compatible = "fsl,imx53-qsb", "fsl,imx53";
+
+i.MX53 Smart Mobile Reference Design Board
+Required root node properties:
+    - compatible = "fsl,imx53-smd", "fsl,imx53";
+
 i.MX6 Quad SABRE Automotive Board
 Required root node properties:
     - compatible = "fsl,imx6q-sabreauto", "fsl,imx6q";
diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt
new file mode 100644 (file)
index 0000000..7ca5216
--- /dev/null
@@ -0,0 +1,44 @@
+* ARM L2 Cache Controller
+
+ARM cores often have a separate level 2 cache controller. There are various
+implementations of the L2 cache controller with compatible programming models.
+The ARM L2 cache representation in the device tree should be done as follows:
+
+Required properties:
+
+- compatible : should be one of:
+       "arm,pl310-cache"
+       "arm,l220-cache"
+       "arm,l210-cache"
+- cache-unified : Specifies the cache is a unified cache.
+- cache-level : Should be set to 2 for a level 2 cache.
+- reg : Physical base address and size of cache controller's memory mapped
+  registers.
+
+Optional properties:
+
+- arm,data-latency : Cycles of latency for Data RAM accesses. Specifies 3 cells of
+  read, write and setup latencies. Minimum valid values are 1. Controllers
+  without setup latency control should use a value of 0.
+- arm,tag-latency : Cycles of latency for Tag RAM accesses. Specifies 3 cells of
+  read, write and setup latencies. Controllers without setup latency control
+  should use 0. Controllers without separate read and write Tag RAM latency
+  values should only use the first cell.
+- arm,dirty-latency : Cycles of latency for Dirty RAMs. This is a single cell.
+- arm,filter-ranges : <start length> Starting address and length of window to
+  filter. Addresses in the filter window are directed to the M1 port. Other
+  addresses will go to the M0 port.
+- interrupts : 1 combined interrupt.
+
+Example:
+
+L2: cache-controller {
+        compatible = "arm,pl310-cache";
+        reg = <0xfff12000 0x1000>;
+        arm,data-latency = <1 1 1>;
+        arm,tag-latency = <2 2 2>;
+        arm,filter-latency = <0x80000000 0x8000000>;
+        cache-unified;
+        cache-level = <2>;
+       interrupts = <45>;
+};
diff --git a/Documentation/devicetree/bindings/arm/omap/dsp.txt b/Documentation/devicetree/bindings/arm/omap/dsp.txt
new file mode 100644 (file)
index 0000000..d3830a3
--- /dev/null
@@ -0,0 +1,14 @@
+* TI - DSP (Digital Signal Processor)
+
+TI DSP included in OMAP SoC
+
+Required properties:
+- compatible : Should be "ti,omap3-c64" for OMAP3 & 4
+- ti,hwmods: "dsp"
+
+Examples:
+
+dsp {
+    compatible = "ti,omap3-c64";
+    ti,hwmods = "dsp";
+};
diff --git a/Documentation/devicetree/bindings/arm/omap/iva.txt b/Documentation/devicetree/bindings/arm/omap/iva.txt
new file mode 100644 (file)
index 0000000..6d62951
--- /dev/null
@@ -0,0 +1,19 @@
+* TI - IVA (Imaging and Video Accelerator) subsystem
+
+The IVA contain various audio, video or imaging HW accelerator
+depending of the version.
+
+Required properties:
+- compatible : Should be:
+  - "ti,ivahd" for OMAP4
+  - "ti,iva2.2" for OMAP3
+  - "ti,iva2.1" for OMAP2430
+  - "ti,iva1" for OMAP2420
+- ti,hwmods: "iva"
+
+Examples:
+
+iva {
+    compatible = "ti,ivahd", "ti,iva";
+    ti,hwmods = "iva";
+};
diff --git a/Documentation/devicetree/bindings/arm/omap/l3-noc.txt b/Documentation/devicetree/bindings/arm/omap/l3-noc.txt
new file mode 100644 (file)
index 0000000..6888a5e
--- /dev/null
@@ -0,0 +1,19 @@
+* TI - L3 Network On Chip (NoC)
+
+This version is an implementation of the generic NoC IP
+provided by Arteris.
+
+Required properties:
+- compatible : Should be "ti,omap3-l3-smx" for OMAP3 family
+               Should be "ti,omap4-l3-noc" for OMAP4 family
+- ti,hwmods: "l3_main_1", ... One hwmod for each noc domain.
+
+Examples:
+
+ocp {
+       compatible = "ti,omap4-l3-noc", "simple-bus";
+       #address-cells = <1>;
+       #size-cells = <1>;
+       ranges;
+       ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
+};
diff --git a/Documentation/devicetree/bindings/arm/omap/mpu.txt b/Documentation/devicetree/bindings/arm/omap/mpu.txt
new file mode 100644 (file)
index 0000000..1a5a42c
--- /dev/null
@@ -0,0 +1,27 @@
+* TI - MPU (Main Processor Unit) subsystem
+
+The MPU subsystem contain one or several ARM cores
+depending of the version.
+The MPU contain CPUs, GIC, L2 cache and a local PRCM.
+
+Required properties:
+- compatible : Should be "ti,omap3-mpu" for OMAP3
+               Should be "ti,omap4-mpu" for OMAP4
+- ti,hwmods: "mpu"
+
+Examples:
+
+- For an OMAP4 SMP system:
+
+mpu {
+    compatible = "ti,omap4-mpu";
+    ti,hwmods = "mpu";
+};
+
+
+- For an OMAP3 monocore system:
+
+mpu {
+    compatible = "ti,omap3-mpu";
+    ti,hwmods = "mpu";
+};
diff --git a/Documentation/devicetree/bindings/arm/omap/omap.txt b/Documentation/devicetree/bindings/arm/omap/omap.txt
new file mode 100644 (file)
index 0000000..dbdab40
--- /dev/null
@@ -0,0 +1,43 @@
+* Texas Instruments OMAP
+
+OMAP is currently using a static file per SoC family to describe the
+IPs present in the SoC.
+On top of that an omap_device is created to extend the platform_device
+capabilities and to allow binding with one or several hwmods.
+The hwmods will contain all the information to build the device:
+adresse range, irq lines, dma lines, interconnect, PRCM register,
+clock domain, input clocks.
+For the moment just point to the existing hwmod, the next step will be
+to move data from hwmod to device-tree representation.
+
+
+Required properties:
+- compatible: Every devices present in OMAP SoC should be in the
+  form: "ti,XXX"
+- ti,hwmods: list of hwmod names (ascii strings), that comes from the OMAP
+  HW documentation, attached to a device. Must contain at least
+  one hwmod.
+
+Optional properties:
+- ti,no_idle_on_suspend: When present, it prevents the PM to idle the module
+  during suspend.
+
+
+Example:
+
+spinlock@1 {
+    compatible = "ti,omap4-spinlock";
+    ti,hwmods = "spinlock";
+};
+
+
+Boards:
+
+- OMAP3 BeagleBoard : Low cost community board
+  compatible = "ti,omap3-beagle", "ti,omap3"
+
+- OMAP4 SDP : Software Developement Board
+  compatible = "ti,omap4-sdp", "ti,omap4430"
+
+- OMAP4 PandaBoard : Low cost community board
+  compatible = "ti,omap4-panda", "ti,omap4430"
diff --git a/Documentation/devicetree/bindings/arm/picoxcell.txt b/Documentation/devicetree/bindings/arm/picoxcell.txt
new file mode 100644 (file)
index 0000000..e75c0ef
--- /dev/null
@@ -0,0 +1,24 @@
+Picochip picoXcell device tree bindings.
+========================================
+
+Required root node properties:
+    - compatible:
+       - "picochip,pc7302-pc3x3" : PC7302 development board with PC3X3 device.
+       - "picochip,pc7302-pc3x2" : PC7302 development board with PC3X2 device.
+       - "picochip,pc3x3" : picoXcell PC3X3 device based board.
+       - "picochip,pc3x2" : picoXcell PC3X2 device based board.
+
+Timers required properties:
+    - compatible = "picochip,pc3x2-timer"
+    - interrupts : The single IRQ line for the timer.
+    - clock-freq : The frequency in HZ of the timer.
+    - reg : The register bank for the timer.
+
+Note: two timers are required - one for the scheduler clock and one for the
+event tick/NOHZ.
+
+VIC required properties:
+    - compatible = "arm,pl192-vic".
+    - interrupt-controller.
+    - reg : The register bank for the device.
+    - #interrupt-cells : Must be 1.
diff --git a/Documentation/devicetree/bindings/tty/serial/msm_serial.txt b/Documentation/devicetree/bindings/tty/serial/msm_serial.txt
new file mode 100644 (file)
index 0000000..aef383e
--- /dev/null
@@ -0,0 +1,27 @@
+* Qualcomm MSM UART
+
+Required properties:
+- compatible :
+       - "qcom,msm-uart", and one of "qcom,msm-hsuart" or
+         "qcom,msm-lsuart".
+- reg : offset and length of the register set for the device
+       for the hsuart operating in compatible mode, there should be a
+       second pair describing the gsbi registers.
+- interrupts : should contain the uart interrupt.
+
+There are two different UART blocks used in MSM devices,
+"qcom,msm-hsuart" and "qcom,msm-lsuart".  The msm-serial driver is
+able to handle both of these, and matches against the "qcom,msm-uart"
+as the compatibility.
+
+The registers for the "qcom,msm-hsuart" device need to specify both
+register blocks, even for the common driver.
+
+Example:
+
+       uart@19c400000 {
+               compatible = "qcom,msm-hsuart", "qcom,msm-uart";
+               reg = <0x19c40000 0x1000>,
+                     <0x19c00000 0x1000>;
+               interrupts = <195>;
+       };
index 854ed5ca7e3f122f5ac808b462eb14b9ee6b1977..d6e6724446c88722500a01db7f35d2a23ba7ac5f 100644 (file)
@@ -2706,10 +2706,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
                        functions are at fixed addresses, they make nice
                        targets for exploits that can control RIP.
 
-                       emulate     [default] Vsyscalls turn into traps and are
-                                   emulated reasonably safely.
+                       emulate     Vsyscalls turn into traps and are emulated
+                                   reasonably safely.
 
-                       native      Vsyscalls are native syscall instructions.
+                       native      [default] Vsyscalls are native syscall
+                                   instructions.
                                    This is a little bit faster than trapping
                                    and makes a few dynamic recompilers work
                                    better than they would in emulation mode.
index 8ce7c30e7230e9912eb6a510f46292a1649a2e50..fe67b5c79f0ff33d92ebe7469a89c5a5d044fc0a 100644 (file)
@@ -27,7 +27,7 @@ applying a filter to each packet that assigns it to one of a small number
 of logical flows. Packets for each flow are steered to a separate receive
 queue, which in turn can be processed by separate CPUs. This mechanism is
 generally known as “Receive-side Scaling” (RSS). The goal of RSS and
-the other scaling techniques to increase performance uniformly.
+the other scaling techniques is to increase performance uniformly.
 Multi-queue distribution can also be used for traffic prioritization, but
 that is not the focus of these techniques.
 
@@ -186,10 +186,10 @@ are steered using plain RPS. Multiple table entries may point to the
 same CPU. Indeed, with many flows and few CPUs, it is very likely that
 a single application thread handles flows with many different flow hashes.
 
-rps_sock_table is a global flow table that contains the *desired* CPU for
-flows: the CPU that is currently processing the flow in userspace. Each
-table value is a CPU index that is updated during calls to recvmsg and
-sendmsg (specifically, inet_recvmsg(), inet_sendmsg(), inet_sendpage()
+rps_sock_flow_table is a global flow table that contains the *desired* CPU
+for flows: the CPU that is currently processing the flow in userspace.
+Each table value is a CPU index that is updated during calls to recvmsg
+and sendmsg (specifically, inet_recvmsg(), inet_sendmsg(), inet_sendpage()
 and tcp_splice_read()).
 
 When the scheduler moves a thread to a new CPU while it has outstanding
index 33478f7bcc662512cf20c47f699001b6c71564ce..1ba8fffdd7ef1a924da1d00e2e8029a4460c63da 100644 (file)
@@ -688,6 +688,12 @@ F: drivers/mtd/nand/bcm_umi_nand.c
 F:     drivers/mtd/nand/bcm_umi_bch.c
 F:     drivers/mtd/nand/nand_bcm_umi.h
 
+ARM/CALXEDA HIGHBANK ARCHITECTURE
+M:     Rob Herring <rob.herring@calxeda.com>
+L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
+S:     Maintained
+F:     arch/arm/mach-highbank/
+
 ARM/CAVIUM NETWORKS CNS3XXX MACHINE SUPPORT
 M:     Anton Vorontsov <avorontsov@mvista.com>
 S:     Maintained
@@ -2467,7 +2473,7 @@ S:        Supported
 F:     drivers/infiniband/hw/ehca/
 
 EHEA (IBM pSeries eHEA 10Gb ethernet adapter) DRIVER
-M:     Breno Leitao <leitao@linux.vnet.ibm.com>
+M:     Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
 L:     netdev@vger.kernel.org
 S:     Maintained
 F:     drivers/net/ehea/
@@ -3320,7 +3326,7 @@ M:        David Woodhouse <dwmw2@infradead.org>
 L:     iommu@lists.linux-foundation.org
 T:     git git://git.infradead.org/iommu-2.6.git
 S:     Supported
-F:     drivers/pci/intel-iommu.c
+F:     drivers/iommu/intel-iommu.c
 F:     include/linux/intel-iommu.h
 
 INTEL IOP-ADMA DMA DRIVER
@@ -6373,10 +6379,10 @@ F:      net/ipv4/tcp_lp.c
 
 TEGRA SUPPORT
 M:     Colin Cross <ccross@android.com>
-M:     Erik Gilling <konkers@android.com>
 M:     Olof Johansson <olof@lixom.net>
+M:     Stephen Warren <swarren@nvidia.com>
 L:     linux-tegra@vger.kernel.org
-T:     git git://android.git.kernel.org/kernel/tegra.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/olof/tegra.git
 S:     Supported
 F:     arch/arm/mach-tegra
 
index 31f967c31e7f8248b14173f4e336a8c902ef0b7a..07bc92544e9cab9ea9fd201b8a5f36fb9dbb9168 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 3
 PATCHLEVEL = 1
 SUBLEVEL = 0
-EXTRAVERSION = -rc9
+EXTRAVERSION =
 NAME = "Divemaster Edition"
 
 # *DOCUMENTATION*
index 18400a7b6ca1e932de1506a69c7c407352297b08..f41fe7a40019b4f59b4d80aac85fa0e867cb4129 100644 (file)
@@ -330,6 +330,20 @@ config ARCH_BCMRING
        help
          Support for Broadcom's BCMRing platform.
 
+config ARCH_HIGHBANK
+       bool "Calxeda Highbank-based"
+       select ARCH_WANT_OPTIONAL_GPIOLIB
+       select ARM_AMBA
+       select ARM_GIC
+       select ARM_TIMER_SP804
+       select CLKDEV_LOOKUP
+       select CPU_V7
+       select GENERIC_CLOCKEVENTS
+       select HAVE_ARM_SCU
+       select USE_OF
+       help
+         Support for the Calxeda Highbank SoC based boards.
+
 config ARCH_CLPS711X
        bool "Cirrus Logic CLPS711x/EP721x-based"
        select CPU_ARM720T
@@ -629,6 +643,24 @@ config ARCH_TEGRA
          This enables support for NVIDIA Tegra based systems (Tegra APX,
          Tegra 6xx and Tegra 2 series).
 
+config ARCH_PICOXCELL
+       bool "Picochip picoXcell"
+       select ARCH_REQUIRE_GPIOLIB
+       select ARM_PATCH_PHYS_VIRT
+       select ARM_VIC
+       select CPU_V6K
+       select DW_APB_TIMER
+       select GENERIC_CLOCKEVENTS
+       select GENERIC_GPIO
+       select HAVE_SCHED_CLOCK
+       select HAVE_TCM
+       select NO_IOPORT
+       select USE_OF
+       help
+         This enables support for systems based on the Picochip picoXcell
+         family of Femtocell devices.  The picoxcell support requires device tree
+         for all boards.
+
 config ARCH_PNX4008
        bool "Philips Nexperia PNX4008 Mobile"
        select CPU_ARM926T
@@ -862,6 +894,7 @@ config ARCH_U300
        select CLKDEV_LOOKUP
        select HAVE_MACH_CLKDEV
        select GENERIC_GPIO
+       select ARCH_REQUIRE_GPIOLIB
        select NEED_MACH_MEMORY_H
        help
          Support for ST-Ericsson U300 series mobile platforms.
@@ -1402,7 +1435,7 @@ config SMP
        depends on REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP || \
                 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \
                 ARCH_EXYNOS4 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || \
-                ARCH_MSM_SCORPIONMP || ARCH_SHMOBILE || SOC_IMX6Q
+                ARCH_MSM_SCORPIONMP || ARCH_SHMOBILE || ARCH_HIGHBANK || SOC_IMX6Q
        select USE_GENERIC_SMP_HELPERS
        select HAVE_ARM_SCU if !ARCH_MSM_SCORPIONMP
        help
index a1cb48497312393b7c1156b7390f4cc0eaa16b95..c865b927136464568904dee22f05ca586e11dced 100644 (file)
@@ -128,6 +128,13 @@ choice
                  Say Y here if you want the debug print routines to direct
                  their output to the second serial port on these devices.
 
+       config DEBUG_HIGHBANK_UART
+               bool "Kernel low-level debugging messages via Highbank UART"
+               depends on ARCH_HIGHBANK
+               help
+                 Say Y here if you want the debug print routines to direct
+                 their output to the UART on Highbank based devices.
+
        config DEBUG_IMX1_UART
                bool "i.MX1 Debug UART"
                depends on SOC_IMX1
index 4e98937f1b2d784a5dd52efbc380beaa2974529f..ae458aee8b68cc773db52a61a5a1d1d593c3abdf 100644 (file)
@@ -144,6 +144,7 @@ machine-$(CONFIG_ARCH_EBSA110)              := ebsa110
 machine-$(CONFIG_ARCH_EP93XX)          := ep93xx
 machine-$(CONFIG_ARCH_GEMINI)          := gemini
 machine-$(CONFIG_ARCH_H720X)           := h720x
+machine-$(CONFIG_ARCH_HIGHBANK)                := highbank
 machine-$(CONFIG_ARCH_INTEGRATOR)      := integrator
 machine-$(CONFIG_ARCH_IOP13XX)         := iop13xx
 machine-$(CONFIG_ARCH_IOP32X)          := iop32x
@@ -168,6 +169,7 @@ machine-$(CONFIG_ARCH_OMAP2)                := omap2
 machine-$(CONFIG_ARCH_OMAP3)           := omap2
 machine-$(CONFIG_ARCH_OMAP4)           := omap2
 machine-$(CONFIG_ARCH_ORION5X)         := orion5x
+machine-$(CONFIG_ARCH_PICOXCELL)       := picoxcell
 machine-$(CONFIG_ARCH_PNX4008)         := pnx4008
 machine-$(CONFIG_ARCH_PRIMA2)          := prima2
 machine-$(CONFIG_ARCH_PXA)             := pxa
diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi
new file mode 100644 (file)
index 0000000..aeef042
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * at91sam9g20.dtsi - Device Tree Include file for AT91SAM9G20 family SoC
+ *
+ *  Copyright (C) 2011 Atmel,
+ *                2011 Nicolas Ferre <nicolas.ferre@atmel.com>,
+ *                2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * Licensed under GPLv2 or later.
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+       model = "Atmel AT91SAM9G20 family SoC";
+       compatible = "atmel,at91sam9g20";
+       interrupt-parent = <&aic>;
+
+       aliases {
+               serial0 = &dbgu;
+               serial1 = &usart0;
+               serial2 = &usart1;
+               serial3 = &usart2;
+               serial4 = &usart3;
+               serial5 = &usart4;
+               serial6 = &usart5;
+       };
+       cpus {
+               cpu@0 {
+                       compatible = "arm,arm926ejs";
+               };
+       };
+
+       memory@20000000 {
+               reg = <0x20000000 0x08000000>;
+       };
+
+       ahb {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               apb {
+                       compatible = "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges;
+
+                       aic: interrupt-controller@fffff000 {
+                               #interrupt-cells = <1>;
+                               compatible = "atmel,at91rm9200-aic";
+                               interrupt-controller;
+                               interrupt-parent;
+                               reg = <0xfffff000 0x200>;
+                       };
+
+                       dbgu: serial@fffff200 {
+                               compatible = "atmel,at91sam9260-usart";
+                               reg = <0xfffff200 0x200>;
+                               interrupts = <1>;
+                               status = "disabled";
+                       };
+
+                       usart0: serial@fffb0000 {
+                               compatible = "atmel,at91sam9260-usart";
+                               reg = <0xfffb0000 0x200>;
+                               interrupts = <6>;
+                               atmel,use-dma-rx;
+                               atmel,use-dma-tx;
+                               status = "disabled";
+                       };
+
+                       usart1: serial@fffb4000 {
+                               compatible = "atmel,at91sam9260-usart";
+                               reg = <0xfffb4000 0x200>;
+                               interrupts = <7>;
+                               atmel,use-dma-rx;
+                               atmel,use-dma-tx;
+                               status = "disabled";
+                       };
+
+                       usart2: serial@fffb8000 {
+                               compatible = "atmel,at91sam9260-usart";
+                               reg = <0xfffb8000 0x200>;
+                               interrupts = <8>;
+                               atmel,use-dma-rx;
+                               atmel,use-dma-tx;
+                               status = "disabled";
+                       };
+
+                       usart3: serial@fffd0000 {
+                               compatible = "atmel,at91sam9260-usart";
+                               reg = <0xfffd0000 0x200>;
+                               interrupts = <23>;
+                               atmel,use-dma-rx;
+                               atmel,use-dma-tx;
+                               status = "disabled";
+                       };
+
+                       usart4: serial@fffd4000 {
+                               compatible = "atmel,at91sam9260-usart";
+                               reg = <0xfffd4000 0x200>;
+                               interrupts = <24>;
+                               atmel,use-dma-rx;
+                               atmel,use-dma-tx;
+                               status = "disabled";
+                       };
+
+                       usart5: serial@fffd8000 {
+                               compatible = "atmel,at91sam9260-usart";
+                               reg = <0xfffd8000 0x200>;
+                               interrupts = <25>;
+                               atmel,use-dma-rx;
+                               atmel,use-dma-tx;
+                               status = "disabled";
+                       };
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
new file mode 100644 (file)
index 0000000..db6a452
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * at91sam9g45.dtsi - Device Tree Include file for AT91SAM9G45 family SoC
+ *                    applies to AT91SAM9G45, AT91SAM9M10,
+ *                    AT91SAM9G46, AT91SAM9M11 SoC
+ *
+ *  Copyright (C) 2011 Atmel,
+ *                2011 Nicolas Ferre <nicolas.ferre@atmel.com>
+ *
+ * Licensed under GPLv2 or later.
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+       model = "Atmel AT91SAM9G45 family SoC";
+       compatible = "atmel,at91sam9g45";
+       interrupt-parent = <&aic>;
+
+       aliases {
+               serial0 = &dbgu;
+               serial1 = &usart0;
+               serial2 = &usart1;
+               serial3 = &usart2;
+               serial4 = &usart3;
+       };
+       cpus {
+               cpu@0 {
+                       compatible = "arm,arm926ejs";
+               };
+       };
+
+       memory@70000000 {
+               reg = <0x70000000 0x10000000>;
+       };
+
+       ahb {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               apb {
+                       compatible = "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges;
+
+                       aic: interrupt-controller@fffff000 {
+                               #interrupt-cells = <1>;
+                               compatible = "atmel,at91rm9200-aic";
+                               interrupt-controller;
+                               interrupt-parent;
+                               reg = <0xfffff000 0x200>;
+                       };
+
+                       dma: dma-controller@ffffec00 {
+                               compatible = "atmel,at91sam9g45-dma";
+                               reg = <0xffffec00 0x200>;
+                               interrupts = <21>;
+                       };
+
+                       dbgu: serial@ffffee00 {
+                               compatible = "atmel,at91sam9260-usart";
+                               reg = <0xffffee00 0x200>;
+                               interrupts = <1>;
+                               status = "disabled";
+                       };
+
+                       usart0: serial@fff8c000 {
+                               compatible = "atmel,at91sam9260-usart";
+                               reg = <0xfff8c000 0x200>;
+                               interrupts = <7>;
+                               atmel,use-dma-rx;
+                               atmel,use-dma-tx;
+                               status = "disabled";
+                       };
+
+                       usart1: serial@fff90000 {
+                               compatible = "atmel,at91sam9260-usart";
+                               reg = <0xfff90000 0x200>;
+                               interrupts = <8>;
+                               atmel,use-dma-rx;
+                               atmel,use-dma-tx;
+                               status = "disabled";
+                       };
+
+                       usart2: serial@fff94000 {
+                               compatible = "atmel,at91sam9260-usart";
+                               reg = <0xfff94000 0x200>;
+                               interrupts = <9>;
+                               atmel,use-dma-rx;
+                               atmel,use-dma-tx;
+                               status = "disabled";
+                       };
+
+                       usart3: serial@fff98000 {
+                               compatible = "atmel,at91sam9260-usart";
+                               reg = <0xfff98000 0x200>;
+                               interrupts = <10>;
+                               atmel,use-dma-rx;
+                               atmel,use-dma-tx;
+                               status = "disabled";
+                       };
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
new file mode 100644 (file)
index 0000000..85b34f5
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * at91sam9m10g45ek.dts - Device Tree file for AT91SAM9M10G45-EK board
+ *
+ *  Copyright (C) 2011 Atmel,
+ *                2011 Nicolas Ferre <nicolas.ferre@atmel.com>
+ *
+ * Licensed under GPLv2 or later.
+ */
+/dts-v1/;
+/include/ "at91sam9g45.dtsi"
+
+/ {
+       model = "Atmel AT91SAM9M10G45-EK";
+       compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9";
+
+       chosen {
+               bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2";
+       };
+
+       memory@70000000 {
+               reg = <0x70000000 0x4000000>;
+       };
+
+       ahb {
+               apb {
+                       dbgu: serial@ffffee00 {
+                               status = "okay";
+                       };
+
+                       usart1: serial@fff90000 {
+                               status = "okay";
+                       };
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/highbank.dts b/arch/arm/boot/dts/highbank.dts
new file mode 100644 (file)
index 0000000..aeb1a75
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+ * Copyright 2011 Calxeda, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/dts-v1/;
+
+/* First 4KB has pen for secondary cores. */
+/memreserve/ 0x00000000 0x0001000;
+
+/ {
+       model = "Calxeda Highbank";
+       compatible = "calxeda,highbank";
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu@0 {
+                       compatible = "arm,cortex-a9";
+                       reg = <0>;
+                       next-level-cache = <&L2>;
+               };
+
+               cpu@1 {
+                       compatible = "arm,cortex-a9";
+                       reg = <1>;
+                       next-level-cache = <&L2>;
+               };
+
+               cpu@2 {
+                       compatible = "arm,cortex-a9";
+                       reg = <2>;
+                       next-level-cache = <&L2>;
+               };
+
+               cpu@3 {
+                       compatible = "arm,cortex-a9";
+                       reg = <3>;
+                       next-level-cache = <&L2>;
+               };
+       };
+
+       memory {
+               name = "memory";
+               device_type = "memory";
+               reg = <0x00000000 0xff900000>;
+       };
+
+       chosen {
+               bootargs = "console=ttyAMA0";
+       };
+
+       soc {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "simple-bus";
+               interrupt-parent = <&intc>;
+               ranges;
+
+               timer@fff10600 {
+                       compatible = "arm,smp-twd";
+                       reg = <0xfff10600 0x20>;
+                       interrupts = <1 13 0xf04>;
+               };
+
+               watchdog@fff10620 {
+                       compatible = "arm,cortex-a9-wdt";
+                       reg = <0xfff10620 0x20>;
+                       interrupts = <1 14 0xf04>;
+               };
+
+               intc: interrupt-controller@fff11000 {
+                       compatible = "arm,cortex-a9-gic";
+                       #interrupt-cells = <3>;
+                       #size-cells = <0>;
+                       #address-cells = <1>;
+                       interrupt-controller;
+                       interrupt-parent;
+                       reg = <0xfff11000 0x1000>,
+                             <0xfff10100 0x100>;
+               };
+
+               L2: l2-cache {
+                       compatible = "arm,pl310-cache";
+                       reg = <0xfff12000 0x1000>;
+                       interrupts = <0 70 4>;
+                       cache-unified;
+                       cache-level = <2>;
+               };
+
+               pmu {
+                       compatible = "arm,cortex-a9-pmu";
+                       interrupts = <0 76 4  0 75 4  0 74 4  0 73 4>;
+               };
+
+               sata@ffe08000 {
+                       compatible = "calxeda,hb-ahci";
+                       reg = <0xffe08000 0x10000>;
+                       interrupts = <0 83 4>;
+               };
+
+               sdhci@ffe0e000 {
+                       compatible = "calxeda,hb-sdhci";
+                       reg = <0xffe0e000 0x1000>;
+                       interrupts = <0 90 4>;
+               };
+
+               ipc@fff20000 {
+                       compatible = "arm,pl320", "arm,primecell";
+                       reg = <0xfff20000 0x1000>;
+                       interrupts = <0 7 4>;
+               };
+
+               gpioe: gpio@fff30000 {
+                       #gpio-cells = <2>;
+                       compatible = "arm,pl061", "arm,primecell";
+                       gpio-controller;
+                       reg = <0xfff30000 0x1000>;
+                       interrupts = <0 14 4>;
+               };
+
+               gpiof: gpio@fff31000 {
+                       #gpio-cells = <2>;
+                       compatible = "arm,pl061", "arm,primecell";
+                       gpio-controller;
+                       reg = <0xfff31000 0x1000>;
+                       interrupts = <0 15 4>;
+               };
+
+               gpiog: gpio@fff32000 {
+                       #gpio-cells = <2>;
+                       compatible = "arm,pl061", "arm,primecell";
+                       gpio-controller;
+                       reg = <0xfff32000 0x1000>;
+                       interrupts = <0 16 4>;
+               };
+
+               gpioh: gpio@fff33000 {
+                       #gpio-cells = <2>;
+                       compatible = "arm,pl061", "arm,primecell";
+                       gpio-controller;
+                       reg = <0xfff33000 0x1000>;
+                       interrupts = <0 17 4>;
+               };
+
+               timer {
+                       compatible = "arm,sp804", "arm,primecell";
+                       reg = <0xfff34000 0x1000>;
+                       interrupts = <0 18 4>;
+               };
+
+               rtc@fff35000 {
+                       compatible = "arm,pl031", "arm,primecell";
+                       reg = <0xfff35000 0x1000>;
+                       interrupts = <0 19 4>;
+               };
+
+               serial@fff36000 {
+                       compatible = "arm,pl011", "arm,primecell";
+                       reg = <0xfff36000 0x1000>;
+                       interrupts = <0 20 4>;
+               };
+
+               smic@fff3a000 {
+                       compatible = "ipmi-smic";
+                       device_type = "ipmi";
+                       reg = <0xfff3a000 0x1000>;
+                       interrupts = <0 24 4>;
+                       reg-size = <4>;
+                       reg-spacing = <4>;
+               };
+
+               sregs@fff3c000 {
+                       compatible = "calxeda,hb-sregs";
+                       reg = <0xfff3c000 0x1000>;
+               };
+
+               dma@fff3d000 {
+                       compatible = "arm,pl330", "arm,primecell";
+                       reg = <0xfff3d000 0x1000>;
+                       interrupts = <0 92 4>;
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts
new file mode 100644 (file)
index 0000000..f8766af
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/dts-v1/;
+/include/ "imx51.dtsi"
+
+/ {
+       model = "Freescale i.MX51 Babbage Board";
+       compatible = "fsl,imx51-babbage", "fsl,imx51";
+
+       chosen {
+               bootargs = "console=ttymxc0,115200 root=/dev/mmcblk0p3 rootwait";
+       };
+
+       memory {
+               reg = <0x90000000 0x20000000>;
+       };
+
+       soc {
+               aips@70000000 { /* aips-1 */
+                       spba@70000000 {
+                               esdhc@70004000 { /* ESDHC1 */
+                                       fsl,cd-internal;
+                                       fsl,wp-internal;
+                                       status = "okay";
+                               };
+
+                               esdhc@70008000 { /* ESDHC2 */
+                                       cd-gpios = <&gpio0 6 0>; /* GPIO1_6 */
+                                       wp-gpios = <&gpio0 5 0>; /* GPIO1_5 */
+                                       status = "okay";
+                               };
+
+                               uart2: uart@7000c000 { /* UART3 */
+                                       fsl,uart-has-rtscts;
+                                       status = "okay";
+                               };
+
+                               ecspi@70010000 { /* ECSPI1 */
+                                       fsl,spi-num-chipselects = <2>;
+                                       cs-gpios = <&gpio3 24 0>, /* GPIO4_24 */
+                                                  <&gpio3 25 0>; /* GPIO4_25 */
+                                       status = "okay";
+
+                                       pmic: mc13892@0 {
+                                               #address-cells = <1>;
+                                               #size-cells = <0>;
+                                               compatible = "fsl,mc13892";
+                                               spi-max-frequency = <6000000>;
+                                               reg = <0>;
+                                               mc13xxx-irq-gpios = <&gpio0 8 0>; /* GPIO1_8 */
+                                               fsl,mc13xxx-uses-regulator;
+                                       };
+
+                                       flash: at45db321d@1 {
+                                               #address-cells = <1>;
+                                               #size-cells = <1>;
+                                               compatible = "atmel,at45db321d", "atmel,at45", "atmel,dataflash";
+                                               spi-max-frequency = <25000000>;
+                                               reg = <1>;
+
+                                               partition@0 {
+                                                       label = "U-Boot";
+                                                       reg = <0x0 0x40000>;
+                                                       read-only;
+                                               };
+
+                                               partition@40000 {
+                                                       label = "Kernel";
+                                                       reg = <0x40000 0x3c0000>;
+                                               };
+                                       };
+                               };
+                       };
+
+                       wdog@73f98000 { /* WDOG1 */
+                               status = "okay";
+                       };
+
+                       iomuxc@73fa8000 {
+                               compatible = "fsl,imx51-iomuxc-babbage";
+                               reg = <0x73fa8000 0x4000>;
+                       };
+
+                       uart0: uart@73fbc000 {
+                               fsl,uart-has-rtscts;
+                               status = "okay";
+                       };
+
+                       uart1: uart@73fc0000 {
+                               status = "okay";
+                       };
+               };
+
+               aips@80000000 { /* aips-2 */
+                       sdma@83fb0000 {
+                               fsl,sdma-ram-script-name = "imx/sdma/sdma-imx51.bin";
+                       };
+
+                       i2c@83fc4000 { /* I2C2 */
+                               status = "okay";
+
+                               codec: sgtl5000@0a {
+                                       compatible = "fsl,sgtl5000";
+                                       reg = <0x0a>;
+                               };
+                       };
+
+                       fec@83fec000 {
+                               phy-mode = "mii";
+                               status = "okay";
+                       };
+               };
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               power {
+                       label = "Power Button";
+                       gpios = <&gpio1 21 0>;
+                       linux,code = <116>; /* KEY_POWER */
+                       gpio-key,wakeup;
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
new file mode 100644 (file)
index 0000000..327ab8e
--- /dev/null
@@ -0,0 +1,246 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+       aliases {
+               serial0 = &uart0;
+               serial1 = &uart1;
+               serial2 = &uart2;
+       };
+
+       tzic: tz-interrupt-controller@e0000000 {
+               compatible = "fsl,imx51-tzic", "fsl,tzic";
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               reg = <0xe0000000 0x4000>;
+       };
+
+       clocks {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ckil {
+                       compatible = "fsl,imx-ckil", "fixed-clock";
+                       clock-frequency = <32768>;
+               };
+
+               ckih1 {
+                       compatible = "fsl,imx-ckih1", "fixed-clock";
+                       clock-frequency = <22579200>;
+               };
+
+               ckih2 {
+                       compatible = "fsl,imx-ckih2", "fixed-clock";
+                       clock-frequency = <0>;
+               };
+
+               osc {
+                       compatible = "fsl,imx-osc", "fixed-clock";
+                       clock-frequency = <24000000>;
+               };
+       };
+
+       soc {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "simple-bus";
+               interrupt-parent = <&tzic>;
+               ranges;
+
+               aips@70000000 { /* AIPS1 */
+                       compatible = "fsl,aips-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x70000000 0x10000000>;
+                       ranges;
+
+                       spba@70000000 {
+                               compatible = "fsl,spba-bus", "simple-bus";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               reg = <0x70000000 0x40000>;
+                               ranges;
+
+                               esdhc@70004000 { /* ESDHC1 */
+                                       compatible = "fsl,imx51-esdhc";
+                                       reg = <0x70004000 0x4000>;
+                                       interrupts = <1>;
+                                       status = "disabled";
+                               };
+
+                               esdhc@70008000 { /* ESDHC2 */
+                                       compatible = "fsl,imx51-esdhc";
+                                       reg = <0x70008000 0x4000>;
+                                       interrupts = <2>;
+                                       status = "disabled";
+                               };
+
+                               uart2: uart@7000c000 { /* UART3 */
+                                       compatible = "fsl,imx51-uart", "fsl,imx21-uart";
+                                       reg = <0x7000c000 0x4000>;
+                                       interrupts = <33>;
+                                       status = "disabled";
+                               };
+
+                               ecspi@70010000 { /* ECSPI1 */
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       compatible = "fsl,imx51-ecspi";
+                                       reg = <0x70010000 0x4000>;
+                                       interrupts = <36>;
+                                       status = "disabled";
+                               };
+
+                               esdhc@70020000 { /* ESDHC3 */
+                                       compatible = "fsl,imx51-esdhc";
+                                       reg = <0x70020000 0x4000>;
+                                       interrupts = <3>;
+                                       status = "disabled";
+                               };
+
+                               esdhc@70024000 { /* ESDHC4 */
+                                       compatible = "fsl,imx51-esdhc";
+                                       reg = <0x70024000 0x4000>;
+                                       interrupts = <4>;
+                                       status = "disabled";
+                               };
+                       };
+
+                       gpio0: gpio@73f84000 { /* GPIO1 */
+                               compatible = "fsl,imx51-gpio", "fsl,imx31-gpio";
+                               reg = <0x73f84000 0x4000>;
+                               interrupts = <50 51>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                       };
+
+                       gpio1: gpio@73f88000 { /* GPIO2 */
+                               compatible = "fsl,imx51-gpio", "fsl,imx31-gpio";
+                               reg = <0x73f88000 0x4000>;
+                               interrupts = <52 53>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                       };
+
+                       gpio2: gpio@73f8c000 { /* GPIO3 */
+                               compatible = "fsl,imx51-gpio", "fsl,imx31-gpio";
+                               reg = <0x73f8c000 0x4000>;
+                               interrupts = <54 55>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                       };
+
+                       gpio3: gpio@73f90000 { /* GPIO4 */
+                               compatible = "fsl,imx51-gpio", "fsl,imx31-gpio";
+                               reg = <0x73f90000 0x4000>;
+                               interrupts = <56 57>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                       };
+
+                       wdog@73f98000 { /* WDOG1 */
+                               compatible = "fsl,imx51-wdt", "fsl,imx21-wdt";
+                               reg = <0x73f98000 0x4000>;
+                               interrupts = <58>;
+                               status = "disabled";
+                       };
+
+                       wdog@73f9c000 { /* WDOG2 */
+                               compatible = "fsl,imx51-wdt", "fsl,imx21-wdt";
+                               reg = <0x73f9c000 0x4000>;
+                               interrupts = <59>;
+                               status = "disabled";
+                       };
+
+                       uart0: uart@73fbc000 {
+                               compatible = "fsl,imx51-uart", "fsl,imx21-uart";
+                               reg = <0x73fbc000 0x4000>;
+                               interrupts = <31>;
+                               status = "disabled";
+                       };
+
+                       uart1: uart@73fc0000 {
+                               compatible = "fsl,imx51-uart", "fsl,imx21-uart";
+                               reg = <0x73fc0000 0x4000>;
+                               interrupts = <32>;
+                               status = "disabled";
+                       };
+               };
+
+               aips@80000000 { /* AIPS2 */
+                       compatible = "fsl,aips-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x80000000 0x10000000>;
+                       ranges;
+
+                       ecspi@83fac000 { /* ECSPI2 */
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx51-ecspi";
+                               reg = <0x83fac000 0x4000>;
+                               interrupts = <37>;
+                               status = "disabled";
+                       };
+
+                       sdma@83fb0000 {
+                               compatible = "fsl,imx51-sdma", "fsl,imx35-sdma";
+                               reg = <0x83fb0000 0x4000>;
+                               interrupts = <6>;
+                       };
+
+                       cspi@83fc0000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx51-cspi", "fsl,imx35-cspi";
+                               reg = <0x83fc0000 0x4000>;
+                               interrupts = <38>;
+                               status = "disabled";
+                       };
+
+                       i2c@83fc4000 { /* I2C2 */
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx51-i2c", "fsl,imx1-i2c";
+                               reg = <0x83fc4000 0x4000>;
+                               interrupts = <63>;
+                               status = "disabled";
+                       };
+
+                       i2c@83fc8000 { /* I2C1 */
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx51-i2c", "fsl,imx1-i2c";
+                               reg = <0x83fc8000 0x4000>;
+                               interrupts = <62>;
+                               status = "disabled";
+                       };
+
+                       fec@83fec000 {
+                               compatible = "fsl,imx51-fec", "fsl,imx27-fec";
+                               reg = <0x83fec000 0x4000>;
+                               interrupts = <87>;
+                               status = "disabled";
+                       };
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/imx53-ard.dts b/arch/arm/boot/dts/imx53-ard.dts
new file mode 100644 (file)
index 0000000..2ab7f80
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/dts-v1/;
+/include/ "imx53.dtsi"
+
+/ {
+       model = "Freescale i.MX53 Automotive Reference Design Board";
+       compatible = "fsl,imx53-ard", "fsl,imx53";
+
+       chosen {
+               bootargs = "console=ttymxc0,115200 root=/dev/mmcblk0p3 rootwait";
+       };
+
+       memory {
+               reg = <0x70000000 0x40000000>;
+       };
+
+       soc {
+               aips@50000000 { /* AIPS1 */
+                       spba@50000000 {
+                               esdhc@50004000 { /* ESDHC1 */
+                                       cd-gpios = <&gpio0 1 0>; /* GPIO1_1 */
+                                       wp-gpios = <&gpio0 9 0>; /* GPIO1_9 */
+                                       status = "okay";
+                               };
+                       };
+
+                       wdog@53f98000 { /* WDOG1 */
+                               status = "okay";
+                       };
+
+                       iomuxc@53fa8000 {
+                               compatible = "fsl,imx53-iomuxc-ard";
+                               reg = <0x53fa8000 0x4000>;
+                       };
+
+                       uart0: uart@53fbc000 { /* UART1 */
+                               status = "okay";
+                       };
+               };
+
+               aips@60000000 { /* AIPS2 */
+                       sdma@63fb0000 {
+                               fsl,sdma-ram-script-name = "imx/sdma/sdma-imx53.bin";
+                       };
+               };
+       };
+
+       eim-cs1@f4000000 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "fsl,eim-bus", "simple-bus";
+               reg = <0xf4000000 0x3ff0000>;
+               ranges;
+
+               lan9220@f4000000 {
+                       compatible = "smsc,lan9220", "smsc,lan9115";
+                       reg = <0xf4000000 0x2000000>;
+                       phy-mode = "mii";
+                       interrupt-parent = <&gpio1>;
+                       interrupts = <31>;
+                       reg-io-width = <4>;
+                       smsc,irq-push-pull;
+               };
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               home {
+                       label = "Home";
+                       gpios = <&gpio4 10 0>; /* GPIO5_10 */
+                       linux,code = <102>; /* KEY_HOME */
+                       gpio-key,wakeup;
+               };
+
+               back {
+                       label = "Back";
+                       gpios = <&gpio4 11 0>; /* GPIO5_11 */
+                       linux,code = <158>; /* KEY_BACK */
+                       gpio-key,wakeup;
+               };
+
+               program {
+                       label = "Program";
+                       gpios = <&gpio4 12 0>; /* GPIO5_12 */
+                       linux,code = <362>; /* KEY_PROGRAM */
+                       gpio-key,wakeup;
+               };
+
+               volume-up {
+                       label = "Volume Up";
+                       gpios = <&gpio4 13 0>; /* GPIO5_13 */
+                       linux,code = <115>; /* KEY_VOLUMEUP */
+               };
+
+               volume-down {
+                       label = "Volume Down";
+                       gpios = <&gpio3 0 0>; /* GPIO4_0 */
+                       linux,code = <114>; /* KEY_VOLUMEDOWN */
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/imx53-evk.dts b/arch/arm/boot/dts/imx53-evk.dts
new file mode 100644 (file)
index 0000000..3f3a881
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/dts-v1/;
+/include/ "imx53.dtsi"
+
+/ {
+       model = "Freescale i.MX53 Evaluation Kit";
+       compatible = "fsl,imx53-evk", "fsl,imx53";
+
+       chosen {
+               bootargs = "console=ttymxc0,115200 root=/dev/mmcblk0p3 rootwait";
+       };
+
+       memory {
+               reg = <0x70000000 0x80000000>;
+       };
+
+       soc {
+               aips@50000000 { /* AIPS1 */
+                       spba@50000000 {
+                               esdhc@50004000 { /* ESDHC1 */
+                                       cd-gpios = <&gpio2 13 0>; /* GPIO3_13 */
+                                       wp-gpios = <&gpio2 14 0>; /* GPIO3_14 */
+                                       status = "okay";
+                               };
+
+                               ecspi@50010000 { /* ECSPI1 */
+                                       fsl,spi-num-chipselects = <2>;
+                                       cs-gpios = <&gpio1 30 0>, /* GPIO2_30 */
+                                                  <&gpio2 19 0>; /* GPIO3_19 */
+                                       status = "okay";
+
+                                       flash: at45db321d@1 {
+                                               #address-cells = <1>;
+                                               #size-cells = <1>;
+                                               compatible = "atmel,at45db321d", "atmel,at45", "atmel,dataflash";
+                                               spi-max-frequency = <25000000>;
+                                               reg = <1>;
+
+                                               partition@0 {
+                                                       label = "U-Boot";
+                                                       reg = <0x0 0x40000>;
+                                                       read-only;
+                                               };
+
+                                               partition@40000 {
+                                                       label = "Kernel";
+                                                       reg = <0x40000 0x3c0000>;
+                                               };
+                                       };
+                               };
+
+                               esdhc@50020000 { /* ESDHC3 */
+                                       cd-gpios = <&gpio2 11 0>; /* GPIO3_11 */
+                                       wp-gpios = <&gpio2 12 0>; /* GPIO3_12 */
+                                       status = "okay";
+                               };
+                       };
+
+                       wdog@53f98000 { /* WDOG1 */
+                               status = "okay";
+                       };
+
+                       iomuxc@53fa8000 {
+                               compatible = "fsl,imx53-iomuxc-evk";
+                               reg = <0x53fa8000 0x4000>;
+                       };
+
+                       uart0: uart@53fbc000 { /* UART1 */
+                               status = "okay";
+                       };
+               };
+
+               aips@60000000 { /* AIPS2 */
+                       sdma@63fb0000 {
+                               fsl,sdma-ram-script-name = "imx/sdma/sdma-imx53.bin";
+                       };
+
+                       i2c@63fc4000 { /* I2C2 */
+                               status = "okay";
+
+                               pmic: mc13892@08 {
+                                       compatible = "fsl,mc13892", "fsl,mc13xxx";
+                                       reg = <0x08>;
+                               };
+
+                               codec: sgtl5000@0a {
+                                       compatible = "fsl,sgtl5000";
+                                       reg = <0x0a>;
+                               };
+                       };
+
+                       fec@63fec000 {
+                               phy-mode = "rmii";
+                               phy-reset-gpios = <&gpio6 6 0>; /* GPIO7_6 */
+                               status = "okay";
+                       };
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               green {
+                       label = "Heartbeat";
+                       gpios = <&gpio6 7 0>; /* GPIO7_7 */
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/imx53-qsb.dts b/arch/arm/boot/dts/imx53-qsb.dts
new file mode 100644 (file)
index 0000000..ae6de6d
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/dts-v1/;
+/include/ "imx53.dtsi"
+
+/ {
+       model = "Freescale i.MX53 Quick Start Board";
+       compatible = "fsl,imx53-qsb", "fsl,imx53";
+
+       chosen {
+               bootargs = "console=ttymxc0,115200 root=/dev/mmcblk0p3 rootwait";
+       };
+
+       memory {
+               reg = <0x70000000 0x40000000>;
+       };
+
+       soc {
+               aips@50000000 { /* AIPS1 */
+                       spba@50000000 {
+                               esdhc@50004000 { /* ESDHC1 */
+                                       cd-gpios = <&gpio2 13 0>; /* GPIO3_13 */
+                                       status = "okay";
+                               };
+
+                               esdhc@50020000 { /* ESDHC3 */
+                                       cd-gpios = <&gpio2 11 0>; /* GPIO3_11 */
+                                       wp-gpios = <&gpio2 12 0>; /* GPIO3_12 */
+                                       status = "okay";
+                               };
+                       };
+
+                       wdog@53f98000 { /* WDOG1 */
+                               status = "okay";
+                       };
+
+                       iomuxc@53fa8000 {
+                               compatible = "fsl,imx53-iomuxc-qsb";
+                               reg = <0x53fa8000 0x4000>;
+                       };
+
+                       uart0: uart@53fbc000 { /* UART1 */
+                               status = "okay";
+                       };
+               };
+
+               aips@60000000 { /* AIPS2 */
+                       sdma@63fb0000 {
+                               fsl,sdma-ram-script-name = "imx/sdma/sdma-imx53.bin";
+                       };
+
+                       i2c@63fc4000 { /* I2C2 */
+                               status = "okay";
+
+                               codec: sgtl5000@0a {
+                                       compatible = "fsl,sgtl5000";
+                                       reg = <0x0a>;
+                               };
+                       };
+
+                       i2c@63fc8000 { /* I2C1 */
+                               status = "okay";
+
+                               accelerometer: mma8450@1c {
+                                       compatible = "fsl,mma8450";
+                                       reg = <0x1c>;
+                               };
+
+                               pmic: dialog@48 {
+                                       compatible = "dialog,da9053", "dialog,da9052";
+                                       reg = <0x48>;
+                               };
+                       };
+
+                       fec@63fec000 {
+                               phy-mode = "rmii";
+                               phy-reset-gpios = <&gpio6 6 0>; /* GPIO7_6 */
+                               status = "okay";
+                       };
+               };
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               power {
+                       label = "Power Button";
+                       gpios = <&gpio0 8 0>; /* GPIO1_8 */
+                       linux,code = <116>; /* KEY_POWER */
+                       gpio-key,wakeup;
+               };
+
+               volume-up {
+                       label = "Volume Up";
+                       gpios = <&gpio1 14 0>; /* GPIO2_14 */
+                       linux,code = <115>; /* KEY_VOLUMEUP */
+               };
+
+               volume-down {
+                       label = "Volume Down";
+                       gpios = <&gpio1 15 0>; /* GPIO2_15 */
+                       linux,code = <114>; /* KEY_VOLUMEDOWN */
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               user {
+                       label = "Heartbeat";
+                       gpios = <&gpio6 7 0>; /* GPIO7_7 */
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/imx53-smd.dts b/arch/arm/boot/dts/imx53-smd.dts
new file mode 100644 (file)
index 0000000..b1c062e
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/dts-v1/;
+/include/ "imx53.dtsi"
+
+/ {
+       model = "Freescale i.MX53 Smart Mobile Reference Design Board";
+       compatible = "fsl,imx53-smd", "fsl,imx53";
+
+       chosen {
+               bootargs = "console=ttymxc0,115200 root=/dev/mmcblk0p3 rootwait";
+       };
+
+       memory {
+               reg = <0x70000000 0x40000000>;
+       };
+
+       soc {
+               aips@50000000 { /* AIPS1 */
+                       spba@50000000 {
+                               esdhc@50004000 { /* ESDHC1 */
+                                       cd-gpios = <&gpio2 13 0>; /* GPIO3_13 */
+                                       wp-gpios = <&gpio3 11 0>; /* GPIO4_11 */
+                                       status = "okay";
+                               };
+
+                               esdhc@50008000 { /* ESDHC2 */
+                                       fsl,card-wired;
+                                       status = "okay";
+                               };
+
+                               uart2: uart@5000c000 { /* UART3 */
+                                       fsl,uart-has-rtscts;
+                                       status = "okay";
+                               };
+
+                               ecspi@50010000 { /* ECSPI1 */
+                                       fsl,spi-num-chipselects = <2>;
+                                       cs-gpios = <&gpio1 30 0>, /* GPIO2_30 */
+                                                  <&gpio2 19 0>; /* GPIO3_19 */
+                                       status = "okay";
+
+                                       zigbee: mc1323@0 {
+                                               compatible = "fsl,mc1323";
+                                               spi-max-frequency = <8000000>;
+                                               reg = <0>;
+                                       };
+
+                                       flash: m25p32@1 {
+                                               #address-cells = <1>;
+                                               #size-cells = <1>;
+                                               compatible = "st,m25p32", "st,m25p";
+                                               spi-max-frequency = <20000000>;
+                                               reg = <1>;
+
+                                               partition@0 {
+                                                       label = "U-Boot";
+                                                       reg = <0x0 0x40000>;
+                                                       read-only;
+                                               };
+
+                                               partition@40000 {
+                                                       label = "Kernel";
+                                                       reg = <0x40000 0x3c0000>;
+                                               };
+                                       };
+                               };
+
+                               esdhc@50020000 { /* ESDHC3 */
+                                       fsl,card-wired;
+                                       status = "okay";
+                               };
+                       };
+
+                       wdog@53f98000 { /* WDOG1 */
+                               status = "okay";
+                       };
+
+                       iomuxc@53fa8000 {
+                               compatible = "fsl,imx53-iomuxc-smd";
+                               reg = <0x53fa8000 0x4000>;
+                       };
+
+                       uart0: uart@53fbc000 { /* UART1 */
+                               status = "okay";
+                       };
+
+                       uart1: uart@53fc0000 { /* UART2 */
+                               status = "okay";
+                       };
+               };
+
+               aips@60000000 { /* AIPS2 */
+                       sdma@63fb0000 {
+                               fsl,sdma-ram-script-name = "imx/sdma/sdma-imx53.bin";
+                       };
+
+                       i2c@63fc4000 { /* I2C2 */
+                               status = "okay";
+
+                               codec: sgtl5000@0a {
+                                       compatible = "fsl,sgtl5000";
+                                       reg = <0x0a>;
+                               };
+
+                               magnetometer: mag3110@0e {
+                                       compatible = "fsl,mag3110";
+                                       reg = <0x0e>;
+                               };
+
+                               touchkey: mpr121@5a {
+                                       compatible = "fsl,mpr121";
+                                       reg = <0x5a>;
+                               };
+                       };
+
+                       i2c@63fc8000 { /* I2C1 */
+                               status = "okay";
+
+                               accelerometer: mma8450@1c {
+                                       compatible = "fsl,mma8450";
+                                       reg = <0x1c>;
+                               };
+
+                               camera: ov5642@3c {
+                                       compatible = "ovti,ov5642";
+                                       reg = <0x3c>;
+                               };
+
+                               pmic: dialog@48 {
+                                       compatible = "dialog,da9053", "dialog,da9052";
+                                       reg = <0x48>;
+                               };
+                       };
+
+                       fec@63fec000 {
+                               phy-mode = "rmii";
+                               phy-reset-gpios = <&gpio6 6 0>; /* GPIO7_6 */
+                               status = "okay";
+                       };
+               };
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               volume-up {
+                       label = "Volume Up";
+                       gpios = <&gpio1 14 0>; /* GPIO2_14 */
+                       linux,code = <115>; /* KEY_VOLUMEUP */
+               };
+
+               volume-down {
+                       label = "Volume Down";
+                       gpios = <&gpio1 15 0>; /* GPIO2_15 */
+                       linux,code = <114>; /* KEY_VOLUMEDOWN */
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
new file mode 100644 (file)
index 0000000..099cd84
--- /dev/null
@@ -0,0 +1,301 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+       aliases {
+               serial0 = &uart0;
+               serial1 = &uart1;
+               serial2 = &uart2;
+               serial3 = &uart3;
+               serial4 = &uart4;
+       };
+
+       tzic: tz-interrupt-controller@0fffc000 {
+               compatible = "fsl,imx53-tzic", "fsl,tzic";
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               reg = <0x0fffc000 0x4000>;
+       };
+
+       clocks {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ckil {
+                       compatible = "fsl,imx-ckil", "fixed-clock";
+                       clock-frequency = <32768>;
+               };
+
+               ckih1 {
+                       compatible = "fsl,imx-ckih1", "fixed-clock";
+                       clock-frequency = <22579200>;
+               };
+
+               ckih2 {
+                       compatible = "fsl,imx-ckih2", "fixed-clock";
+                       clock-frequency = <0>;
+               };
+
+               osc {
+                       compatible = "fsl,imx-osc", "fixed-clock";
+                       clock-frequency = <24000000>;
+               };
+       };
+
+       soc {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "simple-bus";
+               interrupt-parent = <&tzic>;
+               ranges;
+
+               aips@50000000 { /* AIPS1 */
+                       compatible = "fsl,aips-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x50000000 0x10000000>;
+                       ranges;
+
+                       spba@50000000 {
+                               compatible = "fsl,spba-bus", "simple-bus";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               reg = <0x50000000 0x40000>;
+                               ranges;
+
+                               esdhc@50004000 { /* ESDHC1 */
+                                       compatible = "fsl,imx53-esdhc";
+                                       reg = <0x50004000 0x4000>;
+                                       interrupts = <1>;
+                                       status = "disabled";
+                               };
+
+                               esdhc@50008000 { /* ESDHC2 */
+                                       compatible = "fsl,imx53-esdhc";
+                                       reg = <0x50008000 0x4000>;
+                                       interrupts = <2>;
+                                       status = "disabled";
+                               };
+
+                               uart2: uart@5000c000 { /* UART3 */
+                                       compatible = "fsl,imx53-uart", "fsl,imx21-uart";
+                                       reg = <0x5000c000 0x4000>;
+                                       interrupts = <33>;
+                                       status = "disabled";
+                               };
+
+                               ecspi@50010000 { /* ECSPI1 */
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       compatible = "fsl,imx53-ecspi", "fsl,imx51-ecspi";
+                                       reg = <0x50010000 0x4000>;
+                                       interrupts = <36>;
+                                       status = "disabled";
+                               };
+
+                               esdhc@50020000 { /* ESDHC3 */
+                                       compatible = "fsl,imx53-esdhc";
+                                       reg = <0x50020000 0x4000>;
+                                       interrupts = <3>;
+                                       status = "disabled";
+                               };
+
+                               esdhc@50024000 { /* ESDHC4 */
+                                       compatible = "fsl,imx53-esdhc";
+                                       reg = <0x50024000 0x4000>;
+                                       interrupts = <4>;
+                                       status = "disabled";
+                               };
+                       };
+
+                       gpio0: gpio@53f84000 { /* GPIO1 */
+                               compatible = "fsl,imx53-gpio", "fsl,imx31-gpio";
+                               reg = <0x53f84000 0x4000>;
+                               interrupts = <50 51>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                       };
+
+                       gpio1: gpio@53f88000 { /* GPIO2 */
+                               compatible = "fsl,imx53-gpio", "fsl,imx31-gpio";
+                               reg = <0x53f88000 0x4000>;
+                               interrupts = <52 53>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                       };
+
+                       gpio2: gpio@53f8c000 { /* GPIO3 */
+                               compatible = "fsl,imx53-gpio", "fsl,imx31-gpio";
+                               reg = <0x53f8c000 0x4000>;
+                               interrupts = <54 55>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                       };
+
+                       gpio3: gpio@53f90000 { /* GPIO4 */
+                               compatible = "fsl,imx53-gpio", "fsl,imx31-gpio";
+                               reg = <0x53f90000 0x4000>;
+                               interrupts = <56 57>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                       };
+
+                       wdog@53f98000 { /* WDOG1 */
+                               compatible = "fsl,imx53-wdt", "fsl,imx21-wdt";
+                               reg = <0x53f98000 0x4000>;
+                               interrupts = <58>;
+                               status = "disabled";
+                       };
+
+                       wdog@53f9c000 { /* WDOG2 */
+                               compatible = "fsl,imx53-wdt", "fsl,imx21-wdt";
+                               reg = <0x53f9c000 0x4000>;
+                               interrupts = <59>;
+                               status = "disabled";
+                       };
+
+                       uart0: uart@53fbc000 { /* UART1 */
+                               compatible = "fsl,imx53-uart", "fsl,imx21-uart";
+                               reg = <0x53fbc000 0x4000>;
+                               interrupts = <31>;
+                               status = "disabled";
+                       };
+
+                       uart1: uart@53fc0000 { /* UART2 */
+                               compatible = "fsl,imx53-uart", "fsl,imx21-uart";
+                               reg = <0x53fc0000 0x4000>;
+                               interrupts = <32>;
+                               status = "disabled";
+                       };
+
+                       gpio4: gpio@53fdc000 { /* GPIO5 */
+                               compatible = "fsl,imx53-gpio", "fsl,imx31-gpio";
+                               reg = <0x53fdc000 0x4000>;
+                               interrupts = <103 104>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                       };
+
+                       gpio5: gpio@53fe0000 { /* GPIO6 */
+                               compatible = "fsl,imx53-gpio", "fsl,imx31-gpio";
+                               reg = <0x53fe0000 0x4000>;
+                               interrupts = <105 106>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                       };
+
+                       gpio6: gpio@53fe4000 { /* GPIO7 */
+                               compatible = "fsl,imx53-gpio", "fsl,imx31-gpio";
+                               reg = <0x53fe4000 0x4000>;
+                               interrupts = <107 108>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                       };
+
+                       i2c@53fec000 { /* I2C3 */
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx53-i2c", "fsl,imx1-i2c";
+                               reg = <0x53fec000 0x4000>;
+                               interrupts = <64>;
+                               status = "disabled";
+                       };
+
+                       uart3: uart@53ff0000 { /* UART4 */
+                               compatible = "fsl,imx53-uart", "fsl,imx21-uart";
+                               reg = <0x53ff0000 0x4000>;
+                               interrupts = <13>;
+                               status = "disabled";
+                       };
+               };
+
+               aips@60000000 { /* AIPS2 */
+                       compatible = "fsl,aips-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x60000000 0x10000000>;
+                       ranges;
+
+                       uart4: uart@63f90000 { /* UART5 */
+                               compatible = "fsl,imx53-uart", "fsl,imx21-uart";
+                               reg = <0x63f90000 0x4000>;
+                               interrupts = <86>;
+                               status = "disabled";
+                       };
+
+                       ecspi@63fac000 { /* ECSPI2 */
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx53-ecspi", "fsl,imx51-ecspi";
+                               reg = <0x63fac000 0x4000>;
+                               interrupts = <37>;
+                               status = "disabled";
+                       };
+
+                       sdma@63fb0000 {
+                               compatible = "fsl,imx53-sdma", "fsl,imx35-sdma";
+                               reg = <0x63fb0000 0x4000>;
+                               interrupts = <6>;
+                       };
+
+                       cspi@63fc0000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx53-cspi", "fsl,imx35-cspi";
+                               reg = <0x63fc0000 0x4000>;
+                               interrupts = <38>;
+                               status = "disabled";
+                       };
+
+                       i2c@63fc4000 { /* I2C2 */
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx53-i2c", "fsl,imx1-i2c";
+                               reg = <0x63fc4000 0x4000>;
+                               interrupts = <63>;
+                               status = "disabled";
+                       };
+
+                       i2c@63fc8000 { /* I2C1 */
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx53-i2c", "fsl,imx1-i2c";
+                               reg = <0x63fc8000 0x4000>;
+                               interrupts = <62>;
+                               status = "disabled";
+                       };
+
+                       fec@63fec000 {
+                               compatible = "fsl,imx53-fec", "fsl,imx25-fec";
+                               reg = <0x63fec000 0x4000>;
+                               interrupts = <87>;
+                               status = "disabled";
+                       };
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/msm8660-surf.dts b/arch/arm/boot/dts/msm8660-surf.dts
new file mode 100644 (file)
index 0000000..15ded0d
--- /dev/null
@@ -0,0 +1,24 @@
+/dts-v1/;
+
+/include/ "skeleton.dtsi"
+
+/ {
+       model = "Qualcomm MSM8660 SURF";
+       compatible = "qcom,msm8660-surf", "qcom,msm8660";
+       interrupt-parent = <&intc>;
+
+       intc: interrupt-controller@02080000 {
+               compatible = "qcom,msm-8660-qgic";
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               reg = < 0x02080000 0x1000 >,
+                     < 0x02081000 0x1000 >;
+       };
+
+       serial@19c400000 {
+               compatible = "qcom,msm-hsuart", "qcom,msm-uart";
+               reg = <0x19c40000 0x1000>,
+                     <0x19c00000 0x1000>;
+               interrupts = <195>;
+       };
+};
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..9486be6
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2011 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";
+
+       /*
+        * Since the initial device tree board file does not create any
+        * devices (MMC, network...), the only way to boot is to provide a
+        * ramdisk.
+        */
+       chosen {
+               bootargs = "root=/dev/ram0 rw console=ttyO2,115200n8 initrd=0x81600000,20M ramdisk_size=20480 no_console_suspend debug earlyprintk";
+       };
+
+       memory {
+               device_type = "memory";
+               reg = <0x80000000 0x20000000>; /* 512 MB */
+       };
+};
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
new file mode 100644 (file)
index 0000000..d202bb5
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Device Tree Source for OMAP3 SoC
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+       compatible = "ti,omap3430", "ti,omap3";
+
+       cpus {
+               cpu@0 {
+                       compatible = "arm,cortex-a8";
+               };
+       };
+
+       /*
+        * The soc node represents the soc top level view. It is uses for IPs
+        * that are not memory mapped in the MPU view or for the MPU itself.
+        */
+       soc {
+               compatible = "ti,omap-infra";
+               mpu {
+                       compatible = "ti,omap3-mpu";
+                       ti,hwmods = "mpu";
+               };
+
+               iva {
+                       compatible = "ti,iva2.2";
+                       ti,hwmods = "iva";
+
+                       dsp {
+                               compatible = "ti,omap3-c64";
+                       };
+               };
+       };
+
+       /*
+        * XXX: Use a flat representation of the OMAP3 interconnect.
+        * The real OMAP interconnect network is quite complex.
+        * Since that will not bring real advantage to represent that in DT for
+        * the moment, just use a fake OCP bus entry to represent the whole bus
+        * hierarchy.
+        */
+       ocp {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               ti,hwmods = "l3_main";
+
+               intc: interrupt-controller@1 {
+                       compatible = "ti,omap3-intc";
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
new file mode 100644 (file)
index 0000000..c702657
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2011 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/ "omap4.dtsi"
+
+/ {
+       model = "TI OMAP4 PandaBoard";
+       compatible = "ti,omap4-panda", "ti,omap4430", "ti,omap4";
+
+       /*
+        * Since the initial device tree board file does not create any
+        * devices (MMC, network...), the only way to boot is to provide a
+        * ramdisk.
+        */
+       chosen {
+               bootargs = "root=/dev/ram0 rw console=ttyO2,115200n8 initrd=0x81600000,20M ramdisk_size=20480 no_console_suspend debug";
+       };
+
+       memory {
+               device_type = "memory";
+               reg = <0x80000000 0x40000000>; /* 1 GB */
+       };
+};
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
new file mode 100644 (file)
index 0000000..066e28c
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2011 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/ "omap4.dtsi"
+
+/ {
+       model = "TI OMAP4 SDP board";
+       compatible = "ti,omap4-sdp", "ti,omap4430", "ti,omap4";
+
+       /*
+        * Since the initial device tree board file does not create any
+        * devices (MMC, network...), the only way to boot is to provide a
+        * ramdisk.
+        */
+       chosen {
+               bootargs = "root=/dev/ram0 rw console=ttyO2,115200n8 initrd=0x81600000,20M ramdisk_size=20480 no_console_suspend debug";
+       };
+
+       memory {
+               device_type = "memory";
+               reg = <0x80000000 0x40000000>; /* 1 GB */
+       };
+};
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
new file mode 100644 (file)
index 0000000..4c61c82
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+/*
+ * Carveout for multimedia usecases
+ * It should be the last 48MB of the first 512MB memory part
+ * In theory, it should not even exist. That zone should be reserved
+ * dynamically during the .reserve callback.
+ */
+/memreserve/ 0x9d000000 0x03000000;
+
+/include/ "skeleton.dtsi"
+
+/ {
+       compatible = "ti,omap4430", "ti,omap4";
+       interrupt-parent = <&gic>;
+
+       aliases {
+       };
+
+       cpus {
+               cpu@0 {
+                       compatible = "arm,cortex-a9";
+               };
+               cpu@1 {
+                       compatible = "arm,cortex-a9";
+               };
+       };
+
+       /*
+        * The soc node represents the soc top level view. It is uses for IPs
+        * that are not memory mapped in the MPU view or for the MPU itself.
+        */
+       soc {
+               compatible = "ti,omap-infra";
+               mpu {
+                       compatible = "ti,omap4-mpu";
+                       ti,hwmods = "mpu";
+               };
+
+               dsp {
+                       compatible = "ti,omap3-c64";
+                       ti,hwmods = "dsp";
+               };
+
+               iva {
+                       compatible = "ti,ivahd";
+                       ti,hwmods = "iva";
+               };
+       };
+
+       /*
+        * XXX: Use a flat representation of the OMAP4 interconnect.
+        * The real OMAP interconnect network is quite complex.
+        *
+        * MPU -+-- MPU_PRIVATE - GIC, L2
+        *      |
+        *      +----------------+----------+
+        *      |                |          |
+        *      +            +- EMIF - DDR  |
+        *      |            |              |
+        *      |            +     +--------+
+        *      |            |     |
+        *      |            +- L4_ABE - AESS, MCBSP, TIMERs...
+        *      |            |
+        *      +- L3_MAIN --+- L4_CORE - IPs...
+        *                   |
+        *                   +- L4_PER - IPs...
+        *                   |
+        *                   +- L4_CFG -+- L4_WKUP - IPs...
+        *                   |          |
+        *                   |          +- IPs...
+        *                   +- IPU ----+
+        *                   |          |
+        *                   +- DSP ----+
+        *                   |          |
+        *                   +- DSS ----+
+        *
+        * Since that will not bring real advantage to represent that in DT for
+        * the moment, just use a fake OCP bus entry to represent the whole bus
+        * hierarchy.
+        */
+       ocp {
+               compatible = "ti,omap4-l3-noc", "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
+
+               gic: interrupt-controller@48241000 {
+                       compatible = "arm,cortex-a9-gic";
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+                       reg = <0x48241000 0x1000>,
+                             <0x48240100 0x0100>;
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/picoxcell-pc3x2.dtsi b/arch/arm/boot/dts/picoxcell-pc3x2.dtsi
new file mode 100644 (file)
index 0000000..f0a8c20
--- /dev/null
@@ -0,0 +1,249 @@
+/*
+ *  Copyright (C) 2011 Picochip, Jamie Iles
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+/include/ "skeleton.dtsi"
+/ {
+       model = "Picochip picoXcell PC3X2";
+       compatible = "picochip,pc3x2";
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu@0 {
+                       compatible = "arm,1176jz-s";
+                       clock-frequency = <400000000>;
+                       reg = <0>;
+                       d-cache-line-size = <32>;
+                       d-cache-size = <32768>;
+                       i-cache-line-size = <32>;
+                       i-cache-size = <32768>;
+               };
+       };
+
+       clocks {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               pclk: clock@0 {
+                       compatible = "fixed-clock";
+                       clock-outputs = "bus", "pclk";
+                       clock-frequency = <200000000>;
+                       ref-clock = <&ref_clk>, "ref";
+               };
+       };
+
+       paxi {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x80000000 0x400000>;
+
+               emac: gem@30000 {
+                       compatible = "cadence,gem";
+                       reg = <0x30000 0x10000>;
+                       interrupts = <31>;
+               };
+
+               dmac1: dmac@40000 {
+                       compatible = "snps,dw-dmac";
+                       reg = <0x40000 0x10000>;
+                       interrupts = <25>;
+               };
+
+               dmac2: dmac@50000 {
+                       compatible = "snps,dw-dmac";
+                       reg = <0x50000 0x10000>;
+                       interrupts = <26>;
+               };
+
+               vic0: interrupt-controller@60000 {
+                       compatible = "arm,pl192-vic";
+                       interrupt-controller;
+                       reg = <0x60000 0x1000>;
+                       #interrupt-cells = <1>;
+               };
+
+               vic1: interrupt-controller@64000 {
+                       compatible = "arm,pl192-vic";
+                       interrupt-controller;
+                       reg = <0x64000 0x1000>;
+                       #interrupt-cells = <1>;
+               };
+
+               fuse: picoxcell-fuse@80000 {
+                       compatible = "picoxcell,fuse-pc3x2";
+                       reg = <0x80000 0x10000>;
+               };
+
+               ssi: picoxcell-spi@90000 {
+                       compatible = "picoxcell,spi";
+                       reg = <0x90000 0x10000>;
+                       interrupt-parent = <&vic0>;
+                       interrupts = <10>;
+               };
+
+               ipsec: spacc@100000 {
+                       compatible = "picochip,spacc-ipsec";
+                       reg = <0x100000 0x10000>;
+                       interrupt-parent = <&vic0>;
+                       interrupts = <24>;
+                       ref-clock = <&pclk>, "ref";
+               };
+
+               srtp: spacc@140000 {
+                       compatible = "picochip,spacc-srtp";
+                       reg = <0x140000 0x10000>;
+                       interrupt-parent = <&vic0>;
+                       interrupts = <23>;
+               };
+
+               l2_engine: spacc@180000 {
+                       compatible = "picochip,spacc-l2";
+                       reg = <0x180000 0x10000>;
+                       interrupt-parent = <&vic0>;
+                       interrupts = <22>;
+                       ref-clock = <&pclk>, "ref";
+               };
+
+               apb {
+                       compatible = "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0 0x200000 0x80000>;
+
+                       rtc0: rtc@00000 {
+                               compatible = "picochip,pc3x2-rtc";
+                               clock-freq = <200000000>;
+                               reg = <0x00000 0xf>;
+                               interrupt-parent = <&vic1>;
+                               interrupts = <8>;
+                       };
+
+                       timer0: timer@10000 {
+                               compatible = "picochip,pc3x2-timer";
+                               interrupt-parent = <&vic0>;
+                               interrupts = <4>;
+                               clock-freq = <200000000>;
+                               reg = <0x10000 0x14>;
+                       };
+
+                       timer1: timer@10014 {
+                               compatible = "picochip,pc3x2-timer";
+                               interrupt-parent = <&vic0>;
+                               interrupts = <5>;
+                               clock-freq = <200000000>;
+                               reg = <0x10014 0x14>;
+                       };
+
+                       timer2: timer@10028 {
+                               compatible = "picochip,pc3x2-timer";
+                               interrupt-parent = <&vic0>;
+                               interrupts = <6>;
+                               clock-freq = <200000000>;
+                               reg = <0x10028 0x14>;
+                       };
+
+                       timer3: timer@1003c {
+                               compatible = "picochip,pc3x2-timer";
+                               interrupt-parent = <&vic0>;
+                               interrupts = <7>;
+                               clock-freq = <200000000>;
+                               reg = <0x1003c 0x14>;
+                       };
+
+                       gpio: gpio@20000 {
+                               compatible = "snps,dw-apb-gpio";
+                               reg = <0x20000 0x1000>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               reg-io-width = <4>;
+
+                               banka: gpio-controller@0 {
+                                       compatible = "snps,dw-apb-gpio-bank";
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       gpio-generic,nr-gpio = <8>;
+
+                                       regoffset-dat = <0x50>;
+                                       regoffset-set = <0x00>;
+                                       regoffset-dirout = <0x04>;
+                               };
+
+                               bankb: gpio-controller@1 {
+                                       compatible = "snps,dw-apb-gpio-bank";
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       gpio-generic,nr-gpio = <8>;
+
+                                       regoffset-dat = <0x54>;
+                                       regoffset-set = <0x0c>;
+                                       regoffset-dirout = <0x10>;
+                               };
+                       };
+
+                       uart0: uart@30000 {
+                               compatible = "snps,dw-apb-uart";
+                               reg = <0x30000 0x1000>;
+                               interrupt-parent = <&vic1>;
+                               interrupts = <10>;
+                               clock-frequency = <3686400>;
+                               reg-shift = <2>;
+                               reg-io-width = <4>;
+                       };
+
+                       uart1: uart@40000 {
+                               compatible = "snps,dw-apb-uart";
+                               reg = <0x40000 0x1000>;
+                               interrupt-parent = <&vic1>;
+                               interrupts = <9>;
+                               clock-frequency = <3686400>;
+                               reg-shift = <2>;
+                               reg-io-width = <4>;
+                       };
+
+                       wdog: watchdog@50000 {
+                               compatible = "snps,dw-apb-wdg";
+                               reg = <0x50000 0x10000>;
+                               interrupt-parent = <&vic0>;
+                               interrupts = <11>;
+                               bus-clock = <&pclk>, "bus";
+                       };
+               };
+       };
+
+       rwid-axi {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "simple-bus";
+               ranges;
+
+               ebi@50000000 {
+                       compatible = "simple-bus";
+                       #address-cells = <2>;
+                       #size-cells = <1>;
+                       ranges = <0 0 0x40000000 0x08000000
+                                 1 0 0x48000000 0x08000000
+                                 2 0 0x50000000 0x08000000
+                                 3 0 0x58000000 0x08000000>;
+               };
+
+               axi2pico@c0000000 {
+                       compatible = "picochip,axi2pico-pc3x2";
+                       reg = <0xc0000000 0x10000>;
+                       interrupts = <13 14 15 16 17 18 19 20 21>;
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/picoxcell-pc3x3.dtsi b/arch/arm/boot/dts/picoxcell-pc3x3.dtsi
new file mode 100644 (file)
index 0000000..daa962d
--- /dev/null
@@ -0,0 +1,365 @@
+/*
+ *  Copyright (C) 2011 Picochip, Jamie Iles
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+/include/ "skeleton.dtsi"
+/ {
+       model = "Picochip picoXcell PC3X3";
+       compatible = "picochip,pc3x3";
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu@0 {
+                       compatible = "arm,1176jz-s";
+                       cpu-clock = <&arm_clk>, "cpu";
+                       reg = <0>;
+                       d-cache-line-size = <32>;
+                       d-cache-size = <32768>;
+                       i-cache-line-size = <32>;
+                       i-cache-size = <32768>;
+               };
+       };
+
+       clocks {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               clkgate: clkgate@800a0048 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x800a0048 4>;
+                       compatible = "picochip,pc3x3-clk-gate";
+
+                       tzprot_clk: clock@0 {
+                               compatible = "picochip,pc3x3-gated-clk";
+                               clock-outputs = "bus";
+                               picochip,clk-disable-bit = <0>;
+                               clock-frequency = <200000000>;
+                               ref-clock = <&ref_clk>, "ref";
+                       };
+
+                       spi_clk: clock@1 {
+                               compatible = "picochip,pc3x3-gated-clk";
+                               clock-outputs = "bus";
+                               picochip,clk-disable-bit = <1>;
+                               clock-frequency = <200000000>;
+                               ref-clock = <&ref_clk>, "ref";
+                       };
+
+                       dmac0_clk: clock@2 {
+                               compatible = "picochip,pc3x3-gated-clk";
+                               clock-outputs = "bus";
+                               picochip,clk-disable-bit = <2>;
+                               clock-frequency = <200000000>;
+                               ref-clock = <&ref_clk>, "ref";
+                       };
+
+                       dmac1_clk: clock@3 {
+                               compatible = "picochip,pc3x3-gated-clk";
+                               clock-outputs = "bus";
+                               picochip,clk-disable-bit = <3>;
+                               clock-frequency = <200000000>;
+                               ref-clock = <&ref_clk>, "ref";
+                       };
+
+                       ebi_clk: clock@4 {
+                               compatible = "picochip,pc3x3-gated-clk";
+                               clock-outputs = "bus";
+                               picochip,clk-disable-bit = <4>;
+                               clock-frequency = <200000000>;
+                               ref-clock = <&ref_clk>, "ref";
+                       };
+
+                       ipsec_clk: clock@5 {
+                               compatible = "picochip,pc3x3-gated-clk";
+                               clock-outputs = "bus";
+                               picochip,clk-disable-bit = <5>;
+                               clock-frequency = <200000000>;
+                               ref-clock = <&ref_clk>, "ref";
+                       };
+
+                       l2_clk: clock@6 {
+                               compatible = "picochip,pc3x3-gated-clk";
+                               clock-outputs = "bus";
+                               picochip,clk-disable-bit = <6>;
+                               clock-frequency = <200000000>;
+                               ref-clock = <&ref_clk>, "ref";
+                       };
+
+                       trng_clk: clock@7 {
+                               compatible = "picochip,pc3x3-gated-clk";
+                               clock-outputs = "bus";
+                               picochip,clk-disable-bit = <7>;
+                               clock-frequency = <200000000>;
+                               ref-clock = <&ref_clk>, "ref";
+                       };
+
+                       fuse_clk: clock@8 {
+                               compatible = "picochip,pc3x3-gated-clk";
+                               clock-outputs = "bus";
+                               picochip,clk-disable-bit = <8>;
+                               clock-frequency = <200000000>;
+                               ref-clock = <&ref_clk>, "ref";
+                       };
+
+                       otp_clk: clock@9 {
+                               compatible = "picochip,pc3x3-gated-clk";
+                               clock-outputs = "bus";
+                               picochip,clk-disable-bit = <9>;
+                               clock-frequency = <200000000>;
+                               ref-clock = <&ref_clk>, "ref";
+                       };
+               };
+
+               arm_clk: clock@11 {
+                       compatible = "picochip,pc3x3-pll";
+                       reg = <0x800a0050 0x8>;
+                       picochip,min-freq = <140000000>;
+                       picochip,max-freq = <700000000>;
+                       ref-clock = <&ref_clk>, "ref";
+                       clock-outputs = "cpu";
+               };
+
+               pclk: clock@12 {
+                       compatible = "fixed-clock";
+                       clock-outputs = "bus", "pclk";
+                       clock-frequency = <200000000>;
+                       ref-clock = <&ref_clk>, "ref";
+               };
+       };
+
+       paxi {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x80000000 0x400000>;
+
+               emac: gem@30000 {
+                       compatible = "cadence,gem";
+                       reg = <0x30000 0x10000>;
+                       interrupt-parent = <&vic0>;
+                       interrupts = <31>;
+               };
+
+               dmac1: dmac@40000 {
+                       compatible = "snps,dw-dmac";
+                       reg = <0x40000 0x10000>;
+                       interrupt-parent = <&vic0>;
+                       interrupts = <25>;
+               };
+
+               dmac2: dmac@50000 {
+                       compatible = "snps,dw-dmac";
+                       reg = <0x50000 0x10000>;
+                       interrupt-parent = <&vic0>;
+                       interrupts = <26>;
+               };
+
+               vic0: interrupt-controller@60000 {
+                       compatible = "arm,pl192-vic";
+                       interrupt-controller;
+                       reg = <0x60000 0x1000>;
+                       #interrupt-cells = <1>;
+               };
+
+               vic1: interrupt-controller@64000 {
+                       compatible = "arm,pl192-vic";
+                       interrupt-controller;
+                       reg = <0x64000 0x1000>;
+                       #interrupt-cells = <1>;
+               };
+
+               fuse: picoxcell-fuse@80000 {
+                       compatible = "picoxcell,fuse-pc3x3";
+                       reg = <0x80000 0x10000>;
+               };
+
+               ssi: picoxcell-spi@90000 {
+                       compatible = "picoxcell,spi";
+                       reg = <0x90000 0x10000>;
+                       interrupt-parent = <&vic0>;
+                       interrupts = <10>;
+               };
+
+               ipsec: spacc@100000 {
+                       compatible = "picochip,spacc-ipsec";
+                       reg = <0x100000 0x10000>;
+                       interrupt-parent = <&vic0>;
+                       interrupts = <24>;
+                       ref-clock = <&ipsec_clk>, "ref";
+               };
+
+               srtp: spacc@140000 {
+                       compatible = "picochip,spacc-srtp";
+                       reg = <0x140000 0x10000>;
+                       interrupt-parent = <&vic0>;
+                       interrupts = <23>;
+               };
+
+               l2_engine: spacc@180000 {
+                       compatible = "picochip,spacc-l2";
+                       reg = <0x180000 0x10000>;
+                       interrupt-parent = <&vic0>;
+                       interrupts = <22>;
+                       ref-clock = <&l2_clk>, "ref";
+               };
+
+               apb {
+                       compatible = "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0 0x200000 0x80000>;
+
+                       rtc0: rtc@00000 {
+                               compatible = "picochip,pc3x2-rtc";
+                               clock-freq = <200000000>;
+                               reg = <0x00000 0xf>;
+                               interrupt-parent = <&vic0>;
+                               interrupts = <8>;
+                       };
+
+                       timer0: timer@10000 {
+                               compatible = "picochip,pc3x2-timer";
+                               interrupt-parent = <&vic0>;
+                               interrupts = <4>;
+                               clock-freq = <200000000>;
+                               reg = <0x10000 0x14>;
+                       };
+
+                       timer1: timer@10014 {
+                               compatible = "picochip,pc3x2-timer";
+                               interrupt-parent = <&vic0>;
+                               interrupts = <5>;
+                               clock-freq = <200000000>;
+                               reg = <0x10014 0x14>;
+                       };
+
+                       gpio: gpio@20000 {
+                               compatible = "snps,dw-apb-gpio";
+                               reg = <0x20000 0x1000>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               reg-io-width = <4>;
+
+                               banka: gpio-controller@0 {
+                                       compatible = "snps,dw-apb-gpio-bank";
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       gpio-generic,nr-gpio = <8>;
+
+                                       regoffset-dat = <0x50>;
+                                       regoffset-set = <0x00>;
+                                       regoffset-dirout = <0x04>;
+                               };
+
+                               bankb: gpio-controller@1 {
+                                       compatible = "snps,dw-apb-gpio-bank";
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       gpio-generic,nr-gpio = <16>;
+
+                                       regoffset-dat = <0x54>;
+                                       regoffset-set = <0x0c>;
+                                       regoffset-dirout = <0x10>;
+                               };
+
+                               bankd: gpio-controller@2 {
+                                       compatible = "snps,dw-apb-gpio-bank";
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       gpio-generic,nr-gpio = <30>;
+
+                                       regoffset-dat = <0x5c>;
+                                       regoffset-set = <0x24>;
+                                       regoffset-dirout = <0x28>;
+                               };
+                       };
+
+                       uart0: uart@30000 {
+                               compatible = "snps,dw-apb-uart";
+                               reg = <0x30000 0x1000>;
+                               interrupt-parent = <&vic1>;
+                               interrupts = <10>;
+                               clock-frequency = <3686400>;
+                               reg-shift = <2>;
+                               reg-io-width = <4>;
+                       };
+
+                       uart1: uart@40000 {
+                               compatible = "snps,dw-apb-uart";
+                               reg = <0x40000 0x1000>;
+                               interrupt-parent = <&vic1>;
+                               interrupts = <9>;
+                               clock-frequency = <3686400>;
+                               reg-shift = <2>;
+                               reg-io-width = <4>;
+                       };
+
+                       wdog: watchdog@50000 {
+                               compatible = "snps,dw-apb-wdg";
+                               reg = <0x50000 0x10000>;
+                               interrupt-parent = <&vic0>;
+                               interrupts = <11>;
+                               bus-clock = <&pclk>, "bus";
+                       };
+
+                       timer2: timer@60000 {
+                               compatible = "picochip,pc3x2-timer";
+                               interrupt-parent = <&vic0>;
+                               interrupts = <6>;
+                               clock-freq = <200000000>;
+                               reg = <0x60000 0x14>;
+                       };
+
+                       timer3: timer@60014 {
+                               compatible = "picochip,pc3x2-timer";
+                               interrupt-parent = <&vic0>;
+                               interrupts = <7>;
+                               clock-freq = <200000000>;
+                               reg = <0x60014 0x14>;
+                       };
+               };
+       };
+
+       rwid-axi {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "simple-bus";
+               ranges;
+
+               ebi@50000000 {
+                       compatible = "simple-bus";
+                       #address-cells = <2>;
+                       #size-cells = <1>;
+                       ranges = <0 0 0x40000000 0x08000000
+                                 1 0 0x48000000 0x08000000
+                                 2 0 0x50000000 0x08000000
+                                 3 0 0x58000000 0x08000000>;
+               };
+
+               axi2pico@c0000000 {
+                       compatible = "picochip,axi2pico-pc3x3";
+                       reg = <0xc0000000 0x10000>;
+                       interrupt-parent = <&vic0>;
+                       interrupts = <13 14 15 16 17 18 19 20 21>;
+               };
+
+               otp@ffff8000 {
+                       compatible = "picochip,otp-pc3x3";
+                       reg = <0xffff8000 0x8000>;
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/picoxcell-pc7302-pc3x2.dts b/arch/arm/boot/dts/picoxcell-pc7302-pc3x2.dts
new file mode 100644 (file)
index 0000000..1297414
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ *  Copyright (C) 2011 Picochip, Jamie Iles
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+/dts-v1/;
+/include/ "picoxcell-pc3x2.dtsi"
+/ {
+       model = "Picochip PC7302 (PC3X2)";
+       compatible = "picochip,pc7302-pc3x2", "picochip,pc3x2";
+
+       memory {
+               device_type = "memory";
+               reg = <0x0 0x08000000>;
+       };
+
+       chosen {
+               linux,stdout-path = &uart0;
+       };
+
+       clocks {
+               ref_clk: clock@1 {
+                       compatible = "fixed-clock";
+                       clock-outputs = "ref";
+                       clock-frequency = <20000000>;
+               };
+       };
+
+       rwid-axi {
+               ebi@50000000 {
+                       nand: gpio-nand@2,0 {
+                               compatible = "gpio-control-nand";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               reg = <2 0x0000 0x1000>;
+                               bus-clock = <&pclk>, "bus";
+                               gpio-control-nand,io-sync-reg =
+                                       <0x00000000 0x80220000>;
+
+                               gpios = <&banka 1 0     /* rdy */
+                                        &banka 2 0     /* nce */
+                                        &banka 3 0     /* ale */
+                                        &banka 4 0     /* cle */
+                                        0              /* nwp */>;
+
+                               boot@100000 {
+                                       label = "Boot";
+                                       reg = <0x100000 0x80000>;
+                               };
+
+                               redundant-boot@200000 {
+                                       label = "Redundant Boot";
+                                       reg = <0x200000 0x80000>;
+                               };
+
+                               boot-env@300000 {
+                                       label = "Boot Evironment";
+                                       reg = <0x300000 0x20000>;
+                               };
+
+                               redundant-boot-env@320000 {
+                                       label = "Redundant Boot Environment";
+                                       reg = <0x300000 0x20000>;
+                               };
+
+                               kernel@380000 {
+                                       label = "Kernel";
+                                       reg = <0x380000 0x800000>;
+                               };
+
+                               fs@b80000 {
+                                       label = "File System";
+                                       reg = <0xb80000 0xf480000>;
+                               };
+                       };
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/picoxcell-pc7302-pc3x3.dts b/arch/arm/boot/dts/picoxcell-pc7302-pc3x3.dts
new file mode 100644 (file)
index 0000000..9e317a4
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ *  Copyright (C) 2011 Picochip, Jamie Iles
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+/dts-v1/;
+/include/ "picoxcell-pc3x3.dtsi"
+/ {
+       model = "Picochip PC7302 (PC3X3)";
+       compatible = "picochip,pc7302-pc3x3", "picochip,pc3x3";
+
+       memory {
+               device_type = "memory";
+               reg = <0x0 0x08000000>;
+       };
+
+       chosen {
+               linux,stdout-path = &uart0;
+       };
+
+       clocks {
+               ref_clk: clock@10 {
+                       compatible = "fixed-clock";
+                       clock-outputs = "ref";
+                       clock-frequency = <20000000>;
+               };
+
+               clkgate: clkgate@800a0048 {
+                       clock@4 {
+                               picochip,clk-no-disable;
+                       };
+               };
+       };
+
+       rwid-axi {
+               ebi@50000000 {
+                       nand: gpio-nand@2,0 {
+                               compatible = "gpio-control-nand";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               reg = <2 0x0000 0x1000>;
+                               bus-clock = <&ebi_clk>, "bus";
+                               gpio-control-nand,io-sync-reg =
+                                       <0x00000000 0x80220000>;
+
+                               gpios = <&banka 1 0     /* rdy */
+                                        &banka 2 0     /* nce */
+                                        &banka 3 0     /* ale */
+                                        &banka 4 0     /* cle */
+                                        0              /* nwp */>;
+
+                               boot@100000 {
+                                       label = "Boot";
+                                       reg = <0x100000 0x80000>;
+                               };
+
+                               redundant-boot@200000 {
+                                       label = "Redundant Boot";
+                                       reg = <0x200000 0x80000>;
+                               };
+
+                               boot-env@300000 {
+                                       label = "Boot Evironment";
+                                       reg = <0x300000 0x20000>;
+                               };
+
+                               redundant-boot-env@320000 {
+                                       label = "Redundant Boot Environment";
+                                       reg = <0x300000 0x20000>;
+                               };
+
+                               kernel@380000 {
+                                       label = "Kernel";
+                                       reg = <0x380000 0x800000>;
+                               };
+
+                               fs@b80000 {
+                                       label = "File System";
+                                       reg = <0xb80000 0xf480000>;
+                               };
+                       };
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/usb_a9g20.dts b/arch/arm/boot/dts/usb_a9g20.dts
new file mode 100644 (file)
index 0000000..d66e2c0
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * usb_a9g20.dts - Device Tree file for Caloa USB A9G20 board
+ *
+ *  Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * Licensed under GPLv2 or later.
+ */
+/dts-v1/;
+/include/ "at91sam9g20.dtsi"
+
+/ {
+       model = "Calao USB A9G20";
+       compatible = "calao,usb-a9g20", "atmel,at91sam9g20", "atmel,at91sam9";
+
+       chosen {
+               bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),4M(kernel),120M(rootfs),-(data) root=/dev/mtdblock5 rw rootfstype=ubifs";
+       };
+
+       memory@20000000 {
+               reg = <0x20000000 0x4000000>;
+       };
+
+       ahb {
+               apb {
+                       dbgu: serial@fffff200 {
+                               status = "okay";
+                       };
+               };
+       };
+};
index 9d77777076f08e800e4f97b4b10ddfa9ee60e8c1..bf0e134e5206620cebdc16fba183a3ee72c57e4a 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/err.h>
-#include <linux/export.h>
+#include <linux/module.h>
 #include <linux/list.h>
 #include <linux/smp.h>
 #include <linux/cpu_pm.h>
index a07b0e763a805109c007161d46efd6df5f45d6b6..1cde34a080d7e688efbf019aae2e55f8e20895c2 100644 (file)
  */
 
 #include <linux/device.h>
+#include <linux/gpio.h>
 #include <linux/string.h>
 #include <linux/slab.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
-#include <asm/gpio.h>
 #include <asm/hardware/scoop.h>
 
 /* PCMCIA to Scoop linkage
index 7aa4262ada7a1b5f046f8bbe36631e11ce516c74..197f81c77351d8ea1b9bb090781ebc8bf6e0f9a7 100644 (file)
@@ -259,7 +259,6 @@ static void __init vic_disable(void __iomem *base)
        writel(0, base + VIC_INT_SELECT);
        writel(0, base + VIC_INT_ENABLE);
        writel(~0, base + VIC_INT_ENABLE_CLEAR);
-       writel(0, base + VIC_IRQ_STATUS);
        writel(0, base + VIC_ITCR);
        writel(~0, base + VIC_INT_SOFT_CLEAR);
 }
index 9f390ce335cb00743cb6cd717819f0750b63b0db..b5c9f5b1f6a374de13b23103985985051f537889 100644 (file)
@@ -12,7 +12,12 @@ struct dev_archdata {
 #endif
 };
 
+struct omap_device;
+
 struct pdev_archdata {
+#ifdef CONFIG_ARCH_OMAP
+       struct omap_device *od;
+#endif
 };
 
 #endif
index 29f2610efc70775a7059f4b5f63e1cc175c78749..eaea14676d5732798433ad91cb25f05482b75147 100644 (file)
@@ -161,7 +161,6 @@ struct expansion_card {
 
        /* Private internal data */
        const char              *card_desc;     /* Card description             */
-       CONST unsigned int      podaddr;        /* Base Linux address for card  */
        CONST loader_t          loader;         /* loader program */
        u64                     dma_mask;
 };
index 166a7a3e28400db64062715a53bdb2f31d4e9df4..11ad0bfbb0ad67ca3c3865d25a216b22a13c10f5 100644 (file)
@@ -4,4 +4,23 @@
 /* not all ARM platforms necessarily support this API ... */
 #include <mach/gpio.h>
 
+#ifndef __ARM_GPIOLIB_COMPLEX
+/* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */
+#include <asm-generic/gpio.h>
+
+/* The trivial gpiolib dispatchers */
+#define gpio_get_value  __gpio_get_value
+#define gpio_set_value  __gpio_set_value
+#define gpio_cansleep   __gpio_cansleep
+#endif
+
+/*
+ * Provide a default gpio_to_irq() which should satisfy every case.
+ * However, some platforms want to do this differently, so allow them
+ * to override it.
+ */
+#ifndef gpio_to_irq
+#define gpio_to_irq    __gpio_to_irq
+#endif
+
 #endif /* _ARCH_ARM_GPIO_H */
index 99a6ed7e1bfd5ce6395ca7a900079ada255da281..1db1143a94838cb92419040c40009f17d1ee2f97 100644 (file)
@@ -52,6 +52,8 @@
 #define L2X0_LOCKDOWN_WAY_D_BASE       0x900
 #define L2X0_LOCKDOWN_WAY_I_BASE       0x904
 #define L2X0_LOCKDOWN_STRIDE           0x08
+#define L2X0_ADDR_FILTER_START         0xC00
+#define L2X0_ADDR_FILTER_END           0xC04
 #define L2X0_TEST_OPERATION            0xF00
 #define L2X0_LINE_DATA                 0xF10
 #define L2X0_LINE_TAG                  0xF30
 #define L2X0_CACHE_ID_PART_MASK                (0xf << 6)
 #define L2X0_CACHE_ID_PART_L210                (1 << 6)
 #define L2X0_CACHE_ID_PART_L310                (3 << 6)
+#define L2X0_CACHE_ID_RTL_MASK          0x3f
+#define L2X0_CACHE_ID_RTL_R0P0          0x0
+#define L2X0_CACHE_ID_RTL_R1P0          0x2
+#define L2X0_CACHE_ID_RTL_R2P0          0x4
+#define L2X0_CACHE_ID_RTL_R3P0          0x5
+#define L2X0_CACHE_ID_RTL_R3P1          0x6
+#define L2X0_CACHE_ID_RTL_R3P2          0x8
 
 #define L2X0_AUX_CTRL_MASK                     0xc0000fff
+#define L2X0_AUX_CTRL_DATA_RD_LATENCY_SHIFT    0
+#define L2X0_AUX_CTRL_DATA_RD_LATENCY_MASK     0x7
+#define L2X0_AUX_CTRL_DATA_WR_LATENCY_SHIFT    3
+#define L2X0_AUX_CTRL_DATA_WR_LATENCY_MASK     (0x7 << 3)
+#define L2X0_AUX_CTRL_TAG_LATENCY_SHIFT                6
+#define L2X0_AUX_CTRL_TAG_LATENCY_MASK         (0x7 << 6)
+#define L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT      9
+#define L2X0_AUX_CTRL_DIRTY_LATENCY_MASK       (0x7 << 9)
 #define L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT      16
 #define L2X0_AUX_CTRL_WAY_SIZE_SHIFT           17
 #define L2X0_AUX_CTRL_WAY_SIZE_MASK            (0x7 << 17)
 #define L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT     29
 #define L2X0_AUX_CTRL_EARLY_BRESP_SHIFT                30
 
+#define L2X0_LATENCY_CTRL_SETUP_SHIFT  0
+#define L2X0_LATENCY_CTRL_RD_SHIFT     4
+#define L2X0_LATENCY_CTRL_WR_SHIFT     8
+
+#define L2X0_ADDR_FILTER_EN            1
+
 #ifndef __ASSEMBLY__
 extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask);
+#if defined(CONFIG_CACHE_L2X0) && defined(CONFIG_OF)
+extern int l2x0_of_init(__u32 aux_val, __u32 aux_mask);
+#else
+static inline int l2x0_of_init(__u32 aux_val, __u32 aux_mask)
+{
+       return -ENODEV;
+}
 #endif
 
+struct l2x0_regs {
+       unsigned long phy_base;
+       unsigned long aux_ctrl;
+       /*
+        * Whether the following registers need to be saved/restored
+        * depends on platform
+        */
+       unsigned long tag_latency;
+       unsigned long data_latency;
+       unsigned long filter_start;
+       unsigned long filter_end;
+       unsigned long prefetch_ctrl;
+       unsigned long pwr_ctrl;
+};
+
+extern struct l2x0_regs l2x0_saved_regs;
+
+#endif /* __ASSEMBLY__ */
+
 #endif
index b69d972b1f7d21987c2ca86c7119cb101767f75d..9eda7dc92ad8d79c2214ac1ba472fa9e29c2357f 100644 (file)
@@ -28,6 +28,8 @@
 #include <mach/hardware.h>
 #include <asm-generic/gpio.h>
 
+#define __ARM_GPIOLIB_COMPLEX
+
 #define IOP3XX_N_GPIOS 8
 
 static inline int gpio_get_value(unsigned gpio)
index d66605dea55a217fc10df9fda8a94f3e5b1eb9ea..ffb089d46a179a05089e84a71fa5d13036a3c749 100644 (file)
@@ -109,6 +109,27 @@ static inline void __iomem *__typesafe_io(unsigned long addr)
  */
 #include <mach/io.h>
 
+/*
+ * This is the limit of PC card/PCI/ISA IO space, which is by default
+ * 64K if we have PC card, PCI or ISA support.  Otherwise, default to
+ * zero to prevent ISA/PCI drivers claiming IO space (and potentially
+ * oopsing.)
+ *
+ * Only set this larger if you really need inb() et.al. to operate over
+ * a larger address space.  Note that SOC_COMMON ioremaps each sockets
+ * IO space area, and so inb() et.al. must be defined to operate as per
+ * readb() et.al. on such platforms.
+ */
+#ifndef IO_SPACE_LIMIT
+#if defined(CONFIG_PCMCIA_SOC_COMMON) || defined(CONFIG_PCMCIA_SOC_COMMON_MODULE)
+#define IO_SPACE_LIMIT ((resource_size_t)0xffffffff)
+#elif defined(CONFIG_PCI) || defined(CONFIG_ISA) || defined(CONFIG_PCCARD)
+#define IO_SPACE_LIMIT ((resource_size_t)0xffff)
+#else
+#define IO_SPACE_LIMIT ((resource_size_t)0)
+#endif
+#endif
+
 /*
  *  IO port access primitives
  *  -------------------------
index f5e1cec7e35cb58d4aeaaf505424b8231bcaebd5..c6a18424888ed4992ed05913e77e262eb3126723 100644 (file)
@@ -10,6 +10,7 @@
 #ifndef __ASM_ARM_LOCALTIMER_H
 #define __ASM_ARM_LOCALTIMER_H
 
+#include <linux/errno.h>
 #include <linux/interrupt.h>
 
 struct clock_event_device;
index d8387437ec5aa8c49258d9ab9f3bbeca2b6bd189..53426c66352a1bde6f1b3fb510f404ea41ba3206 100644 (file)
@@ -34,6 +34,7 @@ struct outer_cache_fns {
        void (*sync)(void);
 #endif
        void (*set_debug)(unsigned long);
+       void (*resume)(void);
 };
 
 #ifdef CONFIG_OUTER_CACHE
@@ -74,6 +75,12 @@ static inline void outer_disable(void)
                outer_cache.disable();
 }
 
+static inline void outer_resume(void)
+{
+       if (outer_cache.resume)
+               outer_cache.resume();
+}
+
 #else
 
 static inline void outer_inv_range(phys_addr_t start, phys_addr_t end)
index 16baba2e436961fa9f7128278368b8a5746182d8..1429d8989fb90defcd8ba22fb18493a2206f658d 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/thread_info.h>
 #include <asm/memory.h>
 #include <asm/procinfo.h>
+#include <asm/hardware/cache-l2x0.h>
 #include <linux/kbuild.h>
 
 /*
@@ -92,6 +93,17 @@ int main(void)
   DEFINE(S_OLD_R0,             offsetof(struct pt_regs, ARM_ORIG_r0));
   DEFINE(S_FRAME_SIZE,         sizeof(struct pt_regs));
   BLANK();
+#ifdef CONFIG_CACHE_L2X0
+  DEFINE(L2X0_R_PHY_BASE,      offsetof(struct l2x0_regs, phy_base));
+  DEFINE(L2X0_R_AUX_CTRL,      offsetof(struct l2x0_regs, aux_ctrl));
+  DEFINE(L2X0_R_TAG_LATENCY,   offsetof(struct l2x0_regs, tag_latency));
+  DEFINE(L2X0_R_DATA_LATENCY,  offsetof(struct l2x0_regs, data_latency));
+  DEFINE(L2X0_R_FILTER_START,  offsetof(struct l2x0_regs, filter_start));
+  DEFINE(L2X0_R_FILTER_END,    offsetof(struct l2x0_regs, filter_end));
+  DEFINE(L2X0_R_PREFETCH_CTRL, offsetof(struct l2x0_regs, prefetch_ctrl));
+  DEFINE(L2X0_R_PWR_CTRL,      offsetof(struct l2x0_regs, pwr_ctrl));
+  BLANK();
+#endif
 #ifdef CONFIG_CPU_HAS_ASID
   DEFINE(MM_CONTEXT_ID,                offsetof(struct mm_struct, context.id));
   BLANK();
index d16500110ee99526655dcf409455ea0b8e32587b..4dd0edab6a658880ed505145fff2c5ce001ae639 100644 (file)
@@ -237,7 +237,7 @@ static void ecard_init_pgtables(struct mm_struct *mm)
 
        memcpy(dst_pgd, src_pgd, sizeof(pgd_t) * (IO_SIZE / PGDIR_SIZE));
 
-       src_pgd = pgd_offset(mm, EASI_BASE);
+       src_pgd = pgd_offset(mm, (unsigned long)EASI_BASE);
        dst_pgd = pgd_offset(mm, EASI_START);
 
        memcpy(dst_pgd, src_pgd, sizeof(pgd_t) * (EASI_SIZE / PGDIR_SIZE));
@@ -674,44 +674,37 @@ static int __init ecard_probeirqhw(void)
 #define ecard_probeirqhw() (0)
 #endif
 
-#ifndef IO_EC_MEMC8_BASE
-#define IO_EC_MEMC8_BASE 0
-#endif
-
-static unsigned int __ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed)
+static void __iomem *__ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed)
 {
-       unsigned long address = 0;
+       void __iomem *address = NULL;
        int slot = ec->slot_no;
 
        if (ec->slot_no == 8)
-               return IO_EC_MEMC8_BASE;
+               return ECARD_MEMC8_BASE;
 
        ectcr &= ~(1 << slot);
 
        switch (type) {
        case ECARD_MEMC:
                if (slot < 4)
-                       address = IO_EC_MEMC_BASE + (slot << 12);
+                       address = ECARD_MEMC_BASE + (slot << 14);
                break;
 
        case ECARD_IOC:
                if (slot < 4)
-                       address = IO_EC_IOC_BASE + (slot << 12);
-#ifdef IO_EC_IOC4_BASE
+                       address = ECARD_IOC_BASE + (slot << 14);
                else
-                       address = IO_EC_IOC4_BASE + ((slot - 4) << 12);
-#endif
+                       address = ECARD_IOC4_BASE + ((slot - 4) << 14);
                if (address)
-                       address +=  speed << 17;
+                       address += speed << 19;
                break;
 
-#ifdef IO_EC_EASI_BASE
        case ECARD_EASI:
-               address = IO_EC_EASI_BASE + (slot << 22);
+               address = ECARD_EASI_BASE + (slot << 24);
                if (speed == ECARD_FAST)
                        ectcr |= 1 << slot;
                break;
-#endif
+
        default:
                break;
        }
@@ -990,6 +983,7 @@ ecard_probe(int slot, card_type_t type)
        ecard_t **ecp;
        ecard_t *ec;
        struct ex_ecid cid;
+       void __iomem *addr;
        int i, rc;
 
        ec = ecard_alloc_card(type, slot);
@@ -999,7 +993,7 @@ ecard_probe(int slot, card_type_t type)
        }
 
        rc = -ENODEV;
-       if ((ec->podaddr = __ecard_address(ec, type, ECARD_SYNC)) == 0)
+       if ((addr = __ecard_address(ec, type, ECARD_SYNC)) == NULL)
                goto nodev;
 
        cid.r_zero = 1;
@@ -1019,7 +1013,7 @@ ecard_probe(int slot, card_type_t type)
        ec->cid.fiqmask = cid.r_fiqmask;
        ec->cid.fiqoff  = ecard_gets24(cid.r_fiqoff);
        ec->fiqaddr     =
-       ec->irqaddr     = (void __iomem *)ioaddr(ec->podaddr);
+       ec->irqaddr     = addr;
 
        if (ec->cid.is) {
                ec->irqmask = ec->cid.irqmask;
@@ -1048,10 +1042,8 @@ ecard_probe(int slot, card_type_t type)
                set_irq_flags(ec->irq, IRQF_VALID);
        }
 
-#ifdef IO_EC_MEMC8_BASE
        if (slot == 8)
                ec->irq = 11;
-#endif
 #ifdef CONFIG_ARCH_RPC
        /* On RiscPC, only first two slots have DMA capability */
        if (slot < 2)
@@ -1097,9 +1089,7 @@ static int __init ecard_init(void)
                        ecard_probe(slot, ECARD_IOC);
        }
 
-#ifdef IO_EC_MEMC8_BASE
        ecard_probe(8, ECARD_IOC);
-#endif
 
        irqhw = ecard_probeirqhw();
 
index 98b75738345e365fe9e5590f81714590e61907d1..1ef6d0034b85d1172c8efe1d1659e82dbced1032 100644 (file)
@@ -324,8 +324,8 @@ static const unsigned armv7_a9_perf_map[PERF_COUNT_HW_MAX] = {
        [PERF_COUNT_HW_CPU_CYCLES]          = ARMV7_PERFCTR_CPU_CYCLES,
        [PERF_COUNT_HW_INSTRUCTIONS]        =
                                        ARMV7_PERFCTR_INST_OUT_OF_RENAME_STAGE,
-       [PERF_COUNT_HW_CACHE_REFERENCES]    = ARMV7_PERFCTR_COHERENT_LINE_HIT,
-       [PERF_COUNT_HW_CACHE_MISSES]        = ARMV7_PERFCTR_COHERENT_LINE_MISS,
+       [PERF_COUNT_HW_CACHE_REFERENCES]    = ARMV7_PERFCTR_DCACHE_ACCESS,
+       [PERF_COUNT_HW_CACHE_MISSES]        = ARMV7_PERFCTR_DCACHE_REFILL,
        [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE,
        [PERF_COUNT_HW_BRANCH_MISSES]       = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
        [PERF_COUNT_HW_BUS_CYCLES]          = ARMV7_PERFCTR_CLOCK_CYCLES,
index 22484670e7ba60948d75aeb3af23009795a2fe37..4b59d96e1cd847d1f5c42f923ddb0f7db605867c 100644 (file)
@@ -442,6 +442,17 @@ endif
 
 # ----------------------------------------------------------
 
+comment "Generic Board Type"
+
+config MACH_AT91SAM_DT
+       bool "Atmel AT91SAM Evaluation Kits with device-tree support"
+       select USE_OF
+       help
+         Select this if you want to experiment device-tree with
+         an Atmel Evaluation Kit.
+
+# ----------------------------------------------------------
+
 comment "AT91 Board Options"
 
 config MTD_AT91_DATAFLASH_CARD
index bf57e8b1c9d0b513e604ed356d391a095cbbf10e..3ff245ebcad16f9bf56a50039640c3b61e6bb621 100644 (file)
@@ -74,6 +74,9 @@ obj-$(CONFIG_MACH_SNAPPER_9260)       += board-snapper9260.o
 # AT91SAM9G45 board-specific support
 obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o
 
+# AT91SAM board with device-tree
+obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o
+
 # AT91CAP9 board-specific support
 obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o
 
index 3462b815054ace1695cfe1f5f9bddc3358e4d513..08c665affde412ffde914930b2461d52a5007646 100644 (file)
@@ -16,3 +16,5 @@ else
 params_phys-y  := 0x20000100
 initrd_phys-y  := 0x20410000
 endif
+
+dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb usb_a9g20.dtb
index dba0d8d8a4bd185dd96054cbc466b9a2a6c825d7..f87f5040e78ef18d7e2fca5b355684e9b121bc3e 100644 (file)
@@ -16,6 +16,7 @@
 #include <asm/mach/irq.h>
 
 #include <linux/dma-mapping.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/i2c-gpio.h>
 
@@ -23,7 +24,6 @@
 
 #include <mach/board.h>
 #include <mach/cpu.h>
-#include <mach/gpio.h>
 #include <mach/at91cap9.h>
 #include <mach/at91cap9_matrix.h>
 #include <mach/at91sam9_smc.h>
index 7227755ffec643fae52b92ebd71844581fb1ed92..978be950035acb0f9fd4b21c19a3f6e6f11521af 100644 (file)
 #include <asm/mach/map.h>
 
 #include <linux/dma-mapping.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/i2c-gpio.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91rm9200.h>
 #include <mach/at91rm9200_mc.h>
 
index cb397be14448eaa767ddbfd94bdf4fbdf8c25254..f4518b49cb8274889e28c822527744bc95d0384a 100644 (file)
@@ -199,6 +199,14 @@ static struct clk_lookup periph_clocks_lookups[] = {
        CLKDEV_CON_DEV_ID("t4_clk", "atmel_tcb.1", &tc4_clk),
        CLKDEV_CON_DEV_ID("t5_clk", "atmel_tcb.1", &tc5_clk),
        CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk),
+       /* more usart lookup table for DT entries */
+       CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
+       CLKDEV_CON_DEV_ID("usart", "fffb0000.serial", &usart0_clk),
+       CLKDEV_CON_DEV_ID("usart", "fffb4000.serial", &usart1_clk),
+       CLKDEV_CON_DEV_ID("usart", "fffb8000.serial", &usart2_clk),
+       CLKDEV_CON_DEV_ID("usart", "fffd0000.serial", &usart3_clk),
+       CLKDEV_CON_DEV_ID("usart", "fffd4000.serial", &usart4_clk),
+       CLKDEV_CON_DEV_ID("usart", "fffd8000.serial", &usart5_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
index 39f81f47b4ba4d4fe12c02e852cae1afb97b661b..a53b3de9daa2ca33a9086af7e9dd43429da35557 100644 (file)
 #include <asm/mach/map.h>
 
 #include <linux/dma-mapping.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/i2c-gpio.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/cpu.h>
 #include <mach/at91sam9260.h>
 #include <mach/at91sam9260_matrix.h>
index 0f917928eeb7782510f7b590d8e627a8b319795a..4e647b653339d4dc64f31302078036ffe85310cb 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/mach/map.h>
 
 #include <linux/dma-mapping.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/i2c-gpio.h>
 
@@ -21,7 +22,6 @@
 #include <video/atmel_lcdc.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9261.h>
 #include <mach/at91sam9261_matrix.h>
 #include <mach/at91sam9_smc.h>
index a050f41fc860d7698b2a8ba83b29221f14805d22..dd7662bc395f5b319be704007262ece04ab715b7 100644 (file)
@@ -13,6 +13,7 @@
 #include <asm/mach/map.h>
 
 #include <linux/dma-mapping.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/i2c-gpio.h>
 
@@ -20,7 +21,6 @@
 #include <video/atmel_lcdc.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9263.h>
 #include <mach/at91sam9263_matrix.h>
 #include <mach/at91sam9_smc.h>
index 1532b508c8142408d2cb3ba3e33ee3c6fb955a40..0fe1c305e08215e1eb4b3d0089276e58db277b62 100644 (file)
@@ -216,6 +216,12 @@ static struct clk_lookup periph_clocks_lookups[] = {
        CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk),
        CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
        CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
+       /* more usart lookup table for DT entries */
+       CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck),
+       CLKDEV_CON_DEV_ID("usart", "fff8c000.serial", &usart0_clk),
+       CLKDEV_CON_DEV_ID("usart", "fff90000.serial", &usart1_clk),
+       CLKDEV_CON_DEV_ID("usart", "fff94000.serial", &usart2_clk),
+       CLKDEV_CON_DEV_ID("usart", "fff98000.serial", &usart3_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
index 600bffb01edb9b056f0e45cdb0bbf5960f1cea6a..c3dfb1b3b1e3a6032e554c273f05bf81699579a8 100644 (file)
@@ -13,6 +13,7 @@
 #include <asm/mach/map.h>
 
 #include <linux/dma-mapping.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/i2c-gpio.h>
 #include <linux/atmel-mci.h>
@@ -21,7 +22,6 @@
 #include <video/atmel_lcdc.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9g45.h>
 #include <mach/at91sam9g45_matrix.h>
 #include <mach/at91sam9_smc.h>
index aacb19dc9225a7c90554ee6e03e7610d90df57cb..305a851b5bff950f60b374fc5ab709f51bbebdaf 100644 (file)
@@ -10,6 +10,7 @@
 #include <asm/mach/map.h>
 
 #include <linux/dma-mapping.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/i2c-gpio.h>
 
@@ -17,7 +18,6 @@
 #include <video/atmel_lcdc.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9rl.h>
 #include <mach/at91sam9rl_matrix.h>
 #include <mach/at91sam9_smc.h>
index 5aa58851eb394b43c1c0f972465e766d5bab4a38..367d5cd5e36288c1c5395aedc6eaec91e2138ccf 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -34,7 +35,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/cpu.h>
 
 #include "generic.h"
index b0c796d42e495bf1158da2d19fda3c8cb0bf90dc..0487ea10c2d68bce193eb29c83058e34f3d55550 100644 (file)
@@ -25,6 +25,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -43,7 +44,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 
 #include "generic.h"
 
index d1abd5898e85bb53c8f48b9c703f393a9f86776c..747b2eaa9737c134ffcb81006b9b5a807087a3d3 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -38,7 +39,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 
 #include "sam9_smc.h"
index 679b0b743e9277d1e7994c314359f5db6a844603..062670351a6a11b9f82551378cdb00dc2675de44 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -41,7 +42,6 @@
 #include <asm/mach/map.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91cap9_matrix.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/system_rev.h>
index c578c5d9072887334e3a4e354de5d80b0fa18c8d..774c87fcbd5b8f0ee355bf7b9d7c84822eb95ac9 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -35,7 +36,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 
 #include "generic.h"
 
index f4da8a16d5dc14fa0c558bb2b66e2392a2d150e7..fc885a4ce243fbedce8461435cf966c859f68886 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -40,7 +41,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91sam9260_matrix.h>
 
index 2d919f5a4f571cfcfcf884c13d8a4465cfd88e02..d35e65b08ccde481aeac88978fd83d7ca1a329c1 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -36,7 +37,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91rm9200_mc.h>
 #include <mach/cpu.h>
 
index 17654d5e94e6fd3aefe8055227246e9222878c3c..c3936665e6457715dedaccb0a8b0be0e0fc5f936 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -38,7 +39,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 
 #include "generic.h"
 
index 72b55674616c30d0ab08b0f465e5fc891744d94c..586100e2acbbb5b54c3820b0acd34dafc14f23df 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <linux/types.h>
 #include <linux/init.h>
+#include <linux/gpio.h>
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
@@ -35,7 +36,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 
 #include "generic.h"
 
diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c
new file mode 100644 (file)
index 0000000..0b7d327
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ *  Setup code for AT91SAM Evaluation Kits with Device Tree support
+ *
+ *  Covers: * AT91SAM9G45-EKES  board
+ *          * AT91SAM9M10-EKES  board
+ *          * AT91SAM9M10G45-EK board
+ *
+ *  Copyright (C) 2011 Atmel,
+ *                2011 Nicolas Ferre <nicolas.ferre@atmel.com>
+ *
+ * Licensed under GPLv2 or later.
+ */
+
+#include <linux/types.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/gpio.h>
+#include <linux/irqdomain.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+
+#include <mach/hardware.h>
+#include <mach/board.h>
+#include <mach/system_rev.h>
+#include <mach/at91sam9_smc.h>
+
+#include <asm/setup.h>
+#include <asm/irq.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include "sam9_smc.h"
+#include "generic.h"
+
+
+static void __init ek_init_early(void)
+{
+       /* Initialize processor: 12.000 MHz crystal */
+       at91_initialize(12000000);
+
+       /* DGBU on ttyS0. (Rx & Tx only) */
+       at91_register_uart(0, 0, 0);
+
+       /* set serial console to ttyS0 (ie, DBGU) */
+       at91_set_serial_console(0);
+}
+
+/* det_pin is not connected */
+static struct atmel_nand_data __initdata ek_nand_data = {
+       .ale            = 21,
+       .cle            = 22,
+       .rdy_pin        = AT91_PIN_PC8,
+       .enable_pin     = AT91_PIN_PC14,
+};
+
+static struct sam9_smc_config __initdata ek_nand_smc_config = {
+       .ncs_read_setup         = 0,
+       .nrd_setup              = 2,
+       .ncs_write_setup        = 0,
+       .nwe_setup              = 2,
+
+       .ncs_read_pulse         = 4,
+       .nrd_pulse              = 4,
+       .ncs_write_pulse        = 4,
+       .nwe_pulse              = 4,
+
+       .read_cycle             = 7,
+       .write_cycle            = 7,
+
+       .mode                   = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
+       .tdf_cycles             = 3,
+};
+
+static void __init ek_add_device_nand(void)
+{
+       ek_nand_data.bus_width_16 = board_have_nand_16bit();
+       /* setup bus-width (8 or 16) */
+       if (ek_nand_data.bus_width_16)
+               ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
+       else
+               ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
+
+       /* configure chip-select 3 (NAND) */
+       sam9_smc_configure(3, &ek_nand_smc_config);
+
+       at91_add_device_nand(&ek_nand_data);
+}
+
+static const struct of_device_id aic_of_match[] __initconst = {
+       { .compatible = "atmel,at91rm9200-aic", },
+       {},
+};
+
+static void __init at91_dt_init_irq(void)
+{
+       irq_domain_generate_simple(aic_of_match, 0xfffff000, 0);
+       at91_init_irq_default();
+}
+
+static void __init at91_dt_device_init(void)
+{
+       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+
+       /* NAND */
+       ek_add_device_nand();
+}
+
+static const char *at91_dt_board_compat[] __initdata = {
+       "atmel,at91sam9m10g45ek",
+       "calao,usb-a9g20",
+       NULL
+};
+
+DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)")
+       /* Maintainer: Atmel */
+       .timer          = &at91sam926x_timer,
+       .map_io         = at91_map_io,
+       .init_early     = ek_init_early,
+       .init_irq       = at91_dt_init_irq,
+       .init_machine   = at91_dt_device_init,
+       .dt_compat      = at91_dt_board_compat,
+MACHINE_END
index 01170a2766a82e5169b0ef35ae8dacc94867a9ae..45db7a3dbef01b960caa77ff7495a3096a9308bd 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -35,7 +36,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 
 #include "generic.h"
 
index 7c0313c51f2673f8491ebb97e681c1b21a2cef35..2f9c16d29212332f195c85ae7e6e7bc7b3e814c2 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -37,7 +38,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/cpu.h>
 
 #include "generic.h"
index 4a170890b3b1c9976036d4e527c91c9370550ac9..3bae73e636332fc5ccfef18b6e02c09915728b2d 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -34,7 +35,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/cpu.h>
 
 #include "generic.h"
index 9dc8d496ead1bfa6c796c8fc445c23c76f944a28..15a3f1a87ab05f9253dce15afc1bdb4746180665 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -35,7 +36,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/cpu.h>
 #include <mach/at91rm9200_mc.h>
 
index 9bc6ab32e0acd2bb9b7d3f60ebd8c0a77d8980b3..6094496f7edb3344843cc32b88ff28acdbefde97 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -44,7 +45,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 
 #include "sam9_smc.h"
index b7b8390e8a00b732f882fefd3b64673880de285d..0a8fe6a1b7c8a8a606241f46d8a0a2ff133a75e7 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -37,7 +38,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91rm9200_mc.h>
 
 #include "generic.h"
index 81f911033681004be055a80a84ded42874644af5..938cc390bea3099c59f67a8988fc3fddfe7c9925 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -40,7 +41,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 
index 6f08faadb4742b8faef2de1f84e90cb5ca137454..b4ac30e38a9e396102a7a466cd8fb25fc2d05cee 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -39,7 +40,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91rm9200_mc.h>
 
 #include "generic.h"
index 85bcccd7b9e40118b7c8a72eb12c64609d38c287..99fd7f8aee0e0f378583365575d3be4bd9127bfe 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -39,7 +40,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91rm9200_mc.h>
 
 #include "generic.h"
index 4d3a02f1289e87fd9c025170240364d4ef2f7a44..2a21e790250e5bcb9baeb2a0588ce37ed68c526a 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -37,7 +38,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 
 #include "sam9_smc.h"
index 8a50c3e67186f1e8b8d4b0a962ab245aac6d51d6..89c8b579bfda2949cc47c43b7bec46e5bb1efbcc 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -41,7 +42,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 #include <mach/system_rev.h>
index 5096a0ec50c13c8a64ab041b064e960c5f4aa0d4..3741f43cdae908c9fca1836c48215a812bd07555 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -45,7 +46,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 #include <mach/system_rev.h>
index ea8f185d3b9d342b7cdcf19e1c8bff5e54af0574..a580dd451a41549be5dce7ecfa584da7f2ec5081 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -44,7 +45,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 #include <mach/system_rev.h>
index 817f59d7251bcc9dfc8ab9dbae37c18b85f840d2..8d77c2ff96b2bc3351bd3dc0c237e7e8397fa176 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -41,7 +42,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/system_rev.h>
 
index ad234ccbf57e5214d8e0ebb0eec63a00fa80ef68..2d6203ac1a42f87c0bb4b8a3c5774ed7e11e0be1 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -38,7 +39,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 #include <mach/system_rev.h>
index 4f14b54b93a88278bef0ad5ab854d3bd497cce92..39a28effc3df9d2443211e769c7d7de72508957d 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -30,7 +31,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 
index 8c4c1a02c4bebb45e8b11bb22905a744975f0f75..bac9b65cf5518427e32a624f3735f3d2fc26261a 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -40,7 +41,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 
index 25e793782a4e94c3ac49f9f9bc1c3a71a7c60d22..5bd735787d6d6b15c1a7b8a82ab0427f324b1271 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -39,7 +40,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 
index 95edcbd2aec64c0107e8dab5ca233706af65ca76..3c288b396fc4333caca5d1b0710ec9037ffca464 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -43,7 +44,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91rm9200_mc.h>
 #include <mach/cpu.h>
 
index 4615528205c8329522b360b3b95e4fee4e89279c..224e9e2f867453bd85b08b371edf888f961d6e6e 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <linux/clk.h>
 #include <linux/errno.h>
+#include <linux/gpio.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/debugfs.h>
@@ -22,9 +23,6 @@
 
 #include <mach/hardware.h>
 #include <mach/at91_pio.h>
-#include <mach/gpio.h>
-
-#include <asm/gpio.h>
 
 #include "generic.h"
 
index 056dc6674b6bf74c649cabe60204ebbf01ff9a03..2b9a1f51210f0cc048048410bd9e801883e04bc9 100644 (file)
@@ -214,11 +214,6 @@ extern void at91_gpio_resume(void);
  */
 
 #include <asm/errno.h>
-#include <asm-generic/gpio.h>          /* cansleep wrappers */
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
 
 #define gpio_to_irq(gpio) (gpio)
 #define irq_to_gpio(irq)  (irq)
index 0415a839e1ad9319944a662b409799015f9fde3d..8dfafe76ffe6298f822ad2b4d3ea64ebf0243337 100644 (file)
@@ -9,13 +9,13 @@
  * 2 of the License, or (at your option) any later version.
 */
 
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 
 
 /* ------------------------------------------------------------------------- */
index 4159eca78945360b8b9a4fc5630ba5ddab7e07a8..7046158109d7cd581776466798becc3abbe83f47 100644 (file)
@@ -10,6 +10,7 @@
  * (at your option) any later version.
  */
 
+#include <linux/gpio.h>
 #include <linux/suspend.h>
 #include <linux/sched.h>
 #include <linux/proc_fs.h>
@@ -25,7 +26,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/at91_pmc.h>
-#include <mach/gpio.h>
 #include <mach/cpu.h>
 
 #include "generic.h"
index 0b87a1ca2bb3a187c78a6b20b68f7c8bb66c2288..495e31306fc00a213f3084daf20894bfa94c53bd 100644 (file)
@@ -5,7 +5,7 @@
 
 # Common objects
 obj-y                  := time.o clock.o serial.o io.o psc.o \
-                          gpio.o dma.o usb.o common.o sram.o aemif.o
+                          dma.o usb.o common.o sram.o aemif.o
 
 obj-$(CONFIG_DAVINCI_MUX)              += mux.o
 
@@ -17,7 +17,6 @@ obj-$(CONFIG_ARCH_DAVINCI_DM365)      += dm365.o devices.o
 obj-$(CONFIG_ARCH_DAVINCI_DA830)        += da830.o devices-da8xx.o
 obj-$(CONFIG_ARCH_DAVINCI_DA850)        += da850.o devices-da8xx.o
 obj-$(CONFIG_ARCH_DAVINCI_TNETV107X)    += tnetv107x.o devices-tnetv107x.o
-obj-$(CONFIG_ARCH_DAVINCI_TNETV107X)    += gpio-tnetv107x.o
 
 obj-$(CONFIG_AINTC)                    += irq.o
 obj-$(CONFIG_CP_INTC)                  += cp_intc.o
index 2ed2f822fc40ca1e79448038c279b3910fe14ab7..a6bf5dcaef1341863d614412fe3bc29275f44a47 100644 (file)
@@ -8,6 +8,7 @@
  * is licensed "as is" without any warranty of any kind, whether express
  * or implied.
  */
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/clk.h>
 
@@ -19,7 +20,7 @@
 #include <mach/common.h>
 #include <mach/time.h>
 #include <mach/da8xx.h>
-#include <mach/gpio.h>
+#include <mach/gpio-davinci.h>
 
 #include "clock.h"
 #include "mux.h"
index 935dbed5c541ccea2e1d4bbe5e059dfd6295ac03..4aae01576aaba3bdfa667e2ee63db759933b3f64 100644 (file)
@@ -11,6 +11,7 @@
  * is licensed "as is" without any warranty of any kind, whether express
  * or implied.
  */
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/clk.h>
 #include <linux/platform_device.h>
@@ -27,7 +28,7 @@
 #include <mach/da8xx.h>
 #include <mach/cpufreq.h>
 #include <mach/pm.h>
-#include <mach/gpio.h>
+#include <mach/gpio-davinci.h>
 
 #include "clock.h"
 #include "mux.h"
index a3a94e9c93784b10a6d98c3b379a680def7641e2..c143f43addccc2590f5f7cc384ab487425312459 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/serial_8250.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
-#include <linux/gpio.h>
 
 #include <linux/spi/spi.h>
 
@@ -30,6 +29,7 @@
 #include <mach/common.h>
 #include <mach/asp.h>
 #include <mach/spi.h>
+#include <mach/gpio-davinci.h>
 
 #include "clock.h"
 #include "mux.h"
index 4604e72d7d9947bce4263d7c52b72e66e7620018..679e168dce34e55f4c711d12c01eab4300174bac 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/serial_8250.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
-#include <linux/gpio.h>
 #include <linux/spi/spi.h>
 
 #include <asm/mach/map.h>
@@ -34,7 +33,7 @@
 #include <mach/asp.h>
 #include <mach/keyscan.h>
 #include <mach/spi.h>
-
+#include <mach/gpio-davinci.h>
 
 #include "clock.h"
 #include "mux.h"
index 4c82c2716293a6e750f242c128fb14e66c2ce636..9a274665edc520527476fd6cb1425b7dbb8f485c 100644 (file)
@@ -12,7 +12,6 @@
 #include <linux/clk.h>
 #include <linux/serial_8250.h>
 #include <linux/platform_device.h>
-#include <linux/gpio.h>
 
 #include <asm/mach/map.h>
 
@@ -26,6 +25,7 @@
 #include <mach/serial.h>
 #include <mach/common.h>
 #include <mach/asp.h>
+#include <mach/gpio-davinci.h>
 
 #include "clock.h"
 #include "mux.h"
index 1802e711a2b8f7218131613365f19e4361ff04e2..03e5f4931b423d4612c4f479d1f2cfe2df5acc51 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/clk.h>
 #include <linux/serial_8250.h>
 #include <linux/platform_device.h>
-#include <linux/gpio.h>
 
 #include <asm/mach/map.h>
 
@@ -27,6 +26,7 @@
 #include <mach/serial.h>
 #include <mach/common.h>
 #include <mach/asp.h>
+#include <mach/gpio-davinci.h>
 
 #include "clock.h"
 #include "mux.h"
diff --git a/arch/arm/mach-davinci/include/mach/gpio-davinci.h b/arch/arm/mach-davinci/include/mach/gpio-davinci.h
new file mode 100644 (file)
index 0000000..1fdd1fd
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * TI DaVinci GPIO Support
+ *
+ * Copyright (c) 2006 David Brownell
+ * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef        __DAVINCI_DAVINCI_GPIO_H
+#define        __DAVINCI_DAVINCI_GPIO_H
+
+#include <linux/io.h>
+#include <linux/spinlock.h>
+
+#include <asm-generic/gpio.h>
+
+#include <mach/irqs.h>
+#include <mach/common.h>
+
+#define DAVINCI_GPIO_BASE 0x01C67000
+
+enum davinci_gpio_type {
+       GPIO_TYPE_DAVINCI = 0,
+       GPIO_TYPE_TNETV107X,
+};
+
+/*
+ * basic gpio routines
+ *
+ * board-specific init should be done by arch/.../.../board-XXX.c (maybe
+ * initializing banks together) rather than boot loaders; kexec() won't
+ * go through boot loaders.
+ *
+ * the gpio clock will be turned on when gpios are used, and you may also
+ * need to pay attention to PINMUX registers to be sure those pins are
+ * used as gpios, not with other peripherals.
+ *
+ * On-chip GPIOs are numbered 0..(DAVINCI_N_GPIO-1).  For documentation,
+ * and maybe for later updates, code may write GPIO(N).  These may be
+ * all 1.8V signals, all 3.3V ones, or a mix of the two.  A given chip
+ * may not support all the GPIOs in that range.
+ *
+ * GPIOs can also be on external chips, numbered after the ones built-in
+ * to the DaVinci chip.  For now, they won't be usable as IRQ sources.
+ */
+#define        GPIO(X)         (X)             /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
+
+/* Convert GPIO signal to GPIO pin number */
+#define GPIO_TO_PIN(bank, gpio)        (16 * (bank) + (gpio))
+
+struct davinci_gpio_controller {
+       struct gpio_chip        chip;
+       int                     irq_base;
+       spinlock_t              lock;
+       void __iomem            *regs;
+       void __iomem            *set_data;
+       void __iomem            *clr_data;
+       void __iomem            *in_data;
+};
+
+/* The __gpio_to_controller() and __gpio_mask() functions inline to constants
+ * with constant parameters; or in outlined code they execute at runtime.
+ *
+ * You'd access the controller directly when reading or writing more than
+ * one gpio value at a time, and to support wired logic where the value
+ * being driven by the cpu need not match the value read back.
+ *
+ * These are NOT part of the cross-platform GPIO interface
+ */
+static inline struct davinci_gpio_controller *
+__gpio_to_controller(unsigned gpio)
+{
+       struct davinci_gpio_controller *ctlrs = davinci_soc_info.gpio_ctlrs;
+       int index = gpio / 32;
+
+       if (!ctlrs || index >= davinci_soc_info.gpio_ctlrs_num)
+               return NULL;
+
+       return ctlrs + index;
+}
+
+static inline u32 __gpio_mask(unsigned gpio)
+{
+       return 1 << (gpio % 32);
+}
+
+#endif /* __DAVINCI_DAVINCI_GPIO_H */
index fbece126c2bf2f451a5983207273525be2a9d12a..fbaae4772b91c6237b2a1499b28af7a79eb2de19 100644 (file)
 #ifndef        __DAVINCI_GPIO_H
 #define        __DAVINCI_GPIO_H
 
-#include <linux/io.h>
-#include <linux/spinlock.h>
-
 #include <asm-generic/gpio.h>
 
-#include <mach/irqs.h>
-#include <mach/common.h>
-
-#define DAVINCI_GPIO_BASE 0x01C67000
-
-enum davinci_gpio_type {
-       GPIO_TYPE_DAVINCI = 0,
-       GPIO_TYPE_TNETV107X,
-};
-
-/*
- * basic gpio routines
- *
- * board-specific init should be done by arch/.../.../board-XXX.c (maybe
- * initializing banks together) rather than boot loaders; kexec() won't
- * go through boot loaders.
- *
- * the gpio clock will be turned on when gpios are used, and you may also
- * need to pay attention to PINMUX registers to be sure those pins are
- * used as gpios, not with other peripherals.
- *
- * On-chip GPIOs are numbered 0..(DAVINCI_N_GPIO-1).  For documentation,
- * and maybe for later updates, code may write GPIO(N).  These may be
- * all 1.8V signals, all 3.3V ones, or a mix of the two.  A given chip
- * may not support all the GPIOs in that range.
- *
- * GPIOs can also be on external chips, numbered after the ones built-in
- * to the DaVinci chip.  For now, they won't be usable as IRQ sources.
- */
-#define        GPIO(X)         (X)             /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
-
-/* Convert GPIO signal to GPIO pin number */
-#define GPIO_TO_PIN(bank, gpio)        (16 * (bank) + (gpio))
-
-struct davinci_gpio_controller {
-       struct gpio_chip        chip;
-       int                     irq_base;
-       spinlock_t              lock;
-       void __iomem            *regs;
-       void __iomem            *set_data;
-       void __iomem            *clr_data;
-       void __iomem            *in_data;
-};
-
-/* The __gpio_to_controller() and __gpio_mask() functions inline to constants
- * with constant parameters; or in outlined code they execute at runtime.
- *
- * You'd access the controller directly when reading or writing more than
- * one gpio value at a time, and to support wired logic where the value
- * being driven by the cpu need not match the value read back.
- *
- * These are NOT part of the cross-platform GPIO interface
- */
-static inline struct davinci_gpio_controller *
-__gpio_to_controller(unsigned gpio)
-{
-       struct davinci_gpio_controller *ctlrs = davinci_soc_info.gpio_ctlrs;
-       int index = gpio / 32;
-
-       if (!ctlrs || index >= davinci_soc_info.gpio_ctlrs_num)
-               return NULL;
-
-       return ctlrs + index;
-}
-
-static inline u32 __gpio_mask(unsigned gpio)
-{
-       return 1 << (gpio % 32);
-}
+/* The inline versions use the static inlines in the driver header */
+#include "gpio-davinci.h"
 
 /*
  * The get/set/clear functions will inline when called with constant
@@ -147,11 +77,6 @@ static inline int gpio_cansleep(unsigned gpio)
                return __gpio_cansleep(gpio);
 }
 
-static inline int gpio_to_irq(unsigned gpio)
-{
-       return __gpio_to_irq(gpio);
-}
-
 static inline int irq_to_gpio(unsigned irq)
 {
        /* don't support the reverse mapping */
index 1b28fdd892a64aac8a1f7a430982d36104aa433f..409bb869c7c766c071bf9838375b2df1410b14f3 100644 (file)
@@ -12,6 +12,7 @@
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/clk.h>
@@ -27,9 +28,9 @@
 #include <mach/psc.h>
 #include <mach/cp_intc.h>
 #include <mach/irqs.h>
-#include <mach/gpio.h>
 #include <mach/hardware.h>
 #include <mach/tnetv107x.h>
+#include <mach/gpio-davinci.h>
 
 #include "clock.h"
 #include "mux.h"
index f68daa632af02e8a0bd2b6bbda06b58e100cbf6e..44679db672fbf54b1a55adc0304593e458545ef5 100644 (file)
@@ -13,8 +13,6 @@
 #ifndef __ASM_ARM_ARCH_IO_H
 #define __ASM_ARM_ARCH_IO_H
 
-#define IO_SPACE_LIMIT 0xffff
-
 u8 __inb8(unsigned int port);
 void __outb8(u8  val, unsigned int port);
 
index c60f081e930bb8cea0567ad9675008c1add1a49f..94c78bc662753d54e18a4f819d9992fa2763fd66 100644 (file)
@@ -38,6 +38,7 @@
 #include <mach/fb.h>
 #include <mach/ep93xx_keypad.h>
 #include <mach/ep93xx_spi.h>
+#include <mach/gpio-ep93xx.h>
 
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
index 257175edc5753bac9a7d064b33135dc2c8a7b7c0..c63a5ec1a8e30ac0ce67d85a53c83e9a0064e339 100644 (file)
@@ -37,6 +37,7 @@
 #include <mach/hardware.h>
 #include <mach/fb.h>
 #include <mach/ep93xx_spi.h>
+#include <mach/gpio-ep93xx.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
similarity index 87%
rename from arch/arm/mach-ep93xx/include/mach/gpio.h
rename to arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h
index c57152c231f16a474442c0d65cefc2e9de8342cb..8aff2ea35877876bfb99e31f433df5bc867e3cb3 100644 (file)
@@ -1,9 +1,7 @@
-/*
- * arch/arm/mach-ep93xx/include/mach/gpio.h
- */
+/* Include file for the EP93XX GPIO controller machine specifics */
 
-#ifndef __ASM_ARCH_GPIO_H
-#define __ASM_ARCH_GPIO_H
+#ifndef __GPIO_EP93XX_H
+#define __GPIO_EP93XX_H
 
 /* GPIO port A.  */
 #define EP93XX_GPIO_LINE_A(x)          ((x) + 0)
 /* maximum value for irq capable line identifiers */
 #define EP93XX_GPIO_LINE_MAX_IRQ       EP93XX_GPIO_LINE_F(7)
 
-/* new generic GPIO API - see Documentation/gpio.txt */
-
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-
-/*
- * Map GPIO A0..A7  (0..7)  to irq 64..71,
- *          B0..B7  (7..15) to irq 72..79, and
- *          F0..F7 (16..24) to irq 80..87.
- */
-#define gpio_to_irq(gpio)      \
-       (((gpio) <= EP93XX_GPIO_LINE_MAX_IRQ) ? (64 + (gpio)) : -EINVAL)
-
-#define irq_to_gpio(irq)       ((irq) - gpio_to_irq(0))
-
-#endif
+#endif /* __GPIO_EP93XX_H */
index 238bc603da86c48750330964c35dfd802dc9b641..d6f286b4db9c1035247b5f0a878d573120c62a00 100644 (file)
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/gpio.h>
 #include <linux/i2c.h>
 #include <linux/i2c-gpio.h>
 
 #include <mach/hardware.h>
 #include <mach/fb.h>
+#include <mach/gpio-ep93xx.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index 3bdf3a2e5ad033796e86935f34dac9f05c921bd1..2b4d4b0201dfbaecd8c6fa3fe656124bdf274fd6 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
-#include <linux/gpio.h>
 #include <linux/i2c.h>
 #include <linux/i2c-gpio.h>
 #include <linux/fb.h>
@@ -30,6 +29,7 @@
 
 #include <mach/hardware.h>
 #include <mach/fb.h>
+#include <mach/gpio-ep93xx.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index be9266b10fdb66b2a5e0deb6896e8d1b50328fcc..80523ca9bb49b87030220b9725e3c58b4922ed53 100644 (file)
 #ifndef __ASM_ARCH_GPIO_H
 #define __ASM_ARCH_GPIO_H __FILE__
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
-
 /* Practically, GPIO banks up to GPZ are the configurable gpio banks */
 
 /* GPIO bank sizes */
@@ -151,6 +146,4 @@ enum s5p_gpio_number {
 #define ARCH_NR_GPIOS          (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) +       \
                                 CONFIG_SAMSUNG_GPIO_EXTRA + 1)
 
-#include <asm-generic/gpio.h>
-
 #endif /* __ASM_ARCH_GPIO_H */
index 32e4cc397c28c07f45bdd957a6236e6953ca4188..15a70396c27d41f123910fdd9cd7844d2d2cf033 100644 (file)
@@ -23,8 +23,6 @@
 #define PCIO_SIZE       0x00100000
 #define PCIO_BASE       MMU_IO(0xff000000, 0x7c000000)
 
-#define IO_SPACE_LIMIT 0xffff
-
 /*
  * Translation of various region addresses to virtual addresses
  */
index 3bc2c70f298934a85bcb10b858e5e90e758ceb16..40a0527bada7a969d1bb366fe5bf7e150ace2256 100644 (file)
 #define __MACH_GPIO_H__
 
 #include <mach/irqs.h>
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
 
 #define gpio_to_irq(x) ((x) + GPIO_IRQ_BASE)
 #define irq_to_gpio(x) ((x) - GPIO_IRQ_BASE)
diff --git a/arch/arm/mach-highbank/Makefile b/arch/arm/mach-highbank/Makefile
new file mode 100644 (file)
index 0000000..986958a
--- /dev/null
@@ -0,0 +1,6 @@
+obj-y                                  := clock.o highbank.o system.o
+obj-$(CONFIG_DEBUG_HIGHBANK_UART)      += lluart.o
+obj-$(CONFIG_SMP)                      += platsmp.o
+obj-$(CONFIG_LOCAL_TIMERS)             += localtimer.o
+obj-$(CONFIG_HOTPLUG_CPU)              += hotplug.o
+obj-$(CONFIG_PM_SLEEP)                 += pm.o
diff --git a/arch/arm/mach-highbank/Makefile.boot b/arch/arm/mach-highbank/Makefile.boot
new file mode 100644 (file)
index 0000000..dae9661
--- /dev/null
@@ -0,0 +1 @@
+zreladdr-y     := 0x00008000
diff --git a/arch/arm/mach-highbank/clock.c b/arch/arm/mach-highbank/clock.c
new file mode 100644 (file)
index 0000000..c25a2ae
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2011 Calxeda, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/clk.h>
+#include <linux/clkdev.h>
+
+struct clk {
+       unsigned long rate;
+};
+
+int clk_enable(struct clk *clk)
+{
+       return 0;
+}
+
+void clk_disable(struct clk *clk)
+{}
+
+unsigned long clk_get_rate(struct clk *clk)
+{
+       return clk->rate;
+}
+
+long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+       return clk->rate;
+}
+
+int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+       return 0;
+}
+
+static struct clk eclk = { .rate = 200000000 };
+static struct clk pclk = { .rate = 150000000 };
+
+static struct clk_lookup lookups[] = {
+       { .clk = &pclk, .con_id = "apb_pclk", },
+       { .clk = &pclk, .dev_id = "sp804", },
+       { .clk = &eclk, .dev_id = "ffe0e000.sdhci", },
+       { .clk = &pclk, .dev_id = "fff36000.serial", },
+};
+
+void __init highbank_clocks_init(void)
+{
+       clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+}
diff --git a/arch/arm/mach-highbank/core.h b/arch/arm/mach-highbank/core.h
new file mode 100644 (file)
index 0000000..7e33fc9
--- /dev/null
@@ -0,0 +1,9 @@
+extern void highbank_set_cpu_jump(int cpu, void *jump_addr);
+extern void highbank_clocks_init(void);
+extern void __iomem *scu_base_addr;
+#ifdef CONFIG_DEBUG_HIGHBANK_UART
+extern void highbank_lluart_map_io(void);
+#else
+static inline void highbank_lluart_map_io(void) {}
+#endif
+
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
new file mode 100644 (file)
index 0000000..b82dcf0
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2010-2011 Calxeda, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include <linux/clk.h>
+#include <linux/clkdev.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <linux/of_address.h>
+
+#include <asm/cacheflush.h>
+#include <asm/unified.h>
+#include <asm/smp_scu.h>
+#include <asm/hardware/arm_timer.h>
+#include <asm/hardware/timer-sp.h>
+#include <asm/hardware/gic.h>
+#include <asm/hardware/cache-l2x0.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/time.h>
+#include <mach/irqs.h>
+
+#include "core.h"
+#include "sysregs.h"
+
+void __iomem *sregs_base;
+
+#define HB_SCU_VIRT_BASE       0xfee00000
+void __iomem *scu_base_addr = ((void __iomem *)(HB_SCU_VIRT_BASE));
+
+static struct map_desc scu_io_desc __initdata = {
+       .virtual        = HB_SCU_VIRT_BASE,
+       .pfn            = 0, /* run-time */
+       .length         = SZ_4K,
+       .type           = MT_DEVICE,
+};
+
+static void __init highbank_scu_map_io(void)
+{
+       unsigned long base;
+
+       /* Get SCU base */
+       asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (base));
+
+       scu_io_desc.pfn = __phys_to_pfn(base);
+       iotable_init(&scu_io_desc, 1);
+}
+
+static void __init highbank_map_io(void)
+{
+       highbank_scu_map_io();
+       highbank_lluart_map_io();
+}
+
+#define HB_JUMP_TABLE_PHYS(cpu)                (0x40 + (0x10 * (cpu)))
+#define HB_JUMP_TABLE_VIRT(cpu)                phys_to_virt(HB_JUMP_TABLE_PHYS(cpu))
+
+void highbank_set_cpu_jump(int cpu, void *jump_addr)
+{
+       writel(BSYM(virt_to_phys(jump_addr)), HB_JUMP_TABLE_VIRT(cpu));
+       __cpuc_flush_dcache_area(HB_JUMP_TABLE_VIRT(cpu), 16);
+       outer_clean_range(HB_JUMP_TABLE_PHYS(cpu),
+                         HB_JUMP_TABLE_PHYS(cpu) + 15);
+}
+
+const static struct of_device_id irq_match[] = {
+       { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
+       {}
+};
+
+static void __init highbank_init_irq(void)
+{
+       of_irq_init(irq_match);
+       l2x0_of_init(0, ~0UL);
+}
+
+static void __init highbank_timer_init(void)
+{
+       int irq;
+       struct device_node *np;
+       void __iomem *timer_base;
+
+       /* Map system registers */
+       np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
+       sregs_base = of_iomap(np, 0);
+       WARN_ON(!sregs_base);
+
+       np = of_find_compatible_node(NULL, NULL, "arm,sp804");
+       timer_base = of_iomap(np, 0);
+       WARN_ON(!timer_base);
+       irq = irq_of_parse_and_map(np, 0);
+
+       highbank_clocks_init();
+
+       sp804_clocksource_init(timer_base + 0x20, "timer1");
+       sp804_clockevents_init(timer_base, irq, "timer0");
+}
+
+static struct sys_timer highbank_timer = {
+       .init = highbank_timer_init,
+};
+
+static void highbank_power_off(void)
+{
+       hignbank_set_pwr_shutdown();
+       scu_power_mode(scu_base_addr, SCU_PM_POWEROFF);
+
+       while (1)
+               cpu_do_idle();
+}
+
+static void __init highbank_init(void)
+{
+       pm_power_off = highbank_power_off;
+
+       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char *highbank_match[] __initconst = {
+       "calxeda,highbank",
+       NULL,
+};
+
+DT_MACHINE_START(HIGHBANK, "Highbank")
+       .map_io         = highbank_map_io,
+       .init_irq       = highbank_init_irq,
+       .timer          = &highbank_timer,
+       .init_machine   = highbank_init,
+       .dt_compat      = highbank_match,
+MACHINE_END
diff --git a/arch/arm/mach-highbank/hotplug.c b/arch/arm/mach-highbank/hotplug.c
new file mode 100644 (file)
index 0000000..977cebb
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2011 Calxeda, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/smp.h>
+
+#include <asm/smp_scu.h>
+#include <asm/cacheflush.h>
+
+#include "core.h"
+
+extern void secondary_startup(void);
+
+int platform_cpu_kill(unsigned int cpu)
+{
+       return 1;
+}
+
+/*
+ * platform-specific code to shutdown a CPU
+ *
+ */
+void platform_cpu_die(unsigned int cpu)
+{
+       flush_cache_all();
+
+       highbank_set_cpu_jump(cpu, secondary_startup);
+       scu_power_mode(scu_base_addr, SCU_PM_POWEROFF);
+
+       cpu_do_idle();
+
+       /* We should never return from idle */
+       panic("highbank: cpu %d unexpectedly exit from shutdown\n", cpu);
+}
+
+int platform_cpu_disable(unsigned int cpu)
+{
+       /*
+        * CPU0 should not be shut down via hotplug.  cpu_idle can WFI
+        * or a proper shutdown or hibernate should be used.
+        */
+       return cpu == 0 ? -EPERM : 0;
+}
diff --git a/arch/arm/mach-highbank/include/mach/debug-macro.S b/arch/arm/mach-highbank/include/mach/debug-macro.S
new file mode 100644 (file)
index 0000000..cb57fe5
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Debugging macro include header
+ *
+ *  Copyright (C) 1994-1999 Russell King
+ *  Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
+ *
+ * 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.
+ */
+
+               .macro  addruart,rp,rv,tmp
+               movw    \rv, #0x6000
+               movt    \rv, #0xfee3
+               movw    \rp, #0x6000
+               movt    \rp, #0xfff3
+               .endm
+
+#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-highbank/include/mach/entry-macro.S b/arch/arm/mach-highbank/include/mach/entry-macro.S
new file mode 100644 (file)
index 0000000..73c1129
--- /dev/null
@@ -0,0 +1,7 @@
+#include <asm/hardware/entry-macro-gic.S>
+
+       .macro  disable_fiq
+       .endm
+
+       .macro  arch_ret_to_user, tmp1, tmp2
+       .endm
diff --git a/arch/arm/mach-highbank/include/mach/gpio.h b/arch/arm/mach-highbank/include/mach/gpio.h
new file mode 100644 (file)
index 0000000..40a8c17
--- /dev/null
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/arm/mach-highbank/include/mach/io.h b/arch/arm/mach-highbank/include/mach/io.h
new file mode 100644 (file)
index 0000000..70cfa3b
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __MACH_IO_H
+#define __MACH_IO_H
+
+#define __io(a)                ({ (void)(a); __typesafe_io(0); })
+#define __mem_pci(a)   (a)
+
+#endif
diff --git a/arch/arm/mach-highbank/include/mach/irqs.h b/arch/arm/mach-highbank/include/mach/irqs.h
new file mode 100644 (file)
index 0000000..9746aab
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef __MACH_IRQS_H
+#define __MACH_IRQS_H
+
+#define NR_IRQS                        192
+
+#endif
diff --git a/arch/arm/mach-highbank/include/mach/memory.h b/arch/arm/mach-highbank/include/mach/memory.h
new file mode 100644 (file)
index 0000000..40a8c17
--- /dev/null
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/arm/mach-highbank/include/mach/system.h b/arch/arm/mach-highbank/include/mach/system.h
new file mode 100644 (file)
index 0000000..7e81922
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2010-2011 Calxeda, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef __MACH_SYSTEM_H
+#define __MACH_SYSTEM_H
+
+static inline void arch_idle(void)
+{
+       cpu_do_idle();
+}
+
+extern void arch_reset(char mode, const char *cmd);
+
+#endif
diff --git a/arch/arm/mach-highbank/include/mach/timex.h b/arch/arm/mach-highbank/include/mach/timex.h
new file mode 100644 (file)
index 0000000..88dac7a
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef __MACH_TIMEX_H
+#define __MACH_TIMEX_H
+
+#define CLOCK_TICK_RATE                1000000
+
+#endif
diff --git a/arch/arm/mach-highbank/include/mach/uncompress.h b/arch/arm/mach-highbank/include/mach/uncompress.h
new file mode 100644 (file)
index 0000000..bbe20e6
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __MACH_UNCOMPRESS_H
+#define __MACH_UNCOMPRESS_H
+
+#define putc(c)
+#define flush()
+#define arch_decomp_setup()
+#define arch_decomp_wdog()
+
+#endif
diff --git a/arch/arm/mach-highbank/include/mach/vmalloc.h b/arch/arm/mach-highbank/include/mach/vmalloc.h
new file mode 100644 (file)
index 0000000..1969e95
--- /dev/null
@@ -0,0 +1 @@
+#define VMALLOC_END            0xFEE00000UL
diff --git a/arch/arm/mach-highbank/lluart.c b/arch/arm/mach-highbank/lluart.c
new file mode 100644 (file)
index 0000000..3715750
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2011 Calxeda, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include <linux/init.h>
+#include <asm/page.h>
+#include <asm/sizes.h>
+#include <asm/mach/map.h>
+
+#define HB_DEBUG_LL_PHYS_BASE  0xfff36000
+#define HB_DEBUG_LL_VIRT_BASE  0xfee36000
+
+static struct map_desc lluart_io_desc __initdata = {
+       .virtual        = HB_DEBUG_LL_VIRT_BASE,
+       .pfn            = __phys_to_pfn(HB_DEBUG_LL_PHYS_BASE),
+       .length         = SZ_4K,
+       .type           = MT_DEVICE,
+};
+
+void __init highbank_lluart_map_io(void)
+{
+       iotable_init(&lluart_io_desc, 1);
+}
diff --git a/arch/arm/mach-highbank/localtimer.c b/arch/arm/mach-highbank/localtimer.c
new file mode 100644 (file)
index 0000000..5a00e79
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2010-2011 Calxeda, Inc.
+ * Based on localtimer.c, Copyright (C) 2002 ARM Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include <linux/init.h>
+#include <linux/clockchips.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+
+#include <asm/smp_twd.h>
+
+/*
+ * Setup the local clock events for a CPU.
+ */
+int __cpuinit local_timer_setup(struct clock_event_device *evt)
+{
+       struct device_node *np;
+
+       np = of_find_compatible_node(NULL, NULL, "arm,smp-twd");
+       if (!twd_base) {
+               twd_base = of_iomap(np, 0);
+               WARN_ON(!twd_base);
+       }
+       evt->irq = irq_of_parse_and_map(np, 0);
+       twd_timer_setup(evt);
+       return 0;
+}
diff --git a/arch/arm/mach-highbank/platsmp.c b/arch/arm/mach-highbank/platsmp.c
new file mode 100644 (file)
index 0000000..d01364c
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2010-2011 Calxeda, Inc.
+ * Based on platsmp.c, Copyright (C) 2002 ARM Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <linux/io.h>
+
+#include <asm/smp_scu.h>
+#include <asm/hardware/gic.h>
+
+#include "core.h"
+
+extern void secondary_startup(void);
+
+void __cpuinit platform_secondary_init(unsigned int cpu)
+{
+       gic_secondary_init(0);
+}
+
+int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+       gic_raise_softirq(cpumask_of(cpu), 0);
+       return 0;
+}
+
+/*
+ * Initialise the CPU possible map early - this describes the CPUs
+ * which may be present or become present in the system.
+ */
+void __init smp_init_cpus(void)
+{
+       unsigned int i, ncores;
+
+       ncores = scu_get_core_count(scu_base_addr);
+
+       /* sanity check */
+       if (ncores > NR_CPUS) {
+               printk(KERN_WARNING
+                      "highbank: no. of cores (%d) greater than configured "
+                      "maximum of %d - clipping\n",
+                      ncores, NR_CPUS);
+               ncores = NR_CPUS;
+       }
+
+       for (i = 0; i < ncores; i++)
+               set_cpu_possible(i, true);
+
+       set_smp_cross_call(gic_raise_softirq);
+}
+
+void __init platform_smp_prepare_cpus(unsigned int max_cpus)
+{
+       int i;
+
+       scu_enable(scu_base_addr);
+
+       /*
+        * Write the address of secondary startup into the jump table
+        * The cores are in wfi and wait until they receive a soft interrupt
+        * and a non-zero value to jump to. Then the secondary CPU branches
+        * to this address.
+        */
+       for (i = 1; i < max_cpus; i++)
+               highbank_set_cpu_jump(i, secondary_startup);
+}
diff --git a/arch/arm/mach-highbank/pm.c b/arch/arm/mach-highbank/pm.c
new file mode 100644 (file)
index 0000000..33b3beb
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2011 Calxeda, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/suspend.h>
+
+#include <asm/proc-fns.h>
+#include <asm/smp_scu.h>
+#include <asm/suspend.h>
+
+#include "core.h"
+#include "sysregs.h"
+
+static int highbank_suspend_finish(unsigned long val)
+{
+       cpu_do_idle();
+       return 0;
+}
+
+static int highbank_pm_enter(suspend_state_t state)
+{
+       hignbank_set_pwr_suspend();
+       highbank_set_cpu_jump(0, cpu_resume);
+
+       scu_power_mode(scu_base_addr, SCU_PM_POWEROFF);
+       cpu_suspend(0, highbank_suspend_finish);
+
+       return 0;
+}
+
+static const struct platform_suspend_ops highbank_pm_ops = {
+       .enter = highbank_pm_enter,
+       .valid = suspend_valid_only_mem,
+};
+
+static int __init highbank_pm_init(void)
+{
+       suspend_set_ops(&highbank_pm_ops);
+       return 0;
+}
+module_init(highbank_pm_init);
diff --git a/arch/arm/mach-highbank/sysregs.h b/arch/arm/mach-highbank/sysregs.h
new file mode 100644 (file)
index 0000000..0e91338
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2011 Calxeda, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _MACH_HIGHBANK__SYSREGS_H_
+#define _MACH_HIGHBANK__SYSREGS_H_
+
+#include <linux/io.h>
+
+extern void __iomem *sregs_base;
+
+#define HB_SREG_A9_PWR_REQ             0xf00
+#define HB_SREG_A9_BOOT_STAT           0xf04
+#define HB_SREG_A9_BOOT_DATA           0xf08
+
+#define HB_PWR_SUSPEND                 0
+#define HB_PWR_SOFT_RESET              1
+#define HB_PWR_HARD_RESET              2
+#define HB_PWR_SHUTDOWN                        3
+
+static inline void hignbank_set_pwr_suspend(void)
+{
+       writel(HB_PWR_SUSPEND, sregs_base + HB_SREG_A9_PWR_REQ);
+}
+
+static inline void hignbank_set_pwr_shutdown(void)
+{
+       writel(HB_PWR_SHUTDOWN, sregs_base + HB_SREG_A9_PWR_REQ);
+}
+
+static inline void hignbank_set_pwr_soft_reset(void)
+{
+       writel(HB_PWR_SOFT_RESET, sregs_base + HB_SREG_A9_PWR_REQ);
+}
+
+static inline void hignbank_set_pwr_hard_reset(void)
+{
+       writel(HB_PWR_HARD_RESET, sregs_base + HB_SREG_A9_PWR_REQ);
+}
+
+#endif
diff --git a/arch/arm/mach-highbank/system.c b/arch/arm/mach-highbank/system.c
new file mode 100644 (file)
index 0000000..53f0c4c
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2011 Calxeda, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include <linux/io.h>
+#include <asm/smp_scu.h>
+#include <asm/proc-fns.h>
+
+#include "core.h"
+#include "sysregs.h"
+
+void arch_reset(char mode, const char *cmd)
+{
+       if (mode == 'h')
+               hignbank_set_pwr_hard_reset();
+       else
+               hignbank_set_pwr_soft_reset();
+
+       scu_power_mode(scu_base_addr, SCU_PM_POWEROFF);
+       cpu_do_idle();
+}
+
index cf8f8099ebd78abb3b92676b170fa0df81874005..82bd4403b450a915ac2a8b83a627ddf00642a6fa 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA 02110-1301, USA.
  */
-
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <mach/hardware.h>
-#include <mach/gpio.h>
 #include <mach/iomux-mx3.h>
 
 /*
index e75f3914784507b94f4f620f9492b87fce100683..74dd5731eb61547e8e0e79bccaeb9f4849cada7e 100644 (file)
@@ -13,7 +13,7 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
-
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
@@ -27,7 +27,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
-#include <mach/gpio.h>
 #include <mach/iomux-mx27.h>
 
 #include "devices-imx27.h"
index f21bb5493dd99ad293bddf5326fc4469dc930524..37beed3fa3ed38a811faea3e96886f046abef737 100644 (file)
@@ -20,8 +20,6 @@
 #ifndef __ASM_ARM_ARCH_IO_H
 #define __ASM_ARM_ARCH_IO_H
 
-#define IO_SPACE_LIMIT 0xffff
-
 /*
  * WARNING: this has to mirror definitions in platform.h
  */
index 4068166c899384903206e2f4325049639712a480..59a512672bb9de9035b6e695c7e1e914bc7eb3c4 100644 (file)
@@ -13,7 +13,7 @@
  * License version 2. This program is licensed "as is" without any 
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
@@ -39,7 +39,7 @@
 #include <asm/mach/time.h>
 #include <asm/mach/irq.h>
 
-#include <mach/gpio.h>
+#include <mach/gpio-ixp2000.h>
 
 static DEFINE_SPINLOCK(ixp2000_slowport_lock);
 static unsigned long ixp2000_slowport_irq_flags;
similarity index 95%
rename from arch/arm/mach-ixp2000/include/mach/gpio.h
rename to arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h
index 4a88d2c33dacb6a4640b998c824465c9561d3e23..af836c76c3f1a2e142d38a1106e46fa75fa20693 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2002 Intel Corporation.
  *
- * This program is free software, you can redistribute it and/or modify 
+ * 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.
  */
@@ -11,7 +11,7 @@
 /*
  * IXP2000 GPIO in/out, edge/level detection for IRQs:
  * IRQs are generated on Falling-edge, Rising-Edge, Level-low, Level-High
- * or both Falling-edge and Rising-edge.  
+ * or both Falling-edge and Rising-edge.
  * This must be called *before* the corresponding IRQ is registerd.
  * Use this instead of directly setting the GPIO registers.
  * GPIOs may also be used as GPIOs (e.g. for emulating i2c/smb)
index 235638f800e55795629597f1de58d82ed1456715..634b6c852f68f58d0d8cf368e45cf0946b0987a7 100644 (file)
@@ -14,6 +14,7 @@
  *  Free Software Foundation;  either version 2 of the  License, or (at your
  *  option) any later version.
  */
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/mm.h>
@@ -40,8 +41,7 @@
 #include <asm/mach/flash.h>
 #include <asm/mach/arch.h>
 
-#include <mach/gpio.h>
-
+#include <mach/gpio-ixp2000.h>
 
 /*************************************************************************
  * IXDP2x00 IRQ Initialization
index 71607a7ecc7e57cc07bb486f61bb678368b30712..8837fbca27ce7e06a47f50c5d05537986d7c3bb8 100644 (file)
@@ -16,7 +16,7 @@
  * Author: Rod Whitby <rod@whitby.id.au>
  * Maintainers: http://www.nslu2-linux.org/
  */
-
+#include <linux/gpio.h>
 #include <linux/irq.h>
 #include <linux/jiffies.h>
 #include <linux/timer.h>
@@ -31,7 +31,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 #include <asm/mach/time.h>
-#include <asm/gpio.h>
 
 #define DSMG600_SDA_PIN                5
 #define DSMG600_SCL_PIN                4
index a9540cd90375c145abe422c12177dbe5023174ed..2887c3578c17531c6017b0cf085ca277a52a4612 100644 (file)
@@ -14,7 +14,7 @@
  * Maintainers: http://www.nslu2-linux.org/
  *
  */
-
+#include <linux/gpio.h>
 #include <linux/if_ether.h>
 #include <linux/irq.h>
 #include <linux/serial.h>
@@ -27,7 +27,6 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
-#include <asm/gpio.h>
 
 #define FSG_SDA_PIN            12
 #define FSG_SCL_PIN            13
index a5f87ded2f28bd8e039d8c09ac04db6e8fc43d50..83d6b4ed60bbd42f3e912d68611205d720ad98a1 100644 (file)
@@ -28,6 +28,8 @@
 #include <linux/kernel.h>
 #include <mach/hardware.h>
 
+#define __ARM_GPIOLIB_COMPLEX
+
 static inline int gpio_request(unsigned gpio, const char *label)
 {
        return 0;
@@ -70,6 +72,7 @@ static inline void gpio_set_value(unsigned gpio, int value)
 #include <asm-generic/gpio.h>                  /* cansleep wrappers */
 
 extern int gpio_to_irq(int gpio);
+#define gpio_to_irq gpio_to_irq
 extern int irq_to_gpio(unsigned int irq);
 
 #endif
index 57b5410c31f40dc9db120b0b8f04b0e55c0912d6..ffb9d6afb89f4dfd789ec03a6ccaabf6b4dea61d 100644 (file)
@@ -17,8 +17,6 @@
 
 #include <mach/hardware.h>
 
-#define IO_SPACE_LIMIT 0x0000ffff
-
 extern int (*ixp4xx_pci_read)(u32 addr, u32 cmd, u32* data);
 extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);
 
index 9f4669260d4c4a509fe71cc413d54992e2623a4a..de716fa1aab64e713edc822200b814fcb2445264 100644 (file)
@@ -17,7 +17,7 @@
  * Maintainers: http://www.nslu2-linux.org/
  *
  */
-
+#include <linux/gpio.h>
 #include <linux/if_ether.h>
 #include <linux/irq.h>
 #include <linux/jiffies.h>
@@ -32,7 +32,6 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
-#include <asm/gpio.h>
 
 #define NAS100D_SDA_PIN                5
 #define NAS100D_SCL_PIN                6
index 3676fbf6ef9c874bf1ea0f41a43a39ef22e7842a..ac81ccb26bfea8b63902f83041b66137fb11896f 100644 (file)
@@ -16,7 +16,7 @@
  * Maintainers: http://www.nslu2-linux.org/
  *
  */
-
+#include <linux/gpio.h>
 #include <linux/if_ether.h>
 #include <linux/irq.h>
 #include <linux/serial.h>
@@ -30,7 +30,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 #include <asm/mach/time.h>
-#include <asm/gpio.h>
 
 #define NSLU2_SDA_PIN          7
 #define NSLU2_SCL_PIN          6
index 05d193a25b250d73c90830c52050e106e70eddca..c4c68e5b94f145cf1a3d36c4a7b4e281d40d92ba 100644 (file)
@@ -7,14 +7,13 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <linux/io.h>
 #include <mach/bridge-regs.h>
 #include <plat/irq.h>
-#include <asm/gpio.h>
 #include "common.h"
 
 static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
index b0a7d979a8ed98e9fa35abed1d49577e0ec66b63..cc431fa22ccb6538f85bb1c98d366ba0d57e5532 100644 (file)
@@ -7,12 +7,11 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/mbus.h>
 #include <linux/io.h>
-#include <asm/gpio.h>
 #include <mach/hardware.h>
 #include <plat/mpp.h>
 #include "common.h"
index 7e3e8160ed30fe1874dc9540f9b2178f8f4b0eea..853efd9133c6a8f91ed7e1bef24158f562006942 100644 (file)
@@ -3,7 +3,7 @@
 # Makefile for KS8695 architecture support
 #
 
-obj-y                          := cpu.o irq.o time.o gpio.o devices.o
+obj-y                          := cpu.o irq.o time.o devices.o
 obj-m                          :=
 obj-n                          :=
 obj-                           :=
index a5fcc7c7fe185e753b44056fb13f58a23b0fc4da..a91f99d265aa8a5897efba886869fed32da44363 100644 (file)
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
@@ -34,7 +34,7 @@
 #include <asm/mach/irq.h>
 
 #include <mach/devices.h>
-#include <mach/gpio.h>
+#include <mach/gpio-ks8695.h>
 
 #include "generic.h"
 
index fb91a716a7db116b11e91fc729097a052cdbf3c8..d24bcef2e2dd782d336d8283fe94a636fc456019 100644 (file)
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
@@ -29,7 +29,7 @@
 #include <asm/mach/irq.h>
 
 #include <mach/devices.h>
-#include <mach/gpio.h>
+#include <mach/gpio-ks8695.h>
 
 #include "generic.h"
 
index 8f67a750b6c7c46371c6597f7cd5ea4f99f12395..16c95657f8fd4548aad5027ee4d66cb597edf481 100644 (file)
@@ -5,7 +5,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
@@ -18,7 +18,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/gpio.h>
+#include <mach/gpio-ks8695.h>
 #include <mach/devices.h>
 
 #include "generic.h"
index b89fb6d46cccc9efc5ed9f112875ef039da17595..73bd63812878548fcd1e7526ff3c5c22592a2664 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 
 #include <mach/irqs.h>
diff --git a/arch/arm/mach-ks8695/include/mach/gpio-ks8695.h b/arch/arm/mach-ks8695/include/mach/gpio-ks8695.h
new file mode 100644 (file)
index 0000000..6eb034d
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2006 Andrew Victor
+ *
+ * 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 __MACH_KS8659_GPIO_H
+#define __MACH_KS8659_GPIO_H
+
+#include <linux/kernel.h>
+
+#define KS8695_GPIO_0          0
+#define KS8695_GPIO_1          1
+#define KS8695_GPIO_2          2
+#define KS8695_GPIO_3          3
+#define KS8695_GPIO_4          4
+#define KS8695_GPIO_5          5
+#define KS8695_GPIO_6          6
+#define KS8695_GPIO_7          7
+#define KS8695_GPIO_8          8
+#define KS8695_GPIO_9          9
+#define KS8695_GPIO_10         10
+#define KS8695_GPIO_11         11
+#define KS8695_GPIO_12         12
+#define KS8695_GPIO_13         13
+#define KS8695_GPIO_14         14
+#define KS8695_GPIO_15         15
+
+/*
+ * Configure GPIO pin as external interrupt source.
+ */
+extern int ks8695_gpio_interrupt(unsigned int pin, unsigned int type);
+
+/* Register the GPIOs */
+extern void ks8695_register_gpios(void);
+
+#endif /* __MACH_KS8659_GPIO_H */
index 86312d476bc69525317641b63fe46ff53021342d..f5fda36e4512632e24d74ef05f8acdb119b6e801 100644 (file)
 #ifndef __ASM_ARCH_GPIO_H_
 #define __ASM_ARCH_GPIO_H_
 
-#include <linux/kernel.h>
-
-#define KS8695_GPIO_0          0
-#define KS8695_GPIO_1          1
-#define KS8695_GPIO_2          2
-#define KS8695_GPIO_3          3
-#define KS8695_GPIO_4          4
-#define KS8695_GPIO_5          5
-#define KS8695_GPIO_6          6
-#define KS8695_GPIO_7          7
-#define KS8695_GPIO_8          8
-#define KS8695_GPIO_9          9
-#define KS8695_GPIO_10         10
-#define KS8695_GPIO_11         11
-#define KS8695_GPIO_12         12
-#define KS8695_GPIO_13         13
-#define KS8695_GPIO_14         14
-#define KS8695_GPIO_15         15
-
-/*
- * Configure GPIO pin as external interrupt source.
- */
-extern int ks8695_gpio_interrupt(unsigned int pin, unsigned int type);
-
 /*
  * Map IRQ number to GPIO line.
  */
 extern int irq_to_gpio(unsigned int irq);
 
-#include <asm-generic/gpio.h>
-
-/* If it turns out that we need to optimise GPIO access for the
- * Micrel's GPIOs, then these can be changed to check their argument
- * directly as static inlines. However for now it's probably not
- * worthwhile.
- */
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_to_irq __gpio_to_irq
-
-/* Register the GPIOs */
-extern void ks8695_register_gpios(void);
-
 #endif
index 184ef74e4bee53151666d7d26396964d7c36bcb6..d6f6502ac9b59c1722a0ea09b6938933a15e62e9 100644 (file)
@@ -7,14 +7,14 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/gpio.h>
 
 #include <asm/leds.h>
 #include <mach/devices.h>
-#include <mach/gpio.h>
 
 
 static inline void ks8695_led_on(unsigned int led)
index a5fc5d0eeaeba093b6669833cffccf65d62034a0..f5db805ab95872bb38838a5129324ccbbedb1529 100644 (file)
@@ -3,6 +3,6 @@
 #
 
 obj-y  := timer.o irq.o common.o serial.o clock.o
-obj-y  += gpiolib.o pm.o suspend.o
+obj-y  += pm.o suspend.o
 obj-y  += phy3250.o
 
diff --git a/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h b/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h
new file mode 100644 (file)
index 0000000..1816e22
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Author: Kevin Wells <kevin.wells@nxp.com>
+ *
+ * Copyright (C) 2010 NXP Semiconductors
+ *
+ * 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 __MACH_GPIO_LPC32XX_H
+#define __MACH_GPIO_LPC32XX_H
+
+/*
+ * Note!
+ * Muxed GP pins need to be setup to the GP state in the board level
+ * code prior to using this driver.
+ * GPI pins : 28xP3 group
+ * GPO pins : 24xP3 group
+ * GPIO pins: 8xP0 group, 24xP1 group, 13xP2 group, 6xP3 group
+ */
+
+#define LPC32XX_GPIO_P0_MAX 8
+#define LPC32XX_GPIO_P1_MAX 24
+#define LPC32XX_GPIO_P2_MAX 13
+#define LPC32XX_GPIO_P3_MAX 6
+#define LPC32XX_GPI_P3_MAX 28
+#define LPC32XX_GPO_P3_MAX 24
+
+#define LPC32XX_GPIO_P0_GRP 0
+#define LPC32XX_GPIO_P1_GRP (LPC32XX_GPIO_P0_GRP + LPC32XX_GPIO_P0_MAX)
+#define LPC32XX_GPIO_P2_GRP (LPC32XX_GPIO_P1_GRP + LPC32XX_GPIO_P1_MAX)
+#define LPC32XX_GPIO_P3_GRP (LPC32XX_GPIO_P2_GRP + LPC32XX_GPIO_P2_MAX)
+#define LPC32XX_GPI_P3_GRP (LPC32XX_GPIO_P3_GRP + LPC32XX_GPIO_P3_MAX)
+#define LPC32XX_GPO_P3_GRP (LPC32XX_GPI_P3_GRP + LPC32XX_GPI_P3_MAX)
+
+/*
+ * A specific GPIO can be selected with this macro
+ * ie, GPIO_05 can be selected with LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5)
+ * See the LPC32x0 User's guide for GPIO group numbers
+ */
+#define LPC32XX_GPIO(x, y) ((x) + (y))
+
+#endif /* __MACH_GPIO_LPC32XX_H */
index 67d03da1eee94049a3fa459ff0ac57b1e6ee16e3..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,74 +0,0 @@
-/*
- * arch/arm/mach-lpc32xx/include/mach/gpio.h
- *
- * Author: Kevin Wells <kevin.wells@nxp.com>
- *
- * Copyright (C) 2010 NXP Semiconductors
- *
- * 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_GPIO_H
-#define __ASM_ARCH_GPIO_H
-
-#include <asm-generic/gpio.h>
-
-/*
- * Note!
- * Muxed GP pins need to be setup to the GP state in the board level
- * code prior to using this driver.
- * GPI pins : 28xP3 group
- * GPO pins : 24xP3 group
- * GPIO pins: 8xP0 group, 24xP1 group, 13xP2 group, 6xP3 group
- */
-
-#define LPC32XX_GPIO_P0_MAX 8
-#define LPC32XX_GPIO_P1_MAX 24
-#define LPC32XX_GPIO_P2_MAX 13
-#define LPC32XX_GPIO_P3_MAX 6
-#define LPC32XX_GPI_P3_MAX 28
-#define LPC32XX_GPO_P3_MAX 24
-
-#define LPC32XX_GPIO_P0_GRP 0
-#define LPC32XX_GPIO_P1_GRP (LPC32XX_GPIO_P0_GRP + LPC32XX_GPIO_P0_MAX)
-#define LPC32XX_GPIO_P2_GRP (LPC32XX_GPIO_P1_GRP + LPC32XX_GPIO_P1_MAX)
-#define LPC32XX_GPIO_P3_GRP (LPC32XX_GPIO_P2_GRP + LPC32XX_GPIO_P2_MAX)
-#define LPC32XX_GPI_P3_GRP (LPC32XX_GPIO_P3_GRP + LPC32XX_GPIO_P3_MAX)
-#define LPC32XX_GPO_P3_GRP (LPC32XX_GPI_P3_GRP + LPC32XX_GPI_P3_MAX)
-
-/*
- * A specific GPIO can be selected with this macro
- * ie, GPIO_05 can be selected with LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5)
- * See the LPC32x0 User's guide for GPIO group numbers
- */
-#define LPC32XX_GPIO(x, y) ((x) + (y))
-
-static inline int gpio_get_value(unsigned gpio)
-{
-       return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned gpio, int value)
-{
-       __gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned gpio)
-{
-       return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned gpio)
-{
-       return __gpio_to_irq(gpio);
-}
-
-#endif
index 9b621e14d16aa33ce02733958365b0dcaee44b25..6d2f0d1b9373243d586ae4ef3a33452f48766a5d 100644 (file)
@@ -37,6 +37,7 @@
 
 #include <mach/hardware.h>
 #include <mach/platform.h>
+#include <mach/gpio-lpc32xx.h>
 #include "common.h"
 
 /*
index 06b5fa853c9325b81548378a7978a29cbe898a88..833c3a2784aa782066f308a9c5afd03fdd76bdd8 100644 (file)
@@ -8,7 +8,7 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  publishhed by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/nand.h>
 #include <linux/interrupt.h>
+#include <linux/gpio.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <mach/addr-map.h>
 #include <mach/mfp-pxa168.h>
 #include <mach/pxa168.h>
-#include <mach/gpio.h>
 #include <video/pxa168fb.h>
 #include <linux/input.h>
 #include <plat/pxa27x_keypad.h>
index c79162a50f28720016c1f03119840d4cc5322bee..e411252e3d397b000066d9fe04c96bb516ab043d 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
-#include <linux/gpio.h>
 #include <linux/regulator/machine.h>
 #include <linux/regulator/max8649.h>
 #include <linux/regulator/fixed.h>
index 98e25d9aaab61ea9c4865d6130fafa0e35d8134b..32776f3739f1d8d2e34cf378eb28cda687d19550 100644 (file)
@@ -9,11 +9,11 @@
  */
 
 #include <linux/init.h>
+#include <linux/gpio.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
 
-#include <mach/gpio.h>
 #include <mach/pxa168.h>
 #include <mach/mfp-pxa168.h>
 
diff --git a/arch/arm/mach-mmp/include/mach/gpio-pxa.h b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
new file mode 100644 (file)
index 0000000..c017a98
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef __ASM_MACH_GPIO_PXA_H
+#define __ASM_MACH_GPIO_PXA_H
+
+#include <mach/addr-map.h>
+#include <mach/irqs.h>
+
+#define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
+
+#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
+#define GPIO_REG(x)    (*((volatile u32 *)(GPIO_REGS_VIRT + (x))))
+
+#define NR_BUILTIN_GPIO                IRQ_GPIO_NUM
+
+#define gpio_to_bank(gpio)     ((gpio) >> 5)
+
+/* NOTE: these macros are defined here to make optimization of
+ * gpio_{get,set}_value() to work when 'gpio' is a constant.
+ * Usage of these macros otherwise is no longer recommended,
+ * use generic GPIO API whenever possible.
+ */
+#define GPIO_bit(gpio) (1 << ((gpio) & 0x1f))
+
+#define GPLR(x)                GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x00)
+#define GPDR(x)                GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x0c)
+#define GPSR(x)                GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x18)
+#define GPCR(x)                GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x24)
+
+#include <plat/gpio-pxa.h>
+
+#endif /* __ASM_MACH_GPIO_PXA_H */
index 7bfb827f3fe36a8d71fc874b1a45e446be1d3bac..681262359d1c28cfc30b26e4f093fc43930c17a5 100644 (file)
@@ -1,36 +1,13 @@
 #ifndef __ASM_MACH_GPIO_H
 #define __ASM_MACH_GPIO_H
 
-#include <mach/addr-map.h>
-#include <mach/irqs.h>
 #include <asm-generic/gpio.h>
 
-#define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
-
-#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
-#define GPIO_REG(x)    (*((volatile u32 *)(GPIO_REGS_VIRT + (x))))
-
-#define NR_BUILTIN_GPIO                IRQ_GPIO_NUM
-
-#define gpio_to_bank(gpio)     ((gpio) >> 5)
 #define gpio_to_irq(gpio)      (IRQ_GPIO_START + (gpio))
 #define irq_to_gpio(irq)       ((irq) - IRQ_GPIO_START)
 
-
 #define __gpio_is_inverted(gpio)       (0)
 #define __gpio_is_occupied(gpio)       (0)
 
-/* NOTE: these macros are defined here to make optimization of
- * gpio_{get,set}_value() to work when 'gpio' is a constant.
- * Usage of these macros otherwise is no longer recommended,
- * use generic GPIO API whenever possible.
- */
-#define GPIO_bit(gpio) (1 << ((gpio) & 0x1f))
-
-#define GPLR(x)                GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x00)
-#define GPDR(x)                GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x0c)
-#define GPSR(x)                GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x18)
-#define GPCR(x)                GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x24)
-
 #include <plat/gpio.h>
 #endif /* __ASM_MACH_GPIO_H */
index 5d6421d63254c39b7fb0f7a23dbc846e831fb771..8bfac66126234df28995cbc630311cebbf482818 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
-#include <linux/gpio.h>
 #include <linux/regulator/machine.h>
 #include <linux/regulator/max8649.h>
 #include <linux/mfd/max8925.h>
index 079c18861d5c885a9027be3fcce617d2caffdbda..65d8689e40c9ca6ab7aee16cfc2444ca4535f96e 100644 (file)
@@ -9,7 +9,6 @@
  * 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>
@@ -25,7 +24,7 @@
 #include <mach/irqs.h>
 #include <mach/dma.h>
 #include <mach/mfp.h>
-#include <mach/gpio.h>
+#include <mach/gpio-pxa.h>
 #include <mach/devices.h>
 #include <mach/mmp2.h>
 
index 0156f535dae76facab7e23bd5eb58580e208a207..50c1763911ffbf1a0e4cf517bc681962f75be666 100644 (file)
@@ -7,7 +7,6 @@
  * 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>
@@ -21,7 +20,7 @@
 #include <mach/regs-apbc.h>
 #include <mach/regs-apmu.h>
 #include <mach/irqs.h>
-#include <mach/gpio.h>
+#include <mach/gpio-pxa.h>
 #include <mach/dma.h>
 #include <mach/devices.h>
 #include <mach/mfp.h>
index 1464607aa60db76632ce72b0008cfa4333178b13..4ebbfbba39fcf3bb54e3da76891918c14f66ea50 100644 (file)
@@ -7,7 +7,6 @@
  * 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>
@@ -20,7 +19,7 @@
 #include <mach/regs-apmu.h>
 #include <mach/cputype.h>
 #include <mach/irqs.h>
-#include <mach/gpio.h>
+#include <mach/gpio-pxa.h>
 #include <mach/dma.h>
 #include <mach/mfp.h>
 #include <mach/devices.h>
index c296b75c4453de76f0757329baffb677b56dda5c..eb5be879fd8cd76748d109546c77d34eb9914116 100644 (file)
@@ -7,18 +7,18 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  publishhed by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/smc91x.h>
+#include <linux/gpio.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <mach/addr-map.h>
 #include <mach/mfp-pxa910.h>
 #include <mach/pxa910.h>
-#include <mach/gpio.h>
 
 #include "common.h"
 
index a80765533f137776946083808cb22893dabc357c..6d84ee740df483911363f2ef54311b618787bf54 100644 (file)
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -34,7 +34,6 @@
 
 #include <mach/vreg.h>
 #include <mach/mpp.h>
-#include <mach/gpio.h>
 #include <mach/board.h>
 #include <mach/msm_iomap.h>
 
index bb72ea0383b7bd1e9a004637f751fdade5a9ff95..71de5062c71efd6d86e3e5a4e5927e7dbdf733ea 100644 (file)
@@ -14,7 +14,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  * 02110-1301, USA.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/irq.h>
 #include <linux/gpio.h>
@@ -31,7 +31,6 @@
 #include <asm/memory.h>
 #include <asm/setup.h>
 
-#include <mach/gpio.h>
 #include <mach/board.h>
 #include <mach/msm_iomap.h>
 #include <mach/dma.h>
index 106170fb1844b5d580577189f3cfe16f53e322ab..cf38e2284fa956437ea3161f92c5fb1be09e147c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2010, 2011, Code Aurora Forum. 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 and
@@ -8,18 +8,16 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
  */
 
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/irq.h>
+#include <linux/irqdomain.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_platform.h>
 #include <linux/memblock.h>
 
 #include <asm/mach-types.h>
@@ -70,6 +68,41 @@ static void __init msm8x60_init(void)
 {
 }
 
+#ifdef CONFIG_OF
+static struct of_dev_auxdata msm_auxdata_lookup[] __initdata = {
+       {}
+};
+
+static struct of_device_id msm_dt_gic_match[] __initdata = {
+       { .compatible = "qcom,msm-8660-qgic", },
+       {}
+};
+
+static void __init msm8x60_dt_init(void)
+{
+       struct device_node *node;
+
+       node = of_find_matching_node_by_address(NULL, msm_dt_gic_match,
+                       MSM8X60_QGIC_DIST_PHYS);
+       if (node)
+               irq_domain_add_simple(node, GIC_SPI_START);
+
+       if (of_machine_is_compatible("qcom,msm8660-surf")) {
+               printk(KERN_INFO "Init surf UART registers\n");
+               msm8x60_init_uart12dm();
+       }
+
+       of_platform_populate(NULL, of_default_bus_match_table,
+                       msm_auxdata_lookup, NULL);
+}
+
+static const char *msm8x60_fluid_match[] __initdata = {
+       "qcom,msm8660-fluid",
+       "qcom,msm8660-surf",
+       NULL
+};
+#endif /* CONFIG_OF */
+
 MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3")
        .fixup = msm8x60_fixup,
        .reserve = msm8x60_reserve,
@@ -105,3 +138,14 @@ MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA")
        .init_machine = msm8x60_init,
        .timer = &msm_timer,
 MACHINE_END
+
+#ifdef CONFIG_OF
+/* TODO: General device tree support for all MSM. */
+DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
+       .map_io = msm8x60_map_io,
+       .init_irq = msm8x60_init_irq,
+       .init_machine = msm8x60_dt_init,
+       .timer = &msm_timer,
+       .dt_compat = msm8x60_fluid_match,
+MACHINE_END
+#endif /* CONFIG_OF */
index 51109b1f4342b64b9120d0c9baa2ee2117cbe2d7..7e8909c978c38d3f9a5fc471ad23d2cf2f978fd7 100644 (file)
@@ -14,7 +14,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  * 02110-1301, USA.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/irq.h>
 #include <linux/gpio.h>
@@ -32,7 +32,6 @@
 #include <mach/board.h>
 #include <mach/irqs.h>
 #include <mach/sirc.h>
-#include <mach/gpio.h>
 #include <mach/vreg.h>
 #include <mach/mmc.h>
 
index dc0bcb5a6b9af8566fc89cc6c4f42cb66ff58bb1..afa9293d58002b3790cf2f661225d8ed152bab44 100644 (file)
@@ -11,7 +11,7 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
 */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -22,7 +22,6 @@
 
 #include <linux/delay.h>
 
-#include <asm/gpio.h>
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index f7a9724788b0f54fe7dc7e239d895d9ed6162ffa..8650342b7493e00e4828ffd1bf057c81979efee3 100644 (file)
@@ -1,7 +1,7 @@
 /* linux/arch/arm/mach-msm/board-trout-mmc.c
 ** Author: Brian Swetland <swetland@google.com>
 */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -11,7 +11,6 @@
 #include <linux/err.h>
 #include <linux/debugfs.h>
 
-#include <asm/gpio.h>
 #include <asm/io.h>
 
 #include <mach/vreg.h>
index 729bb49a44caf6bbd2b38557304d155bea242cf3..25105c1027fe44c1862b94605ca8d6fd520ff3c1 100644 (file)
@@ -1,7 +1,7 @@
 /* linux/arch/arm/mach-msm/board-trout-mddi.c
 ** Author: Brian Swetland <swetland@google.com>
 */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -11,7 +11,6 @@
 #include <linux/err.h>
 
 #include <asm/io.h>
-#include <asm/gpio.h>
 #include <asm/mach-types.h>
 
 #include <mach/msm_fb.h>
index 36ad50d3bfaa8e03e9f0333c05ed655d9ebf4adb..40a8c178f10d9e85a2873c83247c3f2fe553f408 100644 (file)
@@ -1,26 +1 @@
-/*
- * Copyright (C) 2007 Google, Inc.
- * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
- * Author: Mike Lockwood <lockwood@android.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-#ifndef __ASM_ARCH_MSM_GPIO_H
-#define __ASM_ARCH_MSM_GPIO_H
-
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value  __gpio_get_value
-#define gpio_set_value  __gpio_set_value
-#define gpio_cansleep   __gpio_cansleep
-#define gpio_to_irq     __gpio_to_irq
-
-#endif /* __ASM_ARCH_MSM_GPIO_H */
+/* empty */
index 3e24431bb5eaf929c28ed46cd77b62286711c512..e421b701663b8bfda904ca151727b7d2456452bc 100644 (file)
@@ -7,12 +7,11 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/irq.h>
-#include <asm/gpio.h>
 #include <mach/bridge-regs.h>
 #include <plat/irq.h>
 #include "common.h"
index 59b7686b92097f30f36175ccfeb8ead5f12d42c3..cf4e494d44bf98a62bfee8cbd67baee13d87a1e3 100644 (file)
@@ -7,13 +7,12 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/mbus.h>
 #include <linux/io.h>
 #include <plat/mpp.h>
-#include <asm/gpio.h>
 #include <mach/hardware.h>
 #include "common.h"
 #include "mpp.h"
index 3d4c31306ca7f1a0dce7513982419564a231f56b..af0c212e3c7b9802e4a0e2295ddbf05d857903d2 100644 (file)
@@ -56,6 +56,15 @@ config MACH_MX50_RDP
 
 comment "i.MX51 machines:"
 
+config MACH_IMX51_DT
+       bool "Support i.MX51 platforms from device tree"
+       select SOC_IMX51
+       select USE_OF
+       select MACH_MX51_BABBAGE
+       help
+         Include support for Freescale i.MX51 based platforms
+         using the device tree for discovery
+
 config MACH_MX51_BABBAGE
        bool "Support MX51 BABBAGE platforms"
        select SOC_IMX51
@@ -171,6 +180,18 @@ config MACH_MX51_EFIKASB
 
 comment "i.MX53 machines:"
 
+config MACH_IMX53_DT
+       bool "Support i.MX53 platforms from device tree"
+       select SOC_IMX53
+       select USE_OF
+       select MACH_MX53_ARD
+       select MACH_MX53_EVK
+       select MACH_MX53_LOCO
+       select MACH_MX53_SMD
+       help
+         Include support for Freescale i.MX53 based platforms
+         using the device tree for discovery
+
 config MACH_MX53_EVK
        bool "Support MX53 EVK platforms"
        select SOC_IMX53
index 9565304b72820f9defbe3b18ce505c6adea3ba47..0fc60807fa2bc7838309fa4860174cbfcb954a54 100644 (file)
@@ -21,3 +21,6 @@ obj-$(CONFIG_MX51_EFIKA_COMMON) += mx51_efika.o
 obj-$(CONFIG_MACH_MX51_EFIKAMX) += board-mx51_efikamx.o
 obj-$(CONFIG_MACH_MX51_EFIKASB) += board-mx51_efikasb.o
 obj-$(CONFIG_MACH_MX50_RDP) += board-mx50_rdp.o
+
+obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o
+obj-$(CONFIG_MACH_IMX53_DT) += imx53-dt.o
index 5993208a8f002e2b731315d38e65e56e714e0ada..5c837603ff0fc3b6a173ab677bdfda2a75bec09b 100644 (file)
@@ -349,6 +349,12 @@ static const struct esdhc_platform_data mx51_babbage_sd2_data __initconst = {
        .wp_type = ESDHC_WP_GPIO,
 };
 
+void __init imx51_babbage_common_init(void)
+{
+       mxc_iomux_v3_setup_multiple_pads(mx51babbage_pads,
+                                        ARRAY_SIZE(mx51babbage_pads));
+}
+
 /*
  * Board specific initialization.
  */
@@ -363,8 +369,7 @@ static void __init mx51_babbage_init(void)
 #if defined(CONFIG_CPU_FREQ_IMX)
        get_cpu_op = mx51_get_cpu_op;
 #endif
-       mxc_iomux_v3_setup_multiple_pads(mx51babbage_pads,
-                                       ARRAY_SIZE(mx51babbage_pads));
+       imx51_babbage_common_init();
 
        imx51_add_imx_uart(0, &uart_pdata);
        imx51_add_imx_uart(1, NULL);
index 614edcb0aa7e97f54e8301568259f188be7e46b4..0d7f0fffb23a865585faa28b4c40a2afbd5b3029 100644 (file)
@@ -171,9 +171,6 @@ static struct imxi2c_platform_data mx53_ard_i2c3_data = {
 
 static void __init mx53_ard_io_init(void)
 {
-       mxc_iomux_v3_setup_multiple_pads(mx53_ard_pads,
-                               ARRAY_SIZE(mx53_ard_pads));
-
        gpio_request(ARD_ETHERNET_INT_B, "eth-int-b");
        gpio_direction_input(ARD_ETHERNET_INT_B);
 
@@ -216,6 +213,13 @@ static int weim_cs_config(void)
        return 0;
 }
 
+void __init imx53_ard_common_init(void)
+{
+       mxc_iomux_v3_setup_multiple_pads(mx53_ard_pads,
+                                        ARRAY_SIZE(mx53_ard_pads));
+       weim_cs_config();
+}
+
 static struct platform_device *devices[] __initdata = {
        &ard_smsc_lan9220_device,
 };
@@ -225,8 +229,8 @@ static void __init mx53_ard_board_init(void)
        imx53_soc_init();
        imx53_add_imx_uart(0, NULL);
 
+       imx53_ard_common_init();
        mx53_ard_io_init();
-       weim_cs_config();
        platform_add_devices(devices, ARRAY_SIZE(devices));
 
        imx53_add_sdhci_esdhc_imx(0, &mx53_ard_sd1_data);
index 6a3e6168e322eb5ec0ac46be6103f8953b818310..6bea31ab8f8581ee637a7f9a998157cd982a1b1b 100644 (file)
@@ -131,12 +131,17 @@ static const struct spi_imx_master mx53_evk_spi_data __initconst = {
        .num_chipselect = ARRAY_SIZE(mx53_evk_spi_cs),
 };
 
+void __init imx53_evk_common_init(void)
+{
+       mxc_iomux_v3_setup_multiple_pads(mx53_evk_pads,
+                                        ARRAY_SIZE(mx53_evk_pads));
+}
+
 static void __init mx53_evk_board_init(void)
 {
        imx53_soc_init();
+       imx53_evk_common_init();
 
-       mxc_iomux_v3_setup_multiple_pads(mx53_evk_pads,
-                                       ARRAY_SIZE(mx53_evk_pads));
        mx53_evk_init_uart();
        mx53_evk_fec_reset();
        imx53_add_fec(&mx53_evk_fec_pdata);
index 0af2766f86105e1f0f0dbd41a1538873228e0e17..7678f7734db631ab5163bc1144520311e2666e18 100644 (file)
@@ -263,6 +263,12 @@ static const struct gpio_led_platform_data mx53loco_leds_data __initconst = {
        .num_leds       = ARRAY_SIZE(mx53loco_leds),
 };
 
+void __init imx53_qsb_common_init(void)
+{
+       mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads,
+                                        ARRAY_SIZE(mx53_loco_pads));
+}
+
 static struct i2c_board_info mx53loco_i2c_devices[] = {
        {
                I2C_BOARD_INFO("mma8450", 0x1C),
@@ -273,9 +279,8 @@ static void __init mx53_loco_board_init(void)
 {
        int ret;
        imx53_soc_init();
+       imx53_qsb_common_init();
 
-       mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads,
-                                       ARRAY_SIZE(mx53_loco_pads));
        imx53_add_imx_uart(0, NULL);
        mx53_loco_fec_reset();
        imx53_add_fec(&mx53_loco_fec_data);
index d12fd3043ba61b548e0acee3bfa04dbd04b4159a..59c0845eb4a6321badc4f6b1f58943e64c68a33e 100644 (file)
@@ -125,12 +125,17 @@ static inline void mx53_smd_ahci_pwr_on(void)
        }
 }
 
+void __init imx53_smd_common_init(void)
+{
+       mxc_iomux_v3_setup_multiple_pads(mx53_smd_pads,
+                                        ARRAY_SIZE(mx53_smd_pads));
+}
+
 static void __init mx53_smd_board_init(void)
 {
        imx53_soc_init();
+       imx53_smd_common_init();
 
-       mxc_iomux_v3_setup_multiple_pads(mx53_smd_pads,
-                                       ARRAY_SIZE(mx53_smd_pads));
        mx53_smd_init_uart();
        mx53_smd_fec_reset();
        imx53_add_fec(&mx53_smd_fec_data);
index b94879e8679fadc2f2203fbda1ac130a136aff88..2aacf41c48e7d3fd02f38a6e80ee9f6087953bf6 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/clkdev.h>
+#include <linux/of.h>
 
 #include <asm/div64.h>
 
@@ -1632,3 +1633,41 @@ int __init mx53_clocks_init(unsigned long ckil, unsigned long osc,
                MX53_INT_GPT);
        return 0;
 }
+
+static void __init clk_get_freq_dt(unsigned long *ckil, unsigned long *osc,
+                                  unsigned long *ckih1, unsigned long *ckih2)
+{
+       struct device_node *np;
+
+       /* 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-ckil"))
+                       *ckil = rate;
+               else if (of_device_is_compatible(np, "fsl,imx-osc"))
+                       *osc = rate;
+               else if (of_device_is_compatible(np, "fsl,imx-ckih1"))
+                       *ckih1 = rate;
+               else if (of_device_is_compatible(np, "fsl,imx-ckih2"))
+                       *ckih2 = rate;
+       }
+}
+
+int __init mx51_clocks_init_dt(void)
+{
+       unsigned long ckil, osc, ckih1, ckih2;
+
+       clk_get_freq_dt(&ckil, &osc, &ckih1, &ckih2);
+       return mx51_clocks_init(ckil, osc, ckih1, ckih2);
+}
+
+int __init mx53_clocks_init_dt(void)
+{
+       unsigned long ckil, osc, ckih1, ckih2;
+
+       clk_get_freq_dt(&ckil, &osc, &ckih1, &ckih2);
+       return mx53_clocks_init(ckil, osc, ckih1, ckih2);
+}
diff --git a/arch/arm/mach-mx5/imx51-dt.c b/arch/arm/mach-mx5/imx51-dt.c
new file mode 100644 (file)
index 0000000..ccc6158
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/time.h>
+#include <mach/common.h>
+#include <mach/mx51.h>
+
+/*
+ * Lookup table for attaching a specific name and platform_data pointer to
+ * devices as they get created by of_platform_populate().  Ideally this table
+ * would not exist, but the current clock implementation depends on some devices
+ * having a specific name.
+ */
+static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = {
+       OF_DEV_AUXDATA("fsl,imx51-uart", MX51_UART1_BASE_ADDR, "imx21-uart.0", NULL),
+       OF_DEV_AUXDATA("fsl,imx51-uart", MX51_UART2_BASE_ADDR, "imx21-uart.1", NULL),
+       OF_DEV_AUXDATA("fsl,imx51-uart", MX51_UART3_BASE_ADDR, "imx21-uart.2", NULL),
+       OF_DEV_AUXDATA("fsl,imx51-fec", MX51_FEC_BASE_ADDR, "imx27-fec.0", NULL),
+       OF_DEV_AUXDATA("fsl,imx51-esdhc", MX51_ESDHC1_BASE_ADDR, "sdhci-esdhc-imx51.0", NULL),
+       OF_DEV_AUXDATA("fsl,imx51-esdhc", MX51_ESDHC2_BASE_ADDR, "sdhci-esdhc-imx51.1", NULL),
+       OF_DEV_AUXDATA("fsl,imx51-esdhc", MX51_ESDHC3_BASE_ADDR, "sdhci-esdhc-imx51.2", NULL),
+       OF_DEV_AUXDATA("fsl,imx51-esdhc", MX51_ESDHC4_BASE_ADDR, "sdhci-esdhc-imx51.3", NULL),
+       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-sdma", MX51_SDMA_BASE_ADDR, "imx35-sdma", NULL),
+       OF_DEV_AUXDATA("fsl,imx51-wdt", MX51_WDOG1_BASE_ADDR, "imx2-wdt.0", NULL),
+       { /* sentinel */ }
+};
+
+static void __init imx51_tzic_add_irq_domain(struct device_node *np,
+                               struct device_node *interrupt_parent)
+{
+       irq_domain_add_simple(np, 0);
+}
+
+static void __init imx51_gpio_add_irq_domain(struct device_node *np,
+                               struct device_node *interrupt_parent)
+{
+       static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS -
+                                  32 * 4; /* imx51 gets 4 gpio ports */
+
+       irq_domain_add_simple(np, gpio_irq_base);
+       gpio_irq_base += 32;
+}
+
+static const struct of_device_id imx51_irq_match[] __initconst = {
+       { .compatible = "fsl,imx51-tzic", .data = imx51_tzic_add_irq_domain, },
+       { .compatible = "fsl,imx51-gpio", .data = imx51_gpio_add_irq_domain, },
+       { /* sentinel */ }
+};
+
+static const struct of_device_id imx51_iomuxc_of_match[] __initconst = {
+       { .compatible = "fsl,imx51-iomuxc-babbage", .data = imx51_babbage_common_init, },
+       { /* sentinel */ }
+};
+
+static void __init imx51_dt_init(void)
+{
+       struct device_node *node;
+       const struct of_device_id *of_id;
+       void (*func)(void);
+
+       of_irq_init(imx51_irq_match);
+
+       node = of_find_matching_node(NULL, imx51_iomuxc_of_match);
+       if (node) {
+               of_id = of_match_node(imx51_iomuxc_of_match, node);
+               func = of_id->data;
+               func();
+               of_node_put(node);
+       }
+
+       of_platform_populate(NULL, of_default_bus_match_table,
+                            imx51_auxdata_lookup, NULL);
+}
+
+static void __init imx51_timer_init(void)
+{
+       mx51_clocks_init_dt();
+}
+
+static struct sys_timer imx51_timer = {
+       .init = imx51_timer_init,
+};
+
+static const char *imx51_dt_board_compat[] __initdata = {
+       "fsl,imx51-babbage",
+       NULL
+};
+
+DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)")
+       .map_io         = mx51_map_io,
+       .init_early     = imx51_init_early,
+       .init_irq       = mx51_init_irq,
+       .handle_irq     = imx51_handle_irq,
+       .timer          = &imx51_timer,
+       .init_machine   = imx51_dt_init,
+       .dt_compat      = imx51_dt_board_compat,
+MACHINE_END
diff --git a/arch/arm/mach-mx5/imx53-dt.c b/arch/arm/mach-mx5/imx53-dt.c
new file mode 100644 (file)
index 0000000..ccaa0b8
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/time.h>
+#include <mach/common.h>
+#include <mach/mx53.h>
+
+/*
+ * Lookup table for attaching a specific name and platform_data pointer to
+ * devices as they get created by of_platform_populate().  Ideally this table
+ * would not exist, but the current clock implementation depends on some devices
+ * having a specific name.
+ */
+static const struct of_dev_auxdata imx53_auxdata_lookup[] __initconst = {
+       OF_DEV_AUXDATA("fsl,imx53-uart", MX53_UART1_BASE_ADDR, "imx21-uart.0", NULL),
+       OF_DEV_AUXDATA("fsl,imx53-uart", MX53_UART2_BASE_ADDR, "imx21-uart.1", NULL),
+       OF_DEV_AUXDATA("fsl,imx53-uart", MX53_UART3_BASE_ADDR, "imx21-uart.2", NULL),
+       OF_DEV_AUXDATA("fsl,imx53-uart", MX53_UART4_BASE_ADDR, "imx21-uart.3", NULL),
+       OF_DEV_AUXDATA("fsl,imx53-uart", MX53_UART5_BASE_ADDR, "imx21-uart.4", NULL),
+       OF_DEV_AUXDATA("fsl,imx53-fec", MX53_FEC_BASE_ADDR, "imx25-fec.0", NULL),
+       OF_DEV_AUXDATA("fsl,imx53-esdhc", MX53_ESDHC1_BASE_ADDR, "sdhci-esdhc-imx53.0", NULL),
+       OF_DEV_AUXDATA("fsl,imx53-esdhc", MX53_ESDHC2_BASE_ADDR, "sdhci-esdhc-imx53.1", NULL),
+       OF_DEV_AUXDATA("fsl,imx53-esdhc", MX53_ESDHC3_BASE_ADDR, "sdhci-esdhc-imx53.2", NULL),
+       OF_DEV_AUXDATA("fsl,imx53-esdhc", MX53_ESDHC4_BASE_ADDR, "sdhci-esdhc-imx53.3", NULL),
+       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-sdma", MX53_SDMA_BASE_ADDR, "imx35-sdma", NULL),
+       OF_DEV_AUXDATA("fsl,imx53-wdt", MX53_WDOG1_BASE_ADDR, "imx2-wdt.0", NULL),
+       { /* sentinel */ }
+};
+
+static void __init imx53_tzic_add_irq_domain(struct device_node *np,
+                               struct device_node *interrupt_parent)
+{
+       irq_domain_add_simple(np, 0);
+}
+
+static void __init imx53_gpio_add_irq_domain(struct device_node *np,
+                               struct device_node *interrupt_parent)
+{
+       static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS -
+                                  32 * 7; /* imx53 gets 7 gpio ports */
+
+       irq_domain_add_simple(np, gpio_irq_base);
+       gpio_irq_base += 32;
+}
+
+static const struct of_device_id imx53_irq_match[] __initconst = {
+       { .compatible = "fsl,imx53-tzic", .data = imx53_tzic_add_irq_domain, },
+       { .compatible = "fsl,imx53-gpio", .data = imx53_gpio_add_irq_domain, },
+       { /* sentinel */ }
+};
+
+static const struct of_device_id imx53_iomuxc_of_match[] __initconst = {
+       { .compatible = "fsl,imx53-iomuxc-ard", .data = imx53_ard_common_init, },
+       { .compatible = "fsl,imx53-iomuxc-evk", .data = imx53_evk_common_init, },
+       { .compatible = "fsl,imx53-iomuxc-qsb", .data = imx53_qsb_common_init, },
+       { .compatible = "fsl,imx53-iomuxc-smd", .data = imx53_smd_common_init, },
+       { /* sentinel */ }
+};
+
+static void __init imx53_dt_init(void)
+{
+       struct device_node *node;
+       const struct of_device_id *of_id;
+       void (*func)(void);
+
+       of_irq_init(imx53_irq_match);
+
+       node = of_find_matching_node(NULL, imx53_iomuxc_of_match);
+       if (node) {
+               of_id = of_match_node(imx53_iomuxc_of_match, node);
+               func = of_id->data;
+               func();
+               of_node_put(node);
+       }
+
+       of_platform_populate(NULL, of_default_bus_match_table,
+                            imx53_auxdata_lookup, NULL);
+}
+
+static void __init imx53_timer_init(void)
+{
+       mx53_clocks_init_dt();
+}
+
+static struct sys_timer imx53_timer = {
+       .init = imx53_timer_init,
+};
+
+static const char *imx53_dt_board_compat[] __initdata = {
+       "fsl,imx53-ard",
+       "fsl,imx53-evk",
+       "fsl,imx53-qsb",
+       "fsl,imx53-smd",
+       NULL
+};
+
+DT_MACHINE_START(IMX53_DT, "Freescale i.MX53 (Device Tree Support)")
+       .map_io         = mx53_map_io,
+       .init_early     = imx53_init_early,
+       .init_irq       = mx53_init_irq,
+       .handle_irq     = imx53_handle_irq,
+       .timer          = &imx53_timer,
+       .init_machine   = imx53_dt_init,
+       .dt_compat      = imx53_dt_board_compat,
+MACHINE_END
index 56025aa0a639ea68d7b523c147004215dc0010cf..40a8c178f10d9e85a2873c83247c3f2fe553f408 100644 (file)
@@ -1,31 +1 @@
-/*
- * Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
- * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-
-#ifndef __MACH_MXS_GPIO_H__
-#define __MACH_MXS_GPIO_H__
-
-#include <asm-generic/gpio.h>
-
-/* use gpiolib dispatchers */
-#define gpio_get_value         __gpio_get_value
-#define gpio_set_value         __gpio_set_value
-#define gpio_cansleep          __gpio_cansleep
-#define gpio_to_irq            __gpio_to_irq
-
-#endif /* __MACH_MXS_GPIO_H__ */
+/* empty */
index 398a75f62bee68c41d6af95ddd6bbe76de89b907..0cbb74c96ef7603631121ef9b965dd3d929d453d 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/mach/irq.h>
 #include <asm/mach/flash.h>
 
+#include <plat/gpio-nomadik.h>
 #include <plat/mtu.h>
 
 #include <mach/setup.h>
index ac58e3b03b1a5516e87379450ccffcd9dd4a1fb7..dc67717db6f078db7975adc873bf6efe2a64eaef 100644 (file)
@@ -21,8 +21,8 @@
 #include <linux/device.h>
 #include <linux/amba/bus.h>
 #include <linux/platform_device.h>
-#include <linux/gpio.h>
 
+#include <plat/gpio-nomadik.h>
 #include <mach/hardware.h>
 #include <mach/irqs.h>
 #include <asm/mach/map.h>
index abfe25a08d6b6e15f336048395013669efc06595..0fc2f6f1cc979097cf83de13a924c7fb05a105f1 100644 (file)
@@ -3,8 +3,8 @@
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
 #include <linux/i2c-gpio.h>
-#include <linux/gpio.h>
 #include <linux/platform_device.h>
+#include <plat/gpio-nomadik.h>
 
 /*
  * There are two busses in the 8815NHK.
index 7a81a042034333b65b1e4553504f9bac3df413aa..efdde0ae0a4f28408a791fede322f4b8d3ef5aa5 100644 (file)
@@ -1,6 +1,4 @@
 #ifndef __ASM_ARCH_GPIO_H
 #define __ASM_ARCH_GPIO_H
 
-#include <plat/gpio.h>
-
 #endif /* __ASM_ARCH_GPIO_H */
index 5b114d1558c83f41fe8acc524b1aa86f2ffa4a54..11c85cd2731a10115e43c6bd4d95aaf956d28198 100644 (file)
@@ -4,7 +4,7 @@
 
 # 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 += clock.o clock_data.o opp_data.o reset.o pm_bus.o
+obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o
 
 obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 
index eb36b25450a0b6ec147db925c7d861f81542bf63..4ea60e2038eaed366c61f92224f94b88b78e5728 100644 (file)
@@ -11,7 +11,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/input.h>
@@ -30,7 +30,6 @@
 
 #include <plat/io.h>
 #include <plat/board-ams-delta.h>
-#include <mach/gpio.h>
 #include <plat/keypad.h>
 #include <plat/mux.h>
 #include <plat/usb.h>
index 999789c4811daea150041d6becdff308940846b9..31e089b6f03f686ac7f6eb16f51542e4bdac4918 100644 (file)
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -28,7 +28,6 @@
 #include <asm/mach/map.h>
 
 #include <plat/tc.h>
-#include <mach/gpio.h>
 #include <plat/mux.h>
 #include <plat/flash.h>
 #include <plat/fpga.h>
index 23cc9e4ad50d539d17f2d35a898643373783ac18..05c6e9d858f319c128261fdb3d8a701b9d5ae220 100644 (file)
@@ -12,7 +12,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -22,7 +22,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/gpio.h>
 #include <plat/mux.h>
 #include <plat/usb.h>
 #include <plat/board.h>
index f2fc43d8382b36c5e19e18e371abfce8e9595a74..da0e37d408237076ae8dda8255fa00e085f325e5 100644 (file)
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 
 #include <linux/i2c/tps65010.h>
 
 #include <plat/mmc.h>
-#include <mach/gpio.h>
 
 #include "board-h2.h"
 
index 6c70c28d055cf966ae0c19d9ec595fc8ff8f894f..c2e279173d4235a16dc31d3043ddb932853adc41 100644 (file)
@@ -18,7 +18,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
@@ -32,7 +32,6 @@
 #include <linux/smc91x.h>
 
 #include <mach/hardware.h>
-#include <asm/gpio.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index 2098525e7cc5dcd1de834fd8dd0a642077ee9ddf..f8242aa9b76321229f400ccf2b0bcb4a3f28c1f0 100644 (file)
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 
 #include <linux/i2c/tps65010.h>
 
 #include <plat/mmc.h>
-#include <mach/gpio.h>
 
 #include "board-h3.h"
 
index 8e2b64a46929bfc49f9a1a585d6c5341fcedca64..8f5b6af7ed592498efd46a2a30f42f04681a79dc 100644 (file)
@@ -13,7 +13,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/types.h>
 #include <linux/init.h>
 #include <linux/major.h>
@@ -34,7 +34,6 @@
 #include <asm/setup.h>
 #include <asm/page.h>
 #include <mach/hardware.h>
-#include <asm/gpio.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index e81ead1c89eadc7de583720b3541a33852c5eb96..fcd1a3c31896b0a2bb28a5cf5a187eaccd356e29 100644 (file)
@@ -23,7 +23,6 @@
  * 02110-1301, USA.
  *
  */
-
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
index 8b034594fbc748e445294e1107eee9630f2cd788..c2234caf8a7ad46e9a55cbcca46179d5208bc074 100644 (file)
@@ -15,7 +15,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -34,7 +34,6 @@
 #include <plat/mux.h>
 #include <plat/flash.h>
 #include <plat/fpga.h>
-#include <mach/gpio.h>
 #include <plat/tc.h>
 #include <plat/usb.h>
 #include <plat/keypad.h>
index 6825635ac681980b678c3b3e38d4ea45242614a6..02789c5d3703410933d3486cd276d1dcf7825325 100644 (file)
@@ -7,7 +7,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/mutex.h>
@@ -26,7 +26,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/gpio.h>
 #include <plat/mux.h>
 #include <plat/usb.h>
 #include <plat/board.h>
index 44b8e9362bf4f7f2498ac83f1341c3d738a5c51d..e4dca1deebb4585b075f7afbf3b5f90cab829efe 100644 (file)
@@ -25,7 +25,7 @@
  * with this program; if not, write  to the Free Software Foundation, Inc.,
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -42,7 +42,6 @@
 #include <linux/i2c/tps65010.h>
 
 #include <mach/hardware.h>
-#include <asm/gpio.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index 3d8cd90b1dbb0fc5c1dd6593874708312eda6f87..50c4e398bcc861ff5cbcfe783f1a98b07f36a539 100644 (file)
@@ -16,7 +16,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/input.h>
@@ -33,7 +33,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/gpio.h>
 #include <plat/flash.h>
 #include <plat/mux.h>
 #include <plat/usb.h>
index d0eefe81cd1b0fe3f9e1bdbf5d111238f416b8c6..273771cb1b61a0c60c8dbecd2c1a7a1d13b20c55 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -30,7 +31,6 @@
 #include <asm/mach/map.h>
 
 #include <plat/led.h>
-#include <mach/gpio.h>
 #include <plat/flash.h>
 #include <plat/mux.h>
 #include <plat/usb.h>
index 98e79bc0921386b79e00bceb998670d775639611..de36ade38ef7f906e62caafe437b1a154762d73d 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -32,7 +33,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/gpio.h>
 #include <plat/flash.h>
 #include <plat/mux.h>
 #include <plat/usb.h>
index ad3a1567604e0496a83736604405d3a94547ec30..04b1befaced6a6e4da8dd7823a3d8d01e3bbf3b1 100644 (file)
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -28,7 +28,6 @@
 #include <asm/mach/map.h>
 
 #include <plat/tc.h>
-#include <mach/gpio.h>
 #include <plat/mux.h>
 #include <plat/fpga.h>
 #include <plat/flash.h>
index e8ddd86e3fda698f2227a86f78774f0603d89dd9..b59f78850e691d5933d1821d22b8f7fd630613b0 100644 (file)
  * published by the Free Software Foundation.
  */
 
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 
 #include <mach/hardware.h>
 #include <plat/mmc.h>
-#include <mach/gpio.h>
 #include <plat/board-sx1.h>
 
 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
index 602b55c39d3d0ef566a23ec69e6bbd5b6e176bae..2bea941741d595805ebc1b46e81e95ed8de76a98 100644 (file)
@@ -14,7 +14,7 @@
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/input.h>
@@ -32,7 +32,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/gpio.h>
 #include <plat/flash.h>
 #include <plat/mux.h>
 #include <plat/dma.h>
index 80165154617a853585ae58abcc84bd941290cf37..940faed82be22bad38fc93df4bee376f39e0b1ab 100644 (file)
@@ -13,6 +13,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
@@ -33,7 +34,6 @@
 
 #include <plat/board-voiceblue.h>
 #include <plat/common.h>
-#include <mach/gpio.h>
 #include <plat/flash.h>
 #include <plat/mux.h>
 #include <plat/tc.h>
index 36f26c3fa25ee5dc83291012718e8f2f5ea53aae..7c50ecf68123b645a3d506f9f9110c6ebadb496d 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <linux/dma-mapping.h>
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -24,7 +25,6 @@
 #include <plat/tc.h>
 #include <plat/board.h>
 #include <plat/mux.h>
-#include <mach/gpio.h>
 #include <plat/mmc.h>
 #include <plat/omap7xx.h>
 #include <plat/mcbsp.h>
index cddbf8b089cef4c08e2d9138e886b7cd0f086e06..0a17a1a7e00d106aa80f169e3db59191ab5dbd65 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/device.h>
@@ -28,7 +29,6 @@
 #include <asm/mach/irq.h>
 
 #include <plat/fpga.h>
-#include <mach/gpio.h>
 
 static void fpga_mask_irq(struct irq_data *d)
 {
index e2b9c901ab67c4d07a274e34def39bb5ace47644..e5b104b7fce65e1ca7e6ad1db216950905024ddd 100644 (file)
@@ -35,7 +35,7 @@
  * with this program; if not, write  to the Free Software Foundation, Inc.,
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/sched.h>
@@ -45,7 +45,6 @@
 #include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/mach/irq.h>
-#include <mach/gpio.h>
 #include <plat/cpu.h>
 
 #define IRQ_BANK(irq) ((irq) >> 5)
index b4f9be52e1e841cbf7d4e697299f779c964438ec..4b818eb9f911111bc18134a1617041c07ddf29bc 100644 (file)
@@ -9,6 +9,7 @@
  * The "surfer" expansion board and H2 sample board also have two-color
  * green+red LEDs (in parallel), used here for timer and idle indicators.
  */
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/kernel_stat.h>
 #include <linux/sched.h>
@@ -20,7 +21,6 @@
 #include <asm/mach-types.h>
 
 #include <plat/fpga.h>
-#include <mach/gpio.h>
 
 #include "leds.h"
 
index 499d7ad8697d175847a21fbf133a6cb772526429..da09f4364979808421b2f482b68a32ea84ec898c 100644 (file)
@@ -3,14 +3,13 @@
  *
  * LED driver for OSK with optional Mistral QVGA board
  */
+#include <linux/gpio.h>
 #include <linux/init.h>
 
 #include <mach/hardware.h>
 #include <asm/leds.h>
 #include <asm/system.h>
 
-#include <mach/gpio.h>
-
 #include "leds.h"
 
 
index 22eb11dde9e7ac5408c5d8353614e66c8f147dcd..ae6dd93b8ddce87e755e954695092555c4514083 100644 (file)
@@ -3,13 +3,13 @@
  *
  * OMAP LEDs dispatcher
  */
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 
 #include <asm/leds.h>
 #include <asm/mach-types.h>
 
-#include <mach/gpio.h>
 #include <plat/mux.h>
 
 #include "leds.h"
index ab7395d84bc856424e9ffcfad9ccd1233bc772e0..91f9abbd3250bf981faa1e583de43d4d1f9c3490 100644 (file)
@@ -31,6 +31,7 @@
 static int dsp_use;
 static struct clk *api_clk;
 static struct clk *dsp_clk;
+static struct platform_device **omap_mcbsp_devices;
 
 static void omap1_mcbsp_request(unsigned int id)
 {
@@ -78,6 +79,17 @@ static struct omap_mcbsp_ops omap1_mcbsp_ops = {
        .free           = omap1_mcbsp_free,
 };
 
+#define OMAP7XX_MCBSP1_BASE    0xfffb1000
+#define OMAP7XX_MCBSP2_BASE    0xfffb1800
+
+#define OMAP1510_MCBSP1_BASE   0xe1011800
+#define OMAP1510_MCBSP2_BASE   0xfffb1000
+#define OMAP1510_MCBSP3_BASE   0xe1017000
+
+#define OMAP1610_MCBSP1_BASE   0xe1011800
+#define OMAP1610_MCBSP2_BASE   0xfffb1000
+#define OMAP1610_MCBSP3_BASE   0xe1017000
+
 #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
 struct resource omap7xx_mcbsp_res[][6] = {
        {
@@ -369,6 +381,39 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
 #define OMAP16XX_MCBSP_COUNT           0
 #endif
 
+static void omap_mcbsp_register_board_cfg(struct resource *res, int res_count,
+                       struct omap_mcbsp_platform_data *config, int size)
+{
+       int i;
+
+       omap_mcbsp_devices = kzalloc(size * sizeof(struct platform_device *),
+                                    GFP_KERNEL);
+       if (!omap_mcbsp_devices) {
+               printk(KERN_ERR "Could not register McBSP devices\n");
+               return;
+       }
+
+       for (i = 0; i < size; i++) {
+               struct platform_device *new_mcbsp;
+               int ret;
+
+               new_mcbsp = platform_device_alloc("omap-mcbsp", i + 1);
+               if (!new_mcbsp)
+                       continue;
+               platform_device_add_resources(new_mcbsp, &res[i * res_count],
+                                       res_count);
+               config[i].reg_size = 2;
+               config[i].reg_step = 2;
+               new_mcbsp->dev.platform_data = &config[i];
+               ret = platform_device_add(new_mcbsp);
+               if (ret) {
+                       platform_device_put(new_mcbsp);
+                       continue;
+               }
+               omap_mcbsp_devices[i] = new_mcbsp;
+       }
+}
+
 static int __init omap1_mcbsp_init(void)
 {
        if (!cpu_class_is_omap1())
index 550ca9d9991d5b1fe1994ddd3c8871c800ae918c..93ae8f29727e61a002bcf705a6d2492f4772023a 100644 (file)
@@ -7,7 +7,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -24,7 +24,6 @@
 
 #include <plat/board.h>
 #include <plat/mux.h>
-#include <mach/gpio.h>
 #include <plat/fpga.h>
 
 #include "pm.h"
diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c
new file mode 100644 (file)
index 0000000..6e90665
--- /dev/null
@@ -0,0 +1,173 @@
+/**
+ * OMAP1 Dual-Mode Timers - platform device registration
+ *
+ * Contains first level initialization routines which internally
+ * generates timer device information and registers with linux
+ * device model. It also has low level function to chnage the timer
+ * input clock source.
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ * Tarun Kanti DebBarma <tarun.kanti@ti.com>
+ * Thara Gopinath <thara@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.
+ *
+ * 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/clk.h>
+#include <linux/io.h>
+#include <linux/err.h>
+#include <linux/slab.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+
+#include <plat/dmtimer.h>
+
+#define OMAP1610_GPTIMER1_BASE         0xfffb1400
+#define OMAP1610_GPTIMER2_BASE         0xfffb1c00
+#define OMAP1610_GPTIMER3_BASE         0xfffb2400
+#define OMAP1610_GPTIMER4_BASE         0xfffb2c00
+#define OMAP1610_GPTIMER5_BASE         0xfffb3400
+#define OMAP1610_GPTIMER6_BASE         0xfffb3c00
+#define OMAP1610_GPTIMER7_BASE         0xfffb7400
+#define OMAP1610_GPTIMER8_BASE         0xfffbd400
+
+#define OMAP1_DM_TIMER_COUNT           8
+
+static int omap1_dm_timer_set_src(struct platform_device *pdev,
+                               int source)
+{
+       int n = (pdev->id - 1) << 1;
+       u32 l;
+
+       l = __raw_readl(MOD_CONF_CTRL_1) & ~(0x03 << n);
+       l |= source << n;
+       __raw_writel(l, MOD_CONF_CTRL_1);
+
+       return 0;
+}
+
+
+int __init omap1_dm_timer_init(void)
+{
+       int i;
+       int ret;
+       struct dmtimer_platform_data *pdata;
+       struct platform_device *pdev;
+
+       if (!cpu_is_omap16xx())
+               return 0;
+
+       for (i = 1; i <= OMAP1_DM_TIMER_COUNT; i++) {
+               struct resource res[2];
+               u32 base, irq;
+
+               switch (i) {
+               case 1:
+                       base = OMAP1610_GPTIMER1_BASE;
+                       irq = INT_1610_GPTIMER1;
+                       break;
+               case 2:
+                       base = OMAP1610_GPTIMER2_BASE;
+                       irq = INT_1610_GPTIMER2;
+                       break;
+               case 3:
+                       base = OMAP1610_GPTIMER3_BASE;
+                       irq = INT_1610_GPTIMER3;
+                       break;
+               case 4:
+                       base = OMAP1610_GPTIMER4_BASE;
+                       irq = INT_1610_GPTIMER4;
+                       break;
+               case 5:
+                       base = OMAP1610_GPTIMER5_BASE;
+                       irq = INT_1610_GPTIMER5;
+                       break;
+               case 6:
+                       base = OMAP1610_GPTIMER6_BASE;
+                       irq = INT_1610_GPTIMER6;
+                       break;
+               case 7:
+                       base = OMAP1610_GPTIMER7_BASE;
+                       irq = INT_1610_GPTIMER7;
+                       break;
+               case 8:
+                       base = OMAP1610_GPTIMER8_BASE;
+                       irq = INT_1610_GPTIMER8;
+                       break;
+               default:
+                       /*
+                        * not supposed to reach here.
+                        * this is to remove warning.
+                        */
+                       return -EINVAL;
+               }
+
+               pdev = platform_device_alloc("omap_timer", i);
+               if (!pdev) {
+                       pr_err("%s: Failed to device alloc for dmtimer%d\n",
+                               __func__, i);
+                       return -ENOMEM;
+               }
+
+               memset(res, 0, 2 * sizeof(struct resource));
+               res[0].start = base;
+               res[0].end = base + 0x46;
+               res[0].flags = IORESOURCE_MEM;
+               res[1].start = irq;
+               res[1].end = irq;
+               res[1].flags = IORESOURCE_IRQ;
+               ret = platform_device_add_resources(pdev, res,
+                               ARRAY_SIZE(res));
+               if (ret) {
+                       dev_err(&pdev->dev, "%s: Failed to add resources.\n",
+                               __func__);
+                       goto err_free_pdev;
+               }
+
+               pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+               if (!pdata) {
+                       dev_err(&pdev->dev, "%s: Failed to allocate pdata.\n",
+                               __func__);
+                       ret = -ENOMEM;
+                       goto err_free_pdata;
+               }
+
+               pdata->set_timer_src = omap1_dm_timer_set_src;
+               pdata->needs_manual_reset = 1;
+
+               ret = platform_device_add_data(pdev, pdata, sizeof(*pdata));
+               if (ret) {
+                       dev_err(&pdev->dev, "%s: Failed to add platform data.\n",
+                               __func__);
+                       goto err_free_pdata;
+               }
+
+               ret = platform_device_add(pdev);
+               if (ret) {
+                       dev_err(&pdev->dev, "%s: Failed to add platform device.\n",
+                               __func__);
+                       goto err_free_pdata;
+               }
+
+               dev_dbg(&pdev->dev, " Registered.\n");
+       }
+
+       return 0;
+
+err_free_pdata:
+       kfree(pdata);
+
+err_free_pdev:
+       platform_device_unregister(pdev);
+
+       return ret;
+}
+arch_initcall(omap1_dm_timer_init);
index 57b66d590c522994f923bb01329453d9d14a7330..e0a318df95bc074b58f9ce1aa1a54a2e6794857a 100644 (file)
@@ -106,9 +106,13 @@ comment "OMAP Board Type"
        depends on ARCH_OMAP2PLUS
 
 config MACH_OMAP_GENERIC
-       bool "Generic OMAP board"
-       depends on ARCH_OMAP2
+       bool "Generic OMAP2+ board"
+       depends on ARCH_OMAP2PLUS
+       select USE_OF
        default y
+       help
+         Support for generic TI OMAP2+ boards using Flattened Device Tree.
+         More information at Documentation/devicetree
 
 config MACH_OMAP2_TUSB6010
        bool
index f34336560437655dfd24db7a52aa26983f8d2b6b..512978586b2b619f979b87919c7c5042940d320d 100644 (file)
@@ -89,14 +89,13 @@ obj-$(CONFIG_ARCH_OMAP4)            += prcm.o cm2xxx_3xxx.o cminst44xx.o \
                                           vp44xx_data.o
 
 # OMAP voltage domains
-ifeq ($(CONFIG_PM),y)
-voltagedomain-common                   := voltage.o
-obj-$(CONFIG_ARCH_OMAP2)               += $(voltagedomain-common)
+voltagedomain-common                   := voltage.o vc.o vp.o
+obj-$(CONFIG_ARCH_OMAP2)               += $(voltagedomain-common) \
+                                          voltagedomains2xxx_data.o
 obj-$(CONFIG_ARCH_OMAP3)               += $(voltagedomain-common) \
                                           voltagedomains3xxx_data.o
 obj-$(CONFIG_ARCH_OMAP4)               += $(voltagedomain-common) \
                                           voltagedomains44xx_data.o
-endif
 
 # OMAP powerdomain framework
 powerdomain-common                     += powerdomain.o powerdomain-common.o
@@ -116,9 +115,12 @@ obj-$(CONFIG_ARCH_OMAP4)           += $(powerdomain-common) \
 obj-$(CONFIG_ARCH_OMAP2)               += clockdomain.o \
                                           clockdomain2xxx_3xxx.o \
                                           clockdomains2xxx_3xxx_data.o
+obj-$(CONFIG_SOC_OMAP2420)             += clockdomains2420_data.o
+obj-$(CONFIG_SOC_OMAP2430)             += clockdomains2430_data.o
 obj-$(CONFIG_ARCH_OMAP3)               += clockdomain.o \
                                           clockdomain2xxx_3xxx.o \
-                                          clockdomains2xxx_3xxx_data.o
+                                          clockdomains2xxx_3xxx_data.o \
+                                          clockdomains3xxx_data.o
 obj-$(CONFIG_ARCH_OMAP4)               += clockdomain.o \
                                           clockdomain44xx.o \
                                           clockdomains44xx_data.o
@@ -185,78 +187,66 @@ endif
 # Specific board support
 obj-$(CONFIG_MACH_OMAP_GENERIC)                += board-generic.o
 obj-$(CONFIG_MACH_OMAP_H4)             += board-h4.o
-obj-$(CONFIG_MACH_OMAP_2430SDP)                += board-2430sdp.o \
-                                          hsmmc.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 \
-                                          hsmmc.o
-obj-$(CONFIG_MACH_DEVKIT8000)          += board-devkit8000.o \
-                                           hsmmc.o
-obj-$(CONFIG_MACH_OMAP_LDP)            += board-ldp.o \
-                                          board-flash.o \
-                                          hsmmc.o
-obj-$(CONFIG_MACH_OMAP3530_LV_SOM)      += board-omap3logic.o \
-                                          hsmmc.o
-obj-$(CONFIG_MACH_OMAP3_TORPEDO)        += board-omap3logic.o \
-                                          hsmmc.o
-obj-$(CONFIG_MACH_OVERO)               += board-overo.o \
-                                          hsmmc.o
-obj-$(CONFIG_MACH_OMAP3EVM)            += board-omap3evm.o \
-                                          hsmmc.o
-obj-$(CONFIG_MACH_OMAP3_PANDORA)       += board-omap3pandora.o \
-                                          hsmmc.o
-obj-$(CONFIG_MACH_OMAP_3430SDP)                += board-3430sdp.o \
-                                          hsmmc.o \
-                                          board-flash.o
+obj-$(CONFIG_MACH_OMAP3_BEAGLE)                += board-omap3beagle.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_ENCORE)              += board-omap3encore.o
+obj-$(CONFIG_MACH_OVERO)               += board-overo.o
+obj-$(CONFIG_MACH_OMAP3EVM)            += board-omap3evm.o
+obj-$(CONFIG_MACH_OMAP3_PANDORA)       += board-omap3pandora.o
+obj-$(CONFIG_MACH_OMAP_3430SDP)                += board-3430sdp.o
 obj-$(CONFIG_MACH_NOKIA_N8X0)          += board-n8x0.o
 obj-$(CONFIG_MACH_NOKIA_RM680)         += board-rm680.o \
-                                          sdram-nokia.o \
-                                          hsmmc.o
+                                          sdram-nokia.o
 obj-$(CONFIG_MACH_NOKIA_RX51)          += board-rx51.o \
                                           sdram-nokia.o \
                                           board-rx51-peripherals.o \
-                                          board-rx51-video.o \
-                                          hsmmc.o
+                                          board-rx51-video.o
 obj-$(CONFIG_MACH_OMAP_ZOOM2)          += board-zoom.o \
                                           board-zoom-peripherals.o \
                                           board-zoom-display.o \
-                                          board-flash.o \
-                                          hsmmc.o \
                                           board-zoom-debugboard.o
 obj-$(CONFIG_MACH_OMAP_ZOOM3)          += board-zoom.o \
                                           board-zoom-peripherals.o \
                                           board-zoom-display.o \
-                                          board-flash.o \
-                                          hsmmc.o \
                                           board-zoom-debugboard.o
 obj-$(CONFIG_MACH_OMAP_3630SDP)                += board-3630sdp.o \
                                           board-zoom-peripherals.o \
-                                          board-zoom-display.o \
-                                          board-flash.o \
-                                          hsmmc.o
-obj-$(CONFIG_MACH_CM_T35)              += board-cm-t35.o \
-                                          hsmmc.o
+                                          board-zoom-display.o
+obj-$(CONFIG_MACH_CM_T35)              += board-cm-t35.o
 obj-$(CONFIG_MACH_CM_T3517)            += board-cm-t3517.o
-obj-$(CONFIG_MACH_IGEP0020)            += board-igep0020.o \
-                                          hsmmc.o
-obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK)     += board-omap3touchbook.o \
-                                          hsmmc.o
+obj-$(CONFIG_MACH_IGEP0020)            += board-igep0020.o
+obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK)     += board-omap3touchbook.o
 obj-$(CONFIG_MACH_OMAP_4430SDP)                += board-4430sdp.o \
-                                          hsmmc.o \
                                           omap_phy_internal.o
 obj-$(CONFIG_MACH_OMAP4_PANDA)         += board-omap4panda.o \
-                                          hsmmc.o \
+                                          omap_phy_internal.o
+
+obj-$(CONFIG_MACH_PCM049)              += board-omap4pcm049.o \
                                           omap_phy_internal.o
 
 obj-$(CONFIG_MACH_OMAP3517EVM)         += board-am3517evm.o \
-                                          omap_phy_internal.o \
+                                          omap_phy_internal.o
 
 obj-$(CONFIG_MACH_CRANEBOARD)          += board-am3517crane.o
 
-obj-$(CONFIG_MACH_SBC3530)             += board-omap3stalker.o \
-                                          hsmmc.o
+obj-$(CONFIG_MACH_SBC3530)             += board-omap3stalker.o
 obj-$(CONFIG_MACH_TI8168EVM)           += board-ti8168evm.o
+
 # Platform specific device init code
+
+omap-flash-$(CONFIG_MTD_NAND_OMAP2)    := board-flash.o
+omap-flash-$(CONFIG_MTD_ONENAND_OMAP2) := board-flash.o
+obj-y                                  += $(omap-flash-y) $(omap-flash-m)
+
+omap-hsmmc-$(CONFIG_MMC_OMAP_HS)       := hsmmc.o
+obj-y                                  += $(omap-hsmmc-m) $(omap-hsmmc-y)
+
+
 usbfs-$(CONFIG_ARCH_OMAP_OTG)          := usb-fs.o
 obj-y                                  += $(usbfs-m) $(usbfs-y)
 obj-y                                  += usb-musb.o
index 195157da21e6d51bd414a4a848955977e50b4aa4..638cecb9ea1acf8586641352ada1363230e36f63 100644 (file)
@@ -141,12 +141,6 @@ static struct omap_board_config_kernel sdp2430_config[] __initdata = {
        {OMAP_TAG_LCD, &sdp2430_lcd_config},
 };
 
-static void __init omap_2430sdp_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(NULL, NULL);
-}
-
 static struct regulator_consumer_supply sdp2430_vmmc1_supplies[] = {
        REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
 };
@@ -193,7 +187,8 @@ static int __init omap2430_i2c_init(void)
 {
        omap_register_i2c_bus(1, 100, sdp2430_i2c1_boardinfo,
                        ARRAY_SIZE(sdp2430_i2c1_boardinfo));
-       omap2_pmic_init("twl4030", &sdp2430_twldata);
+       omap_pmic_init(2, 100, "twl4030", INT_24XX_SYS_NIRQ,
+                       &sdp2430_twldata);
        return 0;
 }
 
@@ -235,6 +230,7 @@ static void __init omap_2430sdp_init(void)
 
        platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
        omap_serial_init();
+       omap_sdrc_init(NULL, NULL);
        omap2_hsmmc_init(mmc);
        omap2_usbfs_init(&sdp2430_usb_config);
 
@@ -248,18 +244,12 @@ static void __init omap_2430sdp_init(void)
                         "Secondary LCD backlight");
 }
 
-static void __init omap_2430sdp_map_io(void)
-{
-       omap2_set_globals_243x();
-       omap243x_map_common_io();
-}
-
 MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
        /* Maintainer: Syed Khasim - Texas Instruments Inc */
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
-       .map_io         = omap_2430sdp_map_io,
-       .init_early     = omap_2430sdp_init_early,
+       .map_io         = omap243x_map_io,
+       .init_early     = omap2430_init_early,
        .init_irq       = omap2_init_irq,
        .init_machine   = omap_2430sdp_init,
        .timer          = &omap2_timer,
index 2430531b2239d6c9b369301833683558b4d53180..5b5999caf71d1ed84090dff3ea51f798d5062416 100644 (file)
@@ -225,12 +225,6 @@ static struct omap_dss_board_info sdp3430_dss_data = {
 static struct omap_board_config_kernel sdp3430_config[] __initdata = {
 };
 
-static void __init omap_3430sdp_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(hyb18m512160af6_sdrc_params, NULL);
-}
-
 static struct omap2_hsmmc_info mmc[] = {
        {
                .mmc            = 1,
@@ -719,6 +713,7 @@ static void __init omap_3430sdp_init(void)
                gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV1;
        omap_ads7846_init(1, gpio_pendown, 310, NULL);
        board_serial_init();
+       omap_sdrc_init(hyb18m512160af6_sdrc_params, NULL);
        usb_musb_init(NULL);
        board_smc91x_init();
        board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
@@ -732,7 +727,7 @@ MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = omap_3430sdp_init_early,
+       .init_early     = omap3430_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = omap_3430sdp_init,
        .timer          = &omap3_timer,
index 8b5b5aa751ed07c7b08a6c1c5a809c624ac073dc..f552305162fc59f87ecd93d2b26bec5da1f75846 100644 (file)
@@ -70,13 +70,6 @@ static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
 static struct omap_board_config_kernel sdp_config[] __initdata = {
 };
 
-static void __init omap_sdp_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(h8mbx00u0mer0em_sdrc_params,
-                                 h8mbx00u0mer0em_sdrc_params);
-}
-
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux board_mux[] __initdata = {
        { .reg_offset = OMAP_MUX_TERMINATOR },
@@ -207,6 +200,8 @@ static void __init omap_sdp_init(void)
        omap_board_config = sdp_config;
        omap_board_config_size = ARRAY_SIZE(sdp_config);
        zoom_peripherals_init();
+       omap_sdrc_init(h8mbx00u0mer0em_sdrc_params,
+                                 h8mbx00u0mer0em_sdrc_params);
        zoom_display_init();
        board_smc91x_init();
        board_flash_init(sdp_flash_partitions, chip_sel_sdp, NAND_BUSWIDTH_16);
@@ -218,7 +213,7 @@ MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = omap_sdp_init_early,
+       .init_early     = omap3630_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = omap_sdp_init,
        .timer          = &omap3_timer,
index be931105d681e27a413df624b92a9d403d572cfe..6d2b61409c1bd3301551b6c9eec4bfe57edb0488 100644 (file)
@@ -129,7 +129,7 @@ static const int sdp4430_keymap[] = {
        KEY(7, 6, KEY_OK),
        KEY(7, 7, KEY_DOWN),
 };
-static struct omap_device_pad keypad_pads[] __initdata = {
+static struct omap_device_pad keypad_pads[] = {
        {       .name   = "kpd_col1.kpd_col1",
                .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
        },
@@ -389,12 +389,6 @@ static struct omap_board_config_kernel sdp4430_config[] __initdata = {
        { OMAP_TAG_LCD,         &sdp4430_lcd_config },
 };
 
-static void __init omap_4430sdp_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(NULL, NULL);
-}
-
 static struct omap_musb_board_data musb_board_data = {
        .interface_type         = MUSB_INTERFACE_UTMI,
        .mode                   = MUSB_OTG,
@@ -809,6 +803,7 @@ static void __init omap_4430sdp_init(void)
        omap_sfh7741prox_init();
        platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
        board_serial_init();
+       omap_sdrc_init(NULL, NULL);
        omap4_sdp4430_wifi_init();
        omap4_twl6030_hsmmc_init(mmc);
 
@@ -830,18 +825,12 @@ static void __init omap_4430sdp_init(void)
        omap_4430sdp_display_init();
 }
 
-static void __init omap_4430sdp_map_io(void)
-{
-       omap2_set_globals_443x();
-       omap44xx_map_common_io();
-}
-
 MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
        /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
-       .map_io         = omap_4430sdp_map_io,
-       .init_early     = omap_4430sdp_init_early,
+       .map_io         = omap4_map_io,
+       .init_early     = omap4430_init_early,
        .init_irq       = gic_init_irq,
        .init_machine   = omap_4430sdp_init,
        .timer          = &omap4_timer,
index db110fdb8b2c4b3af81f2a1f4b9835afe5162b42..7834536ab41666ca2b2ff720a068023f3a48f765 100644 (file)
@@ -47,12 +47,6 @@ static struct omap_board_mux board_mux[] __initdata = {
 };
 #endif
 
-static void __init am3517_crane_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(NULL, NULL);
-}
-
 static struct usbhs_omap_board_data usbhs_bdata __initdata = {
        .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
        .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
@@ -70,6 +64,7 @@ static void __init am3517_crane_init(void)
 
        omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
        omap_serial_init();
+       omap_sdrc_init(NULL, NULL);
 
        omap_board_config = am3517_crane_config;
        omap_board_config_size = ARRAY_SIZE(am3517_crane_config);
@@ -101,7 +96,7 @@ MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = am3517_crane_init_early,
+       .init_early     = am35xx_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = am3517_crane_init,
        .timer          = &omap3_timer,
index 1325085e453d8ab62a31255f9bf2aaf1c32a0b7f..65a5912278ac49c04cc6d46b5fc00bbc19754a23 100644 (file)
@@ -362,11 +362,6 @@ static struct omap_dss_board_info am3517_evm_dss_data = {
 /*
  * Board initialization
  */
-static void __init am3517_evm_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(NULL, NULL);
-}
 
 static struct omap_musb_board_data musb_board_data = {
        .interface_type         = MUSB_INTERFACE_ULPI,
@@ -469,6 +464,7 @@ static void __init am3517_evm_init(void)
        am3517_evm_i2c_init();
        omap_display_init(&am3517_evm_dss_data);
        omap_serial_init();
+       omap_sdrc_init(NULL, NULL);
 
        /* Configure GPIO for EHCI port */
        omap_mux_init_gpio(57, OMAP_PIN_OUTPUT);
@@ -493,7 +489,7 @@ MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = am3517_evm_init_early,
+       .init_early     = am35xx_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = am3517_evm_init,
        .timer          = &omap3_timer,
index 67800e647d7a888799316bb2a68f3340cbe155da..29c409b68b5255eaaed1a07730fff50f135dd6c7 100644 (file)
@@ -273,12 +273,6 @@ static struct omap_board_config_kernel apollon_config[] __initdata = {
        { OMAP_TAG_LCD,         &apollon_lcd_config },
 };
 
-static void __init omap_apollon_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(NULL, NULL);
-}
-
 static struct gpio apollon_gpio_leds[] __initdata = {
        { LED0_GPIO13, GPIOF_OUT_INIT_LOW, "LED0" }, /* LED0 - AA10 */
        { LED1_GPIO14, GPIOF_OUT_INIT_LOW, "LED1" }, /* LED1 - AA6  */
@@ -340,20 +334,15 @@ static void __init omap_apollon_init(void)
         */
        platform_add_devices(apollon_devices, ARRAY_SIZE(apollon_devices));
        omap_serial_init();
-}
-
-static void __init omap_apollon_map_io(void)
-{
-       omap2_set_globals_242x();
-       omap242x_map_common_io();
+       omap_sdrc_init(NULL, NULL);
 }
 
 MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon")
        /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
-       .map_io         = omap_apollon_map_io,
-       .init_early     = omap_apollon_init_early,
+       .map_io         = omap242x_map_io,
+       .init_early     = omap2420_init_early,
        .init_irq       = omap2_init_irq,
        .init_machine   = omap_apollon_init,
        .timer          = &omap2_timer,
index 38179c17550359133b21f72c62af985c2d1b7113..5665e688bd26bb65d8fcaf9422f43c347a1cbb7a 100644 (file)
@@ -471,13 +471,6 @@ static void __init cm_t35_init_i2c(void)
        omap3_pmic_init("tps65930", &cm_t35_twldata);
 }
 
-static void __init cm_t35_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
-                            mt46h32m32lf6_sdrc_params);
-}
-
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux board_mux[] __initdata = {
        /* nCS and IRQ for CM-T35 ethernet */
@@ -610,6 +603,8 @@ static void __init cm_t3x_common_init(void)
        omap_board_config_size = ARRAY_SIZE(cm_t35_config);
        omap3_mux_init(board_mux, OMAP_PACKAGE_CUS);
        omap_serial_init();
+       omap_sdrc_init(mt46h32m32lf6_sdrc_params,
+                            mt46h32m32lf6_sdrc_params);
        cm_t35_init_i2c();
        omap_ads7846_init(1, CM_T35_GPIO_PENDOWN, 0, NULL);
        cm_t35_init_ethernet();
@@ -637,7 +632,7 @@ MACHINE_START(CM_T35, "Compulab CM-T35")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = cm_t35_init_early,
+       .init_early     = omap35xx_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = cm_t35_init,
        .timer          = &omap3_timer,
@@ -647,7 +642,7 @@ MACHINE_START(CM_T3730, "Compulab CM-T3730")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = cm_t35_init_early,
+       .init_early     = omap3630_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = cm_t3730_init,
        .timer          = &omap3_timer,
index aed9c29f9faea7c31b60bc01e588ffa1edb7cfb9..3f4dc6626845db9069a7193823de24025a93864c 100644 (file)
@@ -251,12 +251,6 @@ static inline void cm_t3517_init_nand(void) {}
 static struct omap_board_config_kernel cm_t3517_config[] __initdata = {
 };
 
-static void __init cm_t3517_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(NULL, NULL);
-}
-
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux board_mux[] __initdata = {
        /* GPIO186 - Green LED */
@@ -289,6 +283,7 @@ static void __init cm_t3517_init(void)
 {
        omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
        omap_serial_init();
+       omap_sdrc_init(NULL, NULL);
        omap_board_config = cm_t3517_config;
        omap_board_config_size = ARRAY_SIZE(cm_t3517_config);
        cm_t3517_init_leds();
@@ -302,7 +297,7 @@ MACHINE_START(CM_T3517, "Compulab CM-T3517")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = cm_t3517_init_early,
+       .init_early     = am35xx_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = cm_t3517_init,
        .timer          = &omap3_timer,
index 99a42432ac93526a2b054f4fa31381037a149a7b..556df32d88eafdc5168c7fdbdf4a04a5112b1dc8 100644 (file)
@@ -397,19 +397,6 @@ static struct platform_device keys_gpio = {
        },
 };
 
-
-static void __init devkit8000_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
-                                 mt46h32m32lf6_sdrc_params);
-}
-
-static void __init devkit8000_init_irq(void)
-{
-       omap3_init_irq();
-}
-
 #define OMAP_DM9000_BASE       0x2c000000
 
 static struct resource omap_dm9000_resources[] = {
@@ -645,6 +632,8 @@ static void __init devkit8000_init(void)
 {
        omap3_mux_init(board_mux, OMAP_PACKAGE_CUS);
        omap_serial_init();
+       omap_sdrc_init(mt46h32m32lf6_sdrc_params,
+                                 mt46h32m32lf6_sdrc_params);
 
        omap_dm9000_init();
 
@@ -670,8 +659,8 @@ MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = devkit8000_init_early,
-       .init_irq       = devkit8000_init_irq,
+       .init_early     = omap35xx_init_early,
+       .init_irq       = omap3_init_irq,
        .init_machine   = devkit8000_init,
        .timer          = &omap3_secure_timer,
 MACHINE_END
index aa1b0cbe19d2a63ecf7ce906ffab053af6194dad..30a6f527510c05e624a692c936642693badba97e 100644 (file)
@@ -148,11 +148,6 @@ __init board_nand_init(struct mtd_partition *nand_parts,
        board_nand_data.gpmc_irq = OMAP_GPMC_IRQ_BASE + cs;
        gpmc_nand_init(&board_nand_data);
 }
-#else
-void
-__init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs, int nand_type)
-{
-}
 #endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
 
 /**
index c240a3f8d163b7958f83b721347eb2390db41e3e..d25503a98417d6d8b02a5bd1fb8ace8af1e9fcf3 100644 (file)
@@ -24,7 +24,26 @@ struct flash_partitions {
        int nr_parts;
 };
 
+#if defined(CONFIG_MTD_NAND_OMAP2) || \
+               defined(CONFIG_MTD_NAND_OMAP2_MODULE) || \
+               defined(CONFIG_MTD_ONENAND_OMAP2) || \
+               defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
 extern void board_flash_init(struct flash_partitions [],
                                char chip_sel[][GPMC_CS_NUM], int nand_type);
+#else
+static inline void board_flash_init(struct flash_partitions part[],
+                               char chip_sel[][GPMC_CS_NUM], int nand_type)
+{
+}
+#endif
+
+#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);
+#else
+static inline void board_nand_init(struct mtd_partition *nand_parts,
+                                       u8 nr_parts, u8 cs, int nand_type)
+{
+}
+#endif
index 25642697281b6d21ddf68fee8ef681524980eaaa..67f0a122e18bdb2cdf1bb0ccae2a6fd4edbd4368 100644 (file)
 /*
- * linux/arch/arm/mach-omap2/board-generic.c
- *
  * Copyright (C) 2005 Nokia Corporation
  * Author: Paul Mundt <paul.mundt@nokia.com>
  *
- * Modified from mach-omap/omap1/board-generic.c
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
  *
- * Code for generic OMAP2 board. Should work on many OMAP2 systems where
- * the bootloader passes the board-specific data to the kernel.
- * Do not put any board specific code to this file; create a new machine
- * type if you need custom low-level initializations.
+ * Modified from the original mach-omap/omap2/board-generic.c did by Paul
+ * to support the OMAP2+ device tree boards with an unique board file.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/device.h>
+#include <linux/io.h>
+#include <linux/of_platform.h>
+#include <linux/irqdomain.h>
+#include <linux/i2c/twl.h>
 
 #include <mach/hardware.h>
-#include <asm/mach-types.h>
 #include <asm/mach/arch.h>
-#include <asm/mach/map.h>
 
-#include <mach/gpio.h>
 #include <plat/usb.h>
 #include <plat/board.h>
 #include <plat/common.h>
+#include <mach/omap4-common.h>
+#include "common-board-devices.h"
 
-static struct omap_board_config_kernel generic_config[] = {
+/*
+ * XXX: Still needed to boot until the i2c & twl driver is adapted to
+ * device-tree
+ */
+static struct twl4030_platform_data sdp4430_twldata = {
+       .irq_base       = TWL6030_IRQ_BASE,
+       .irq_end        = TWL6030_IRQ_END,
 };
 
-static void __init omap_generic_init_early(void)
+static void __init omap4_i2c_init(void)
 {
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(NULL, NULL);
+       omap4_pmic_init("twl6030", &sdp4430_twldata);
 }
 
+static struct twl4030_platform_data beagle_twldata = {
+       .irq_base       = TWL4030_IRQ_BASE,
+       .irq_end        = TWL4030_IRQ_END,
+};
+
+static void __init omap3_i2c_init(void)
+{
+       omap3_pmic_init("twl4030", &beagle_twldata);
+}
+
+static struct of_device_id omap_dt_match_table[] __initdata = {
+       { .compatible = "simple-bus", },
+       { .compatible = "ti,omap-infra", },
+       { }
+};
+
+static struct of_device_id intc_match[] __initdata = {
+       { .compatible = "ti,omap3-intc", },
+       { .compatible = "arm,cortex-a9-gic", },
+       { }
+};
+
 static void __init omap_generic_init(void)
 {
+       struct device_node *node = of_find_matching_node(NULL, intc_match);
+       if (node)
+               irq_domain_add_simple(node, 0);
+
        omap_serial_init();
-       omap_board_config = generic_config;
-       omap_board_config_size = ARRAY_SIZE(generic_config);
+       omap_sdrc_init(NULL, NULL);
+
+       of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
+}
+
+static void __init omap4_init(void)
+{
+       omap4_i2c_init();
+       omap_generic_init();
 }
 
-static void __init omap_generic_map_io(void)
+static void __init omap3_init(void)
 {
-       if (cpu_is_omap242x()) {
-               omap2_set_globals_242x();
-               omap242x_map_common_io();
-       } else if (cpu_is_omap243x()) {
-               omap2_set_globals_243x();
-               omap243x_map_common_io();
-       } else if (cpu_is_omap34xx()) {
-               omap2_set_globals_3xxx();
-               omap34xx_map_common_io();
-       } else if (cpu_is_omap44xx()) {
-               omap2_set_globals_443x();
-               omap44xx_map_common_io();
-       }
+       omap3_i2c_init();
+       omap_generic_init();
 }
 
-/* XXX This machine entry name should be updated */
-MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
-       /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
+#if defined(CONFIG_SOC_OMAP2420)
+static const char *omap242x_boards_compat[] __initdata = {
+       "ti,omap2420",
+       NULL,
+};
+
+DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
-       .map_io         = omap_generic_map_io,
-       .init_early     = omap_generic_init_early,
+       .map_io         = omap242x_map_io,
+       .init_early     = omap2420_init_early,
        .init_irq       = omap2_init_irq,
        .init_machine   = omap_generic_init,
        .timer          = &omap2_timer,
+       .dt_compat      = omap242x_boards_compat,
+MACHINE_END
+#endif
+
+#if defined(CONFIG_SOC_OMAP2430)
+static const char *omap243x_boards_compat[] __initdata = {
+       "ti,omap2430",
+       NULL,
+};
+
+DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
+       .atag_offset    = 0x100,
+       .reserve        = omap_reserve,
+       .map_io         = omap243x_map_io,
+       .init_early     = omap2430_init_early,
+       .init_irq       = omap2_init_irq,
+       .init_machine   = omap_generic_init,
+       .timer          = &omap2_timer,
+       .dt_compat      = omap243x_boards_compat,
+MACHINE_END
+#endif
+
+#if defined(CONFIG_ARCH_OMAP3)
+static const char *omap3_boards_compat[] __initdata = {
+       "ti,omap3",
+       NULL,
+};
+
+DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
+       .atag_offset    = 0x100,
+       .reserve        = omap_reserve,
+       .map_io         = omap3_map_io,
+       .init_early     = omap3430_init_early,
+       .init_irq       = omap3_init_irq,
+       .init_machine   = omap3_init,
+       .timer          = &omap3_timer,
+       .dt_compat      = omap3_boards_compat,
+MACHINE_END
+#endif
+
+#if defined(CONFIG_ARCH_OMAP4)
+static const char *omap4_boards_compat[] __initdata = {
+       "ti,omap4",
+       NULL,
+};
+
+DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
+       .atag_offset    = 0x100,
+       .reserve        = omap_reserve,
+       .map_io         = omap4_map_io,
+       .init_early     = omap4430_init_early,
+       .init_irq       = gic_init_irq,
+       .init_machine   = omap4_init,
+       .timer          = &omap4_timer,
+       .dt_compat      = omap4_boards_compat,
 MACHINE_END
+#endif
index a58c6ba06f7f87ed189f6b16d1c35f7cb5d26ddb..a65effe7e8d5893b2c86a43d12259a7d1f2b764f 100644 (file)
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -31,7 +31,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/gpio.h>
 #include <plat/usb.h>
 #include <plat/board.h>
 #include <plat/common.h>
@@ -290,17 +289,6 @@ static struct omap_board_config_kernel h4_config[] __initdata = {
        { OMAP_TAG_LCD,         &h4_lcd_config },
 };
 
-static void __init omap_h4_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(NULL, NULL);
-}
-
-static void __init omap_h4_init_irq(void)
-{
-       omap2_init_irq();
-}
-
 static struct at24_platform_data m24c01 = {
        .byte_len       = SZ_1K / 8,
        .page_size      = 16,
@@ -371,22 +359,17 @@ static void __init omap_h4_init(void)
        platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices));
        omap2_usbfs_init(&h4_usb_config);
        omap_serial_init();
+       omap_sdrc_init(NULL, NULL);
        h4_init_flash();
 }
 
-static void __init omap_h4_map_io(void)
-{
-       omap2_set_globals_242x();
-       omap242x_map_common_io();
-}
-
 MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
        /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
-       .map_io         = omap_h4_map_io,
-       .init_early     = omap_h4_init_early,
-       .init_irq       = omap_h4_init_irq,
+       .map_io         = omap242x_map_io,
+       .init_early     = omap2420_init_early,
+       .init_irq       = omap2_init_irq,
        .init_machine   = omap_h4_init,
        .timer          = &omap2_timer,
 MACHINE_END
index 7040352b16b4dc3b5b7655cf1cbf279b8dba4136..e20cad6a0835a72179823b09c095e3e1fc84ef55 100644 (file)
@@ -491,13 +491,6 @@ static struct platform_device *igep_devices[] __initdata = {
        &igep_vwlan_device,
 };
 
-static void __init igep_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(m65kxxxxam_sdrc_params,
-                                 m65kxxxxam_sdrc_params);
-}
-
 static int igep2_keymap[] = {
        KEY(0, 0, KEY_LEFT),
        KEY(0, 1, KEY_RIGHT),
@@ -650,6 +643,8 @@ static void __init igep_init(void)
        igep_i2c_init();
        platform_add_devices(igep_devices, ARRAY_SIZE(igep_devices));
        omap_serial_init();
+       omap_sdrc_init(m65kxxxxam_sdrc_params,
+                                 m65kxxxxam_sdrc_params);
        usb_musb_init(NULL);
 
        igep_flash_init();
@@ -675,7 +670,7 @@ MACHINE_START(IGEP0020, "IGEP v2 board")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = igep_init_early,
+       .init_early     = omap35xx_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = igep_init,
        .timer          = &omap3_timer,
@@ -685,7 +680,7 @@ MACHINE_START(IGEP0030, "IGEP OMAP3 module")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = igep_init_early,
+       .init_early     = omap35xx_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = igep_init,
        .timer          = &omap3_timer,
index edf752bb24b1f153598a9a6cef813a041d85a85a..57979175cff36e5368c3419aceb76e2b43da9c91 100644 (file)
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -34,7 +34,6 @@
 #include <asm/mach/map.h>
 
 #include <plat/mcspi.h>
-#include <mach/gpio.h>
 #include <plat/board.h>
 #include <plat/common.h>
 #include <plat/gpmc.h>
@@ -193,12 +192,6 @@ static struct omap_board_config_kernel ldp_config[] __initdata = {
        { OMAP_TAG_LCD,         &ldp_lcd_config },
 };
 
-static void __init omap_ldp_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(NULL, NULL);
-}
-
 static struct twl4030_gpio_platform_data ldp_gpio_data = {
        .gpio_base      = OMAP_MAX_GPIO_LINES,
        .irq_base       = TWL4030_GPIO_IRQ_BASE,
@@ -325,6 +318,7 @@ static void __init omap_ldp_init(void)
        platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices));
        omap_ads7846_init(1, 54, 310, NULL);
        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);
@@ -336,7 +330,7 @@ MACHINE_START(OMAP_LDP, "OMAP LDP board")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = omap_ldp_init_early,
+       .init_early     = omap3430_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = omap_ldp_init,
        .timer          = &omap3_timer,
index 6ce748154f244e1500e8823beb482bc0095cd1a1..e9d5f4a3d0642dd0b553da23987136e9864e3d70 100644 (file)
@@ -616,18 +616,6 @@ static struct i2c_board_info n810_i2c_board_info_2[] __initdata = {
        },
 };
 
-static void __init n8x0_map_io(void)
-{
-       omap2_set_globals_242x();
-       omap242x_map_common_io();
-}
-
-static void __init n8x0_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(NULL, NULL);
-}
-
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux board_mux[] __initdata = {
        /* I2S codec port pins for McBSP block */
@@ -689,6 +677,7 @@ static void __init n8x0_init_machine(void)
                i2c_register_board_info(2, n810_i2c_board_info_2,
                                        ARRAY_SIZE(n810_i2c_board_info_2));
        board_serial_init();
+       omap_sdrc_init(NULL, NULL);
        gpmc_onenand_init(board_onenand_data);
        n8x0_mmc_init();
        n8x0_usb_init();
@@ -697,8 +686,8 @@ static void __init n8x0_init_machine(void)
 MACHINE_START(NOKIA_N800, "Nokia N800")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
-       .map_io         = n8x0_map_io,
-       .init_early     = n8x0_init_early,
+       .map_io         = omap242x_map_io,
+       .init_early     = omap2420_init_early,
        .init_irq       = omap2_init_irq,
        .init_machine   = n8x0_init_machine,
        .timer          = &omap2_timer,
@@ -707,8 +696,8 @@ MACHINE_END
 MACHINE_START(NOKIA_N810, "Nokia N810")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
-       .map_io         = n8x0_map_io,
-       .init_early     = n8x0_init_early,
+       .map_io         = omap242x_map_io,
+       .init_early     = omap2420_init_early,
        .init_irq       = omap2_init_irq,
        .init_machine   = n8x0_init_machine,
        .timer          = &omap2_timer,
@@ -717,8 +706,8 @@ MACHINE_END
 MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
-       .map_io         = n8x0_map_io,
-       .init_early     = n8x0_init_early,
+       .map_io         = omap242x_map_io,
+       .init_early     = omap2420_init_early,
        .init_irq       = omap2_init_irq,
        .init_machine   = n8x0_init_machine,
        .timer          = &omap2_timer,
index 1fde8a0474bbb077877697164026f330252a7dbf..0b8e0fc03aabde7e57a63f54cf86df3bc5278e51 100644 (file)
@@ -447,13 +447,6 @@ static struct platform_device keys_gpio = {
 static void __init omap3_beagle_init_early(void)
 {
        omap2_init_common_infrastructure();
-       omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
-                                 mt46h32m32lf6_sdrc_params);
-}
-
-static void __init omap3_beagle_init_irq(void)
-{
-       omap3_init_irq();
 }
 
 static struct platform_device *omap3_beagle_devices[] __initdata = {
@@ -493,8 +486,8 @@ static void __init beagle_opp_init(void)
        if (cpu_is_omap3630()) {
                struct device *mpu_dev, *iva_dev;
 
-               mpu_dev = omap2_get_mpuss_device();
-               iva_dev = omap2_get_iva_device();
+               mpu_dev = omap_device_get_by_hwmod_name("mpu");
+               iva_dev = omap_device_get_by_hwmod_name("iva");
 
                if (!mpu_dev || !iva_dev) {
                        pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n",
@@ -534,6 +527,8 @@ static void __init omap3_beagle_init(void)
                        ARRAY_SIZE(omap3_beagle_devices));
        omap_display_init(&beagle_dss_data);
        omap_serial_init();
+       omap_sdrc_init(mt46h32m32lf6_sdrc_params,
+                                 mt46h32m32lf6_sdrc_params);
 
        omap_mux_init_gpio(170, OMAP_PIN_INPUT);
        /* REVISIT leave DVI powered down until it's needed ... */
@@ -561,7 +556,7 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
        .init_early     = omap3_beagle_init_early,
-       .init_irq       = omap3_beagle_init_irq,
+       .init_irq       = omap3_init_irq,
        .init_machine   = omap3_beagle_init,
        .timer          = &omap3_secure_timer,
 MACHINE_END
index 15c69a0c1ce5050e20883ed124b262d3652ed4fd..aa6a9351ce48a036a5e68c70bf0a95e282dcacd7 100644 (file)
@@ -520,12 +520,6 @@ static int __init omap3_evm_i2c_init(void)
 static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
 };
 
-static void __init omap3_evm_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(mt46h32m32lf6_sdrc_params, NULL);
-}
-
 static struct usbhs_omap_board_data usbhs_bdata __initdata = {
 
        .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
@@ -640,6 +634,7 @@ static void __init omap3_evm_init(void)
        omap_display_init(&omap3_evm_dss_data);
 
        omap_serial_init();
+       omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL);
 
        /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
        usb_nop_xceiv_register();
@@ -684,7 +679,7 @@ MACHINE_START(OMAP3EVM, "OMAP3 EVM")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = omap3_evm_init_early,
+       .init_early     = omap35xx_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = omap3_evm_init,
        .timer          = &omap3_timer,
index 01354a214cafcd3da4283bd7c8943dda4539a475..7c0f193f246dd58e5bc008cfb939c610b73ed65c 100644 (file)
@@ -182,12 +182,6 @@ static inline void __init board_smsc911x_init(void)
        gpmc_smsc911x_init(&board_smsc911x_data);
 }
 
-static void __init omap3logic_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(NULL, NULL);
-}
-
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux board_mux[] __initdata = {
        { .reg_offset = OMAP_MUX_TERMINATOR },
@@ -200,6 +194,7 @@ static void __init omap3logic_init(void)
        omap3torpedo_fix_pbias_voltage();
        omap3logic_i2c_init();
        omap_serial_init();
+       omap_sdrc_init(NULL, NULL);
        board_mmc_init();
        board_smsc911x_init();
 
@@ -211,7 +206,7 @@ static void __init omap3logic_init(void)
 MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
        .atag_offset    = 0x100,
        .map_io         = omap3_map_io,
-       .init_early     = omap3logic_init_early,
+       .init_early     = omap35xx_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = omap3logic_init,
        .timer          = &omap3_timer,
@@ -220,7 +215,7 @@ MACHINE_END
 MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
        .atag_offset    = 0x100,
        .map_io         = omap3_map_io,
-       .init_early     = omap3logic_init_early,
+       .init_early     = omap35xx_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = omap3logic_init,
        .timer          = &omap3_timer,
index ace56938dd3b2816f6782264ddb3e2eb541e09cd..fed2f7dfdf8b71131d7be3a987916135d7685c0f 100644 (file)
@@ -525,13 +525,6 @@ static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
        }
 };
 
-static void __init omap3pandora_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
-                                 mt46h32m32lf6_sdrc_params);
-}
-
 static void __init pandora_wl1251_init(void)
 {
        struct wl12xx_platform_data pandora_wl1251_pdata;
@@ -593,6 +586,8 @@ static void __init omap3pandora_init(void)
                        ARRAY_SIZE(omap3pandora_devices));
        omap_display_init(&pandora_dss_data);
        omap_serial_init();
+       omap_sdrc_init(mt46h32m32lf6_sdrc_params,
+                                 mt46h32m32lf6_sdrc_params);
        spi_register_board_info(omap3pandora_spi_board_info,
                        ARRAY_SIZE(omap3pandora_spi_board_info));
        omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL);
@@ -609,7 +604,7 @@ MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = omap3pandora_init_early,
+       .init_early     = omap35xx_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = omap3pandora_init,
        .timer          = &omap3_timer,
index ba13e1d5d0abecb251066987bd30a79094b11bf2..170e1ebd6e6247095c414bc2607593d1bfa8b176 100644 (file)
@@ -428,17 +428,6 @@ static int __init omap3_stalker_i2c_init(void)
 static struct omap_board_config_kernel omap3_stalker_config[] __initdata = {
 };
 
-static void __init omap3_stalker_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(mt46h32m32lf6_sdrc_params, NULL);
-}
-
-static void __init omap3_stalker_init_irq(void)
-{
-       omap3_init_irq();
-}
-
 static struct platform_device *omap3_stalker_devices[] __initdata = {
        &keys_gpio,
 };
@@ -478,6 +467,7 @@ static void __init omap3_stalker_init(void)
        omap_display_init(&omap3_stalker_dss_data);
 
        omap_serial_init();
+       omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL);
        usb_musb_init(NULL);
        usbhs_init(&usbhs_bdata);
        omap_ads7846_init(1, OMAP3_STALKER_TS_GPIO, 310, NULL);
@@ -496,8 +486,8 @@ MACHINE_START(SBC3530, "OMAP3 STALKER")
        /* Maintainer: Jason Lam -lzg@ema-tech.com */
        .atag_offset            = 0x100,
        .map_io                 = omap3_map_io,
-       .init_early             = omap3_stalker_init_early,
-       .init_irq               = omap3_stalker_init_irq,
+       .init_early             = omap35xx_init_early,
+       .init_irq               = omap3_init_irq,
        .init_machine           = omap3_stalker_init,
        .timer                  = &omap3_secure_timer,
 MACHINE_END
index 49e4bd207cb6924285c051f80b1b8c7d4b9fea78..c2d5348f54225a35c5ea7b15fa5ff19974bdf852 100644 (file)
@@ -326,18 +326,6 @@ static struct omap_board_mux board_mux[] __initdata = {
 };
 #endif
 
-static void __init omap3_touchbook_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
-                                 mt46h32m32lf6_sdrc_params);
-}
-
-static void __init omap3_touchbook_init_irq(void)
-{
-       omap3_init_irq();
-}
-
 static struct platform_device *omap3_touchbook_devices[] __initdata = {
        &omap3_touchbook_lcd_device,
        &leds_gpio,
@@ -385,6 +373,8 @@ static void __init omap3_touchbook_init(void)
        platform_add_devices(omap3_touchbook_devices,
                        ARRAY_SIZE(omap3_touchbook_devices));
        omap_serial_init();
+       omap_sdrc_init(mt46h32m32lf6_sdrc_params,
+                                 mt46h32m32lf6_sdrc_params);
 
        omap_mux_init_gpio(170, OMAP_PIN_INPUT);
        /* REVISIT leave DVI powered down until it's needed ... */
@@ -407,8 +397,8 @@ MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = omap3_touchbook_init_early,
-       .init_irq       = omap3_touchbook_init_irq,
+       .init_early     = omap3430_init_early,
+       .init_irq       = omap3_init_irq,
        .init_machine   = omap3_touchbook_init,
        .timer          = &omap3_secure_timer,
 MACHINE_END
index 683bede73d540a060761850e60867f166db325e2..2141894eb9f379096bd277c573d1cd1f581f8611 100644 (file)
@@ -95,12 +95,6 @@ static struct platform_device *panda_devices[] __initdata = {
        &wl1271_device,
 };
 
-static void __init omap4_panda_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(NULL, NULL);
-}
-
 static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
        .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
        .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
@@ -569,24 +563,19 @@ static void __init omap4_panda_init(void)
        platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
        platform_device_register(&omap_vwlan_device);
        board_serial_init();
+       omap_sdrc_init(NULL, NULL);
        omap4_twl6030_hsmmc_init(mmc);
        omap4_ehci_init();
        usb_musb_init(&musb_board_data);
        omap4_panda_display_init();
 }
 
-static void __init omap4_panda_map_io(void)
-{
-       omap2_set_globals_443x();
-       omap44xx_map_common_io();
-}
-
 MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
        /* Maintainer: David Anders - Texas Instruments Inc */
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
-       .map_io         = omap4_panda_map_io,
-       .init_early     = omap4_panda_init_early,
+       .map_io         = omap4_map_io,
+       .init_early     = omap4430_init_early,
        .init_irq       = gic_init_irq,
        .init_machine   = omap4_panda_init,
        .timer          = &omap4_timer,
index e592fb134c4e8708798b33f61f9a88f747e4944d..9f13dc22df778842e9488964fdc004c104c20427 100644 (file)
@@ -478,13 +478,6 @@ static int __init overo_spi_init(void)
        return 0;
 }
 
-static void __init overo_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
-                                 mt46h32m32lf6_sdrc_params);
-}
-
 static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
        .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
        .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
@@ -514,6 +507,8 @@ static void __init overo_init(void)
        overo_i2c_init();
        omap_display_init(&overo_dss_data);
        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));
        usb_musb_init(NULL);
@@ -564,7 +559,7 @@ MACHINE_START(OVERO, "Gumstix Overo")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = overo_init_early,
+       .init_early     = omap35xx_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = overo_init,
        .timer          = &omap3_timer,
index 9a8ce239ba9ecafa72f2b13366a436a54ad07549..616fb39763b0f4b82d9885a7057a0c0a6bdc6cde 100644 (file)
@@ -123,15 +123,6 @@ static void __init rm680_peripherals_init(void)
        omap2_hsmmc_init(mmc);
 }
 
-static void __init rm680_init_early(void)
-{
-       struct omap_sdrc_params *sdrc_params;
-
-       omap2_init_common_infrastructure();
-       sdrc_params = nokia_get_sdram_timings();
-       omap2_init_common_devices(sdrc_params, sdrc_params);
-}
-
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux board_mux[] __initdata = {
        { .reg_offset = OMAP_MUX_TERMINATOR },
@@ -140,23 +131,23 @@ static struct omap_board_mux board_mux[] __initdata = {
 
 static void __init rm680_init(void)
 {
+       struct omap_sdrc_params *sdrc_params;
+
        omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
        omap_serial_init();
+
+       sdrc_params = nokia_get_sdram_timings();
+       omap_sdrc_init(sdrc_params, sdrc_params);
+
        usb_musb_init(NULL);
        rm680_peripherals_init();
 }
 
-static void __init rm680_map_io(void)
-{
-       omap2_set_globals_3xxx();
-       omap34xx_map_common_io();
-}
-
 MACHINE_START(NOKIA_RM680, "Nokia RM-680 board")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
-       .map_io         = rm680_map_io,
-       .init_early     = rm680_init_early,
+       .map_io         = omap3_map_io,
+       .init_early     = omap3630_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = rm680_init,
        .timer          = &omap3_timer,
index a6c473bbb3d6392d7b6cc2c03d42d2d1176c17a9..74c8aadc0a19927f0de86247c544658a84a192a5 100644 (file)
@@ -102,15 +102,6 @@ static struct omap_board_config_kernel rx51_config[] = {
        { OMAP_TAG_LCD,         &rx51_lcd_config },
 };
 
-static void __init rx51_init_early(void)
-{
-       struct omap_sdrc_params *sdrc_params;
-
-       omap2_init_common_infrastructure();
-       sdrc_params = nokia_get_sdram_timings();
-       omap2_init_common_devices(sdrc_params, sdrc_params);
-}
-
 extern void __init rx51_peripherals_init(void);
 
 #ifdef CONFIG_OMAP_MUX
@@ -127,11 +118,17 @@ static struct omap_musb_board_data musb_board_data = {
 
 static void __init rx51_init(void)
 {
+       struct omap_sdrc_params *sdrc_params;
+
        omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
        omap_board_config = rx51_config;
        omap_board_config_size = ARRAY_SIZE(rx51_config);
        omap3_pm_init_cpuidle(rx51_cpuidle_params);
        omap_serial_init();
+
+       sdrc_params = nokia_get_sdram_timings();
+       omap_sdrc_init(sdrc_params, sdrc_params);
+
        usb_musb_init(&musb_board_data);
        rx51_peripherals_init();
 
@@ -142,12 +139,6 @@ static void __init rx51_init(void)
        platform_device_register(&leds_gpio);
 }
 
-static void __init rx51_map_io(void)
-{
-       omap2_set_globals_3xxx();
-       omap34xx_map_common_io();
-}
-
 static void __init rx51_reserve(void)
 {
        rx51_video_mem_init();
@@ -158,8 +149,8 @@ MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
        /* Maintainer: Lauri Leukkunen <lauri.leukkunen@nokia.com> */
        .atag_offset    = 0x100,
        .reserve        = rx51_reserve,
-       .map_io         = rx51_map_io,
-       .init_early     = rx51_init_early,
+       .map_io         = omap3_map_io,
+       .init_early     = omap3430_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = rx51_init,
        .timer          = &omap3_timer,
index e41958acb6b63ba240493632c4674408cc867093..e26c79cb6ce99bad5c355e5916ee8a8284b13bec 100644 (file)
 static struct omap_board_config_kernel ti8168_evm_config[] __initdata = {
 };
 
-static void __init ti8168_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       omap2_init_common_devices(NULL, NULL);
-}
-
 static void __init ti8168_evm_init(void)
 {
        omap_serial_init();
+       omap_sdrc_init(NULL, NULL);
        omap_board_config = ti8168_evm_config;
        omap_board_config_size = ARRAY_SIZE(ti8168_evm_config);
 }
@@ -50,7 +45,7 @@ MACHINE_START(TI8168EVM, "ti8168evm")
        /* Maintainer: Texas Instruments */
        .atag_offset    = 0x100,
        .map_io         = ti8168_evm_map_io,
-       .init_early     = ti8168_init_early,
+       .init_early     = ti816x_init_early,
        .init_irq       = ti816x_init_irq,
        .timer          = &omap3_timer,
        .init_machine   = ti8168_evm_init,
index 72f1db4863e598cfa775440da83419f85935a308..be6684dc4f55d6a0c33ada72fc5f15f25b807f60 100644 (file)
 
 #define ZOOM3_EHCI_RESET_GPIO          64
 
-static void __init omap_zoom_init_early(void)
-{
-       omap2_init_common_infrastructure();
-       if (machine_is_omap_zoom2())
-               omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
-                                         mt46h32m32lf6_sdrc_params);
-       else if (machine_is_omap_zoom3())
-               omap2_init_common_devices(h8mbx00u0mer0em_sdrc_params,
-                                         h8mbx00u0mer0em_sdrc_params);
-}
-
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux board_mux[] __initdata = {
        /* WLAN IRQ - GPIO 162 */
@@ -129,6 +118,14 @@ static void __init omap_zoom_init(void)
                                                ZOOM_NAND_CS, NAND_BUSWIDTH_16);
        zoom_debugboard_init();
        zoom_peripherals_init();
+
+       if (machine_is_omap_zoom2())
+               omap_sdrc_init(mt46h32m32lf6_sdrc_params,
+                                         mt46h32m32lf6_sdrc_params);
+       else if (machine_is_omap_zoom3())
+               omap_sdrc_init(h8mbx00u0mer0em_sdrc_params,
+                                         h8mbx00u0mer0em_sdrc_params);
+
        zoom_display_init();
 }
 
@@ -136,7 +133,7 @@ MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = omap_zoom_init_early,
+       .init_early     = omap3430_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = omap_zoom_init,
        .timer          = &omap3_timer,
@@ -146,7 +143,7 @@ MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
        .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
-       .init_early     = omap_zoom_init_early,
+       .init_early     = omap3630_init_early,
        .init_irq       = omap3_init_irq,
        .init_machine   = omap_zoom_init,
        .timer          = &omap3_timer,
index debc040872f1b14940204c14def09a7081117c8e..14a6277dd184c0e27323efbd1cef5161c3c60562 100644 (file)
@@ -1898,6 +1898,54 @@ static struct omap_clk omap2420_clks[] = {
        CLK(NULL,       "pka_ick",      &pka_ick,       CK_242X),
        CLK(NULL,       "usb_fck",      &usb_fck,       CK_242X),
        CLK("musb-hdrc",        "fck",  &osc_ck,        CK_242X),
+       CLK("omap_timer.1",     "fck",  &gpt1_fck,      CK_242X),
+       CLK("omap_timer.2",     "fck",  &gpt2_fck,      CK_242X),
+       CLK("omap_timer.3",     "fck",  &gpt3_fck,      CK_242X),
+       CLK("omap_timer.4",     "fck",  &gpt4_fck,      CK_242X),
+       CLK("omap_timer.5",     "fck",  &gpt5_fck,      CK_242X),
+       CLK("omap_timer.6",     "fck",  &gpt6_fck,      CK_242X),
+       CLK("omap_timer.7",     "fck",  &gpt7_fck,      CK_242X),
+       CLK("omap_timer.8",     "fck",  &gpt8_fck,      CK_242X),
+       CLK("omap_timer.9",     "fck",  &gpt9_fck,      CK_242X),
+       CLK("omap_timer.10",    "fck",  &gpt10_fck,     CK_242X),
+       CLK("omap_timer.11",    "fck",  &gpt11_fck,     CK_242X),
+       CLK("omap_timer.12",    "fck",  &gpt12_fck,     CK_242X),
+       CLK("omap_timer.1",     "32k_ck",       &func_32k_ck,   CK_243X),
+       CLK("omap_timer.2",     "32k_ck",       &func_32k_ck,   CK_243X),
+       CLK("omap_timer.3",     "32k_ck",       &func_32k_ck,   CK_243X),
+       CLK("omap_timer.4",     "32k_ck",       &func_32k_ck,   CK_243X),
+       CLK("omap_timer.5",     "32k_ck",       &func_32k_ck,   CK_243X),
+       CLK("omap_timer.6",     "32k_ck",       &func_32k_ck,   CK_243X),
+       CLK("omap_timer.7",     "32k_ck",       &func_32k_ck,   CK_243X),
+       CLK("omap_timer.8",     "32k_ck",       &func_32k_ck,   CK_243X),
+       CLK("omap_timer.9",     "32k_ck",       &func_32k_ck,   CK_243X),
+       CLK("omap_timer.10",    "32k_ck",       &func_32k_ck,   CK_243X),
+       CLK("omap_timer.11",    "32k_ck",       &func_32k_ck,   CK_243X),
+       CLK("omap_timer.12",    "32k_ck",       &func_32k_ck,   CK_243X),
+       CLK("omap_timer.1",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.2",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.3",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.4",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.5",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.6",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.7",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.8",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.9",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.10",    "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.11",    "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.12",    "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.1",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.2",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.3",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.4",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.5",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.6",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.7",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.8",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.9",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.10",    "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.11",    "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.12",    "alt_ck",       &alt_ck,        CK_243X),
 };
 
 /*
index 96a942e42db197facb0ce1b4348a3806cb22f310..ea6717cfa3c84245b390502349eb262850e7df23 100644 (file)
@@ -1998,6 +1998,54 @@ static struct omap_clk omap2430_clks[] = {
        CLK(NULL,       "mdm_intc_ick", &mdm_intc_ick,  CK_243X),
        CLK("omap_hsmmc.0", "mmchsdb_fck",      &mmchsdb1_fck,  CK_243X),
        CLK("omap_hsmmc.1", "mmchsdb_fck",      &mmchsdb2_fck,  CK_243X),
+       CLK("omap_timer.1",     "fck",  &gpt1_fck,      CK_243X),
+       CLK("omap_timer.2",     "fck",  &gpt2_fck,      CK_243X),
+       CLK("omap_timer.3",     "fck",  &gpt3_fck,      CK_243X),
+       CLK("omap_timer.4",     "fck",  &gpt4_fck,      CK_243X),
+       CLK("omap_timer.5",     "fck",  &gpt5_fck,      CK_243X),
+       CLK("omap_timer.6",     "fck",  &gpt6_fck,      CK_243X),
+       CLK("omap_timer.7",     "fck",  &gpt7_fck,      CK_243X),
+       CLK("omap_timer.8",     "fck",  &gpt8_fck,      CK_243X),
+       CLK("omap_timer.9",     "fck",  &gpt9_fck,      CK_243X),
+       CLK("omap_timer.10",    "fck",  &gpt10_fck,     CK_243X),
+       CLK("omap_timer.11",    "fck",  &gpt11_fck,     CK_243X),
+       CLK("omap_timer.12",    "fck",  &gpt12_fck,     CK_243X),
+       CLK("omap_timer.1",     "32k_ck",  &func_32k_ck,   CK_243X),
+       CLK("omap_timer.2",     "32k_ck",  &func_32k_ck,   CK_243X),
+       CLK("omap_timer.3",     "32k_ck",  &func_32k_ck,   CK_243X),
+       CLK("omap_timer.4",     "32k_ck",  &func_32k_ck,   CK_243X),
+       CLK("omap_timer.5",     "32k_ck",  &func_32k_ck,   CK_243X),
+       CLK("omap_timer.6",     "32k_ck",  &func_32k_ck,   CK_243X),
+       CLK("omap_timer.7",     "32k_ck",  &func_32k_ck,   CK_243X),
+       CLK("omap_timer.8",     "32k_ck",  &func_32k_ck,   CK_243X),
+       CLK("omap_timer.9",     "32k_ck",  &func_32k_ck,   CK_243X),
+       CLK("omap_timer.10",    "32k_ck",  &func_32k_ck,   CK_243X),
+       CLK("omap_timer.11",    "32k_ck",  &func_32k_ck,   CK_243X),
+       CLK("omap_timer.12",    "32k_ck",  &func_32k_ck,   CK_243X),
+       CLK("omap_timer.1",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.2",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.3",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.4",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.5",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.6",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.7",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.8",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.9",     "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.10",    "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.11",    "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.12",    "sys_ck",       &sys_ck,        CK_243X),
+       CLK("omap_timer.1",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.2",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.3",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.4",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.5",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.6",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.7",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.8",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.9",     "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.10",    "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.11",    "alt_ck",       &alt_ck,        CK_243X),
+       CLK("omap_timer.12",    "alt_ck",       &alt_ck,        CK_243X),
 };
 
 /*
index b9b8446831477facb05a7192d94701245c2b211f..65dd363163bccdfa6890b112458aac36e1b7f704 100644 (file)
@@ -3464,6 +3464,42 @@ static struct omap_clk omap3xxx_clks[] = {
        CLK("musb-am35x",       "fck",          &hsotgusb_fck_am35xx,   CK_AM35XX),
        CLK(NULL,       "hecc_ck",      &hecc_ck,       CK_AM35XX),
        CLK(NULL,       "uart4_ick",    &uart4_ick_am35xx,      CK_AM35XX),
+       CLK("omap_timer.1",     "fck",  &gpt1_fck,      CK_3XXX),
+       CLK("omap_timer.2",     "fck",  &gpt2_fck,      CK_3XXX),
+       CLK("omap_timer.3",     "fck",  &gpt3_fck,      CK_3XXX),
+       CLK("omap_timer.4",     "fck",  &gpt4_fck,      CK_3XXX),
+       CLK("omap_timer.5",     "fck",  &gpt5_fck,      CK_3XXX),
+       CLK("omap_timer.6",     "fck",  &gpt6_fck,      CK_3XXX),
+       CLK("omap_timer.7",     "fck",  &gpt7_fck,      CK_3XXX),
+       CLK("omap_timer.8",     "fck",  &gpt8_fck,      CK_3XXX),
+       CLK("omap_timer.9",     "fck",  &gpt9_fck,      CK_3XXX),
+       CLK("omap_timer.10",    "fck",  &gpt10_fck,     CK_3XXX),
+       CLK("omap_timer.11",    "fck",  &gpt11_fck,     CK_3XXX),
+       CLK("omap_timer.12",    "fck",  &gpt12_fck,     CK_3XXX),
+       CLK("omap_timer.1",     "32k_ck",       &omap_32k_fck,  CK_3XXX),
+       CLK("omap_timer.2",     "32k_ck",       &omap_32k_fck,  CK_3XXX),
+       CLK("omap_timer.3",     "32k_ck",       &omap_32k_fck,  CK_3XXX),
+       CLK("omap_timer.4",     "32k_ck",       &omap_32k_fck,  CK_3XXX),
+       CLK("omap_timer.5",     "32k_ck",       &omap_32k_fck,  CK_3XXX),
+       CLK("omap_timer.6",     "32k_ck",       &omap_32k_fck,  CK_3XXX),
+       CLK("omap_timer.7",     "32k_ck",       &omap_32k_fck,  CK_3XXX),
+       CLK("omap_timer.8",     "32k_ck",       &omap_32k_fck,  CK_3XXX),
+       CLK("omap_timer.9",     "32k_ck",       &omap_32k_fck,  CK_3XXX),
+       CLK("omap_timer.10",    "32k_ck",       &omap_32k_fck,  CK_3XXX),
+       CLK("omap_timer.11",    "32k_ck",       &omap_32k_fck,  CK_3XXX),
+       CLK("omap_timer.12",    "32k_ck",       &omap_32k_fck,  CK_3XXX),
+       CLK("omap_timer.1",     "sys_ck",       &sys_ck,        CK_3XXX),
+       CLK("omap_timer.2",     "sys_ck",       &sys_ck,        CK_3XXX),
+       CLK("omap_timer.3",     "sys_ck",       &sys_ck,        CK_3XXX),
+       CLK("omap_timer.4",     "sys_ck",       &sys_ck,        CK_3XXX),
+       CLK("omap_timer.5",     "sys_ck",       &sys_ck,        CK_3XXX),
+       CLK("omap_timer.6",     "sys_ck",       &sys_ck,        CK_3XXX),
+       CLK("omap_timer.7",     "sys_ck",       &sys_ck,        CK_3XXX),
+       CLK("omap_timer.8",     "sys_ck",       &sys_ck,        CK_3XXX),
+       CLK("omap_timer.9",     "sys_ck",       &sys_ck,        CK_3XXX),
+       CLK("omap_timer.10",    "sys_ck",       &sys_ck,        CK_3XXX),
+       CLK("omap_timer.11",    "sys_ck",       &sys_ck,        CK_3XXX),
+       CLK("omap_timer.12",    "sys_ck",       &sys_ck,        CK_3XXX),
 };
 
 
@@ -3472,7 +3508,16 @@ int __init omap3xxx_clk_init(void)
        struct omap_clk *c;
        u32 cpu_clkflg = 0;
 
-       if (cpu_is_omap3517()) {
+       /*
+        * 3505 must be tested before 3517, since 3517 returns true
+        * for both AM3517 chips and AM3517 family chips, which
+        * includes 3505.  Unfortunately there's no obvious family
+        * test for 3517/3505 :-(
+        */
+       if (cpu_is_omap3505()) {
+               cpu_mask = RATE_IN_34XX;
+               cpu_clkflg = CK_3505;
+       } else if (cpu_is_omap3517()) {
                cpu_mask = RATE_IN_34XX;
                cpu_clkflg = CK_3517;
        } else if (cpu_is_omap3505()) {
index c0b6fbda340898257247193f60bb8a7f7bfaf5ff..946bf04a956db5638035ea591c262d3944e8a3d2 100644 (file)
@@ -3363,6 +3363,39 @@ static struct omap_clk omap44xx_clks[] = {
        CLK("usbhs-omap.0",     "usbhost_ick",          &dummy_ck,              CK_443X),
        CLK("usbhs-omap.0",     "usbtll_fck",           &dummy_ck,      CK_443X),
        CLK("omap_wdt", "ick",                          &dummy_ck,      CK_443X),
+       CLK("omap_timer.1",     "fck",                  &timer1_fck,    CK_443X),
+       CLK("omap_timer.2",     "fck",                  &timer2_fck,    CK_443X),
+       CLK("omap_timer.3",     "fck",                  &timer3_fck,    CK_443X),
+       CLK("omap_timer.4",     "fck",                  &timer4_fck,    CK_443X),
+       CLK("omap_timer.5",     "fck",                  &timer5_fck,    CK_443X),
+       CLK("omap_timer.6",     "fck",                  &timer6_fck,    CK_443X),
+       CLK("omap_timer.7",     "fck",                  &timer7_fck,    CK_443X),
+       CLK("omap_timer.8",     "fck",                  &timer8_fck,    CK_443X),
+       CLK("omap_timer.9",     "fck",                  &timer9_fck,    CK_443X),
+       CLK("omap_timer.10",    "fck",                  &timer10_fck,   CK_443X),
+       CLK("omap_timer.11",    "fck",                  &timer11_fck,   CK_443X),
+       CLK("omap_timer.1",     "32k_ck",       &sys_32k_ck,    CK_443X),
+       CLK("omap_timer.2",     "32k_ck",       &sys_32k_ck,    CK_443X),
+       CLK("omap_timer.3",     "32k_ck",       &sys_32k_ck,    CK_443X),
+       CLK("omap_timer.4",     "32k_ck",       &sys_32k_ck,    CK_443X),
+       CLK("omap_timer.5",     "32k_ck",       &sys_32k_ck,    CK_443X),
+       CLK("omap_timer.6",     "32k_ck",       &sys_32k_ck,    CK_443X),
+       CLK("omap_timer.7",     "32k_ck",       &sys_32k_ck,    CK_443X),
+       CLK("omap_timer.8",     "32k_ck",       &sys_32k_ck,    CK_443X),
+       CLK("omap_timer.9",     "32k_ck",       &sys_32k_ck,    CK_443X),
+       CLK("omap_timer.10",    "32k_ck",       &sys_32k_ck,    CK_443X),
+       CLK("omap_timer.11",    "32k_ck",       &sys_32k_ck,    CK_443X),
+       CLK("omap_timer.1",     "sys_ck",       &sys_clkin_ck,  CK_443X),
+       CLK("omap_timer.2",     "sys_ck",       &sys_clkin_ck,  CK_443X),
+       CLK("omap_timer.3",     "sys_ck",       &sys_clkin_ck,  CK_443X),
+       CLK("omap_timer.4",     "sys_ck",       &sys_clkin_ck,  CK_443X),
+       CLK("omap_timer.9",     "sys_ck",       &sys_clkin_ck,  CK_443X),
+       CLK("omap_timer.10",    "sys_ck",       &sys_clkin_ck,  CK_443X),
+       CLK("omap_timer.11",    "sys_ck",       &sys_clkin_ck,  CK_443X),
+       CLK("omap_timer.5",     "sys_ck",       &syc_clk_div_ck,        CK_443X),
+       CLK("omap_timer.6",     "sys_ck",       &syc_clk_div_ck,        CK_443X),
+       CLK("omap_timer.7",     "sys_ck",       &syc_clk_div_ck,        CK_443X),
+       CLK("omap_timer.8",     "sys_ck",       &syc_clk_div_ck,        CK_443X),
 };
 
 int __init omap4xxx_clk_init(void)
index 8f0890685d7b10f7f594e9cd44c8a972c33d15e9..8480ee4344ea0ad1d12ef437735585efb25d34ea 100644 (file)
@@ -73,9 +73,6 @@ static int _clkdm_register(struct clockdomain *clkdm)
        if (!clkdm || !clkdm->name)
                return -EINVAL;
 
-       if (!omap_chip_is(clkdm->omap_chip))
-               return -EINVAL;
-
        pwrdm = pwrdm_lookup(clkdm->pwrdm.name);
        if (!pwrdm) {
                pr_err("clockdomain: %s: powerdomain %s does not exist\n",
@@ -105,13 +102,10 @@ static struct clkdm_dep *_clkdm_deps_lookup(struct clockdomain *clkdm,
 {
        struct clkdm_dep *cd;
 
-       if (!clkdm || !deps || !omap_chip_is(clkdm->omap_chip))
+       if (!clkdm || !deps)
                return ERR_PTR(-EINVAL);
 
        for (cd = deps; cd->clkdm_name; cd++) {
-               if (!omap_chip_is(cd->omap_chip))
-                       continue;
-
                if (!cd->clkdm && cd->clkdm_name)
                        cd->clkdm = _clkdm_lookup(cd->clkdm_name);
 
@@ -148,9 +142,6 @@ static void _autodep_lookup(struct clkdm_autodep *autodep)
        if (!autodep)
                return;
 
-       if (!omap_chip_is(autodep->omap_chip))
-               return;
-
        clkdm = clkdm_lookup(autodep->clkdm.name);
        if (!clkdm) {
                pr_err("clockdomain: autodeps: clockdomain %s does not exist\n",
@@ -182,9 +173,6 @@ void _clkdm_add_autodeps(struct clockdomain *clkdm)
                if (IS_ERR(autodep->clkdm.ptr))
                        continue;
 
-               if (!omap_chip_is(autodep->omap_chip))
-                       continue;
-
                pr_debug("clockdomain: adding %s sleepdep/wkdep for "
                         "clkdm %s\n", autodep->clkdm.ptr->name,
                         clkdm->name);
@@ -216,9 +204,6 @@ void _clkdm_del_autodeps(struct clockdomain *clkdm)
                if (IS_ERR(autodep->clkdm.ptr))
                        continue;
 
-               if (!omap_chip_is(autodep->omap_chip))
-                       continue;
-
                pr_debug("clockdomain: removing %s sleepdep/wkdep for "
                         "clkdm %s\n", autodep->clkdm.ptr->name,
                         clkdm->name);
@@ -243,8 +228,6 @@ static void _resolve_clkdm_deps(struct clockdomain *clkdm,
        struct clkdm_dep *cd;
 
        for (cd = clkdm_deps; cd && cd->clkdm_name; cd++) {
-               if (!omap_chip_is(cd->omap_chip))
-                       continue;
                if (cd->clkdm)
                        continue;
                cd->clkdm = _clkdm_lookup(cd->clkdm_name);
@@ -257,43 +240,113 @@ static void _resolve_clkdm_deps(struct clockdomain *clkdm,
 /* Public functions */
 
 /**
- * clkdm_init - set up the clockdomain layer
- * @clkdms: optional pointer to an array of clockdomains to register
- * @init_autodeps: optional pointer to an array of autodeps to register
- * @custom_funcs: func pointers for arch specific implementations
- *
- * Set up internal state.  If a pointer to an array of clockdomains
- * @clkdms was supplied, loop through the list of clockdomains,
- * register all that are available on the current platform. Similarly,
- * if a pointer to an array of clockdomain autodependencies
- * @init_autodeps was provided, register those.  No return value.
+ * clkdm_register_platform_funcs - register clockdomain implementation fns
+ * @co: func pointers for arch specific implementations
+ *
+ * Register the list of function pointers used to implement the
+ * clockdomain functions on different OMAP SoCs.  Should be called
+ * before any other clkdm_register*() function.  Returns -EINVAL if
+ * @co is null, -EEXIST if platform functions have already been
+ * registered, or 0 upon success.
+ */
+int clkdm_register_platform_funcs(struct clkdm_ops *co)
+{
+       if (!co)
+               return -EINVAL;
+
+       if (arch_clkdm)
+               return -EEXIST;
+
+       arch_clkdm = co;
+
+       return 0;
+};
+
+/**
+ * clkdm_register_clkdms - register SoC clockdomains
+ * @cs: pointer to an array of struct clockdomain to register
+ *
+ * Register the clockdomains available on a particular OMAP SoC.  Must
+ * be called after clkdm_register_platform_funcs().  May be called
+ * multiple times.  Returns -EACCES if called before
+ * clkdm_register_platform_funcs(); -EINVAL if the argument @cs is
+ * null; or 0 upon success.
  */
-void clkdm_init(struct clockdomain **clkdms,
-               struct clkdm_autodep *init_autodeps,
-               struct clkdm_ops *custom_funcs)
+int clkdm_register_clkdms(struct clockdomain **cs)
 {
        struct clockdomain **c = NULL;
-       struct clockdomain *clkdm;
-       struct clkdm_autodep *autodep = NULL;
 
-       if (!custom_funcs)
-               WARN(1, "No custom clkdm functions registered\n");
-       else
-               arch_clkdm = custom_funcs;
+       if (!arch_clkdm)
+               return -EACCES;
+
+       if (!cs)
+               return -EINVAL;
+
+       for (c = cs; *c; c++)
+               _clkdm_register(*c);
+
+       return 0;
+}
+
+/**
+ * clkdm_register_autodeps - register autodeps (if required)
+ * @ia: pointer to a static array of struct clkdm_autodep to register
+ *
+ * Register clockdomain "automatic dependencies."  These are
+ * clockdomain wakeup and sleep dependencies that are automatically
+ * added whenever the first clock inside a clockdomain is enabled, and
+ * removed whenever the last clock inside a clockdomain is disabled.
+ * These are currently only used on OMAP3 devices, and are deprecated,
+ * since they waste energy.  However, until the OMAP2/3 IP block
+ * enable/disable sequence can be converted to match the OMAP4
+ * sequence, they are needed.
+ *
+ * Must be called only after all of the SoC clockdomains are
+ * registered, since the function will resolve autodep clockdomain
+ * names into clockdomain pointers.
+ *
+ * The struct clkdm_autodep @ia array must be static, as this function
+ * does not copy the array elements.
+ *
+ * Returns -EACCES if called before any clockdomains have been
+ * registered, -EINVAL if called with a null @ia argument, -EEXIST if
+ * autodeps have already been registered, or 0 upon success.
+ */
+int clkdm_register_autodeps(struct clkdm_autodep *ia)
+{
+       struct clkdm_autodep *a = NULL;
 
-       if (clkdms)
-               for (c = clkdms; *c; c++)
-                       _clkdm_register(*c);
+       if (list_empty(&clkdm_list))
+               return -EACCES;
+
+       if (!ia)
+               return -EINVAL;
 
-       autodeps = init_autodeps;
        if (autodeps)
-               for (autodep = autodeps; autodep->clkdm.ptr; autodep++)
-                       _autodep_lookup(autodep);
+               return -EEXIST;
+
+       autodeps = ia;
+       for (a = autodeps; a->clkdm.ptr; a++)
+               _autodep_lookup(a);
+
+       return 0;
+}
+
+/**
+ * clkdm_complete_init - set up the clockdomain layer
+ *
+ * Put all clockdomains into software-supervised mode; PM code should
+ * later enable hardware-supervised mode as appropriate.  Must be
+ * called after clkdm_register_clkdms().  Returns -EACCES if called
+ * before clkdm_register_clkdms(), or 0 upon success.
+ */
+int clkdm_complete_init(void)
+{
+       struct clockdomain *clkdm;
+
+       if (list_empty(&clkdm_list))
+               return -EACCES;
 
-       /*
-        * Put all clockdomains into software-supervised mode; PM code
-        * should later enable hardware-supervised mode as appropriate
-        */
        list_for_each_entry(clkdm, &clkdm_list, node) {
                if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
                        clkdm_wakeup(clkdm);
@@ -306,6 +359,8 @@ void clkdm_init(struct clockdomain **clkdms,
                _resolve_clkdm_deps(clkdm, clkdm->sleepdep_srcs);
                clkdm_clear_all_sleepdeps(clkdm);
        }
+
+       return 0;
 }
 
 /**
index 1e50c88b8a07022c4697434ca7f024dc24b546a7..f7b58609bad888b6b276a524badf9518e450a709 100644 (file)
@@ -45,7 +45,6 @@
 /**
  * struct clkdm_autodep - clkdm deps to add when entering/exiting hwsup mode
  * @clkdm: clockdomain to add wkdep+sleepdep on - set name member only
- * @omap_chip: OMAP chip types that this autodep is valid on
  *
  * A clockdomain that should have wkdeps and sleepdeps added when a
  * clockdomain should stay active in hwsup mode; and conversely,
@@ -60,14 +59,12 @@ struct clkdm_autodep {
                const char *name;
                struct clockdomain *ptr;
        } clkdm;
-       const struct omap_chip_id omap_chip;
 };
 
 /**
  * struct clkdm_dep - encode dependencies between clockdomains
  * @clkdm_name: clockdomain name
  * @clkdm: pointer to the struct clockdomain of @clkdm_name
- * @omap_chip: OMAP chip types that this dependency is valid on
  * @wkdep_usecount: Number of wakeup dependencies causing this clkdm to wake
  * @sleepdep_usecount: Number of sleep deps that could prevent clkdm from idle
  *
@@ -81,7 +78,6 @@ struct clkdm_dep {
        struct clockdomain *clkdm;
        atomic_t wkdep_usecount;
        atomic_t sleepdep_usecount;
-       const struct omap_chip_id omap_chip;
 };
 
 /* Possible flags for struct clockdomain._flags */
@@ -101,7 +97,6 @@ struct clkdm_dep {
  * @clkdm_offs: (OMAP4 only) CM clockdomain register offset
  * @wkdep_srcs: Clockdomains that can be told to wake this powerdomain up
  * @sleepdep_srcs: Clockdomains that can be told to keep this clkdm from inact
- * @omap_chip: OMAP chip types that this clockdomain is valid on
  * @usecount: Usecount tracking
  * @node: list_head to link all clockdomains together
  *
@@ -126,7 +121,6 @@ struct clockdomain {
        const u16 clkdm_offs;
        struct clkdm_dep *wkdep_srcs;
        struct clkdm_dep *sleepdep_srcs;
-       const struct omap_chip_id omap_chip;
        atomic_t usecount;
        struct list_head node;
        spinlock_t lock;
@@ -166,8 +160,11 @@ struct clkdm_ops {
        int     (*clkdm_clk_disable)(struct clockdomain *clkdm);
 };
 
-void clkdm_init(struct clockdomain **clkdms, struct clkdm_autodep *autodeps,
-                       struct clkdm_ops *custom_funcs);
+int clkdm_register_platform_funcs(struct clkdm_ops *co);
+int clkdm_register_autodeps(struct clkdm_autodep *ia);
+int clkdm_register_clkdms(struct clockdomain **c);
+int clkdm_complete_init(void);
+
 struct clockdomain *clkdm_lookup(const char *name);
 
 int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user),
@@ -195,7 +192,8 @@ int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk);
 int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh);
 int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh);
 
-extern void __init omap2xxx_clockdomains_init(void);
+extern void __init omap242x_clockdomains_init(void);
+extern void __init omap243x_clockdomains_init(void);
 extern void __init omap3xxx_clockdomains_init(void);
 extern void __init omap44xx_clockdomains_init(void);
 extern void _clkdm_add_autodeps(struct clockdomain *clkdm);
@@ -205,4 +203,10 @@ extern struct clkdm_ops omap2_clkdm_operations;
 extern struct clkdm_ops omap3_clkdm_operations;
 extern struct clkdm_ops omap4_clkdm_operations;
 
+extern struct clkdm_dep gfx_24xx_wkdeps[];
+extern struct clkdm_dep dsp_24xx_wkdeps[];
+extern struct clockdomain wkup_common_clkdm;
+extern struct clockdomain prm_common_clkdm;
+extern struct clockdomain cm_common_clkdm;
+
 #endif
index f740edb111f4e0f62fbe12cdce9f246f138229d2..a0d68dbecfa3bb96cd52226b0f8d7965379d1252 100644 (file)
@@ -52,8 +52,6 @@ static int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm)
        u32 mask = 0;
 
        for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
-               if (!omap_chip_is(cd->omap_chip))
-                       continue;
                if (!cd->clkdm)
                        continue; /* only happens if data is erroneous */
 
@@ -98,8 +96,6 @@ static int omap3_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
        u32 mask = 0;
 
        for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) {
-               if (!omap_chip_is(cd->omap_chip))
-                       continue;
                if (!cd->clkdm)
                        continue; /* only happens if data is erroneous */
 
index b43706aa08bd89bccbce5c715f127212cafa0964..935c7f03dab97b53aced0bf2cd8fbe9a60ac6de1 100644 (file)
@@ -52,8 +52,6 @@ static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
        u32 mask = 0;
 
        for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
-               if (!omap_chip_is(cd->omap_chip))
-                       continue;
                if (!cd->clkdm)
                        continue; /* only happens if data is erroneous */
 
diff --git a/arch/arm/mach-omap2/clockdomains2420_data.c b/arch/arm/mach-omap2/clockdomains2420_data.c
new file mode 100644 (file)
index 0000000..0ab8e46
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * OMAP2420 clockdomains
+ *
+ * Copyright (C) 2008-2011 Texas Instruments, Inc.
+ * Copyright (C) 2008-2010 Nokia Corporation
+ *
+ * Paul Walmsley, Jouni Högander
+ *
+ * This file contains clockdomains and clockdomain wakeup dependencies
+ * for OMAP2420 chips.  Some notes:
+ *
+ * A useful validation rule for struct clockdomain: Any clockdomain
+ * referenced by a wkdep_srcs must have a dep_bit assigned.  So
+ * wkdep_srcs are really just software-controllable dependencies.
+ * Non-software-controllable dependencies do exist, but they are not
+ * encoded below (yet).
+ *
+ * 24xx does not support programmable sleep dependencies (SLEEPDEP)
+ *
+ * The overly-specific dep_bit names are due to a bit name collision
+ * with CM_FCLKEN_{DSP,IVA2}.  The DSP/IVA2 PM_WKDEP and CM_SLEEPDEP shift
+ * value are the same for all powerdomains: 2
+ *
+ * XXX should dep_bit be a mask, so we can test to see if it is 0 as a
+ * sanity check?
+ * XXX encode hardware fixed wakeup dependencies -- esp. for 3430 CORE
+ */
+
+/*
+ * To-Do List
+ * -> Port the Sleep/Wakeup dependencies for the domains
+ *    from the Power domain framework
+ */
+
+#include <linux/kernel.h>
+#include <linux/io.h>
+
+#include "clockdomain.h"
+#include "prm2xxx_3xxx.h"
+#include "cm2xxx_3xxx.h"
+#include "cm-regbits-24xx.h"
+#include "prm-regbits-24xx.h"
+
+/*
+ * Clockdomain dependencies for wkdeps
+ *
+ * XXX Hardware dependencies (e.g., dependencies that cannot be
+ * changed in software) are not included here yet, but should be.
+ */
+
+/* Wakeup dependency source arrays */
+
+/* 2420-specific possible wakeup dependencies */
+
+/* 2420 PM_WKDEP_MPU: CORE, DSP, WKUP */
+static struct clkdm_dep mpu_2420_wkdeps[] = {
+       { .clkdm_name = "core_l3_clkdm" },
+       { .clkdm_name = "core_l4_clkdm" },
+       { .clkdm_name = "dsp_clkdm" },
+       { .clkdm_name = "wkup_clkdm" },
+       { NULL },
+};
+
+/* 2420 PM_WKDEP_CORE: DSP, GFX, MPU, WKUP */
+static struct clkdm_dep core_2420_wkdeps[] = {
+       { .clkdm_name = "dsp_clkdm" },
+       { .clkdm_name = "gfx_clkdm" },
+       { .clkdm_name = "mpu_clkdm" },
+       { .clkdm_name = "wkup_clkdm" },
+       { NULL },
+};
+
+/*
+ * 2420-only clockdomains
+ */
+
+static struct clockdomain mpu_2420_clkdm = {
+       .name           = "mpu_clkdm",
+       .pwrdm          = { .name = "mpu_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP,
+       .wkdep_srcs     = mpu_2420_wkdeps,
+       .clktrctrl_mask = OMAP24XX_AUTOSTATE_MPU_MASK,
+};
+
+static struct clockdomain iva1_2420_clkdm = {
+       .name           = "iva1_clkdm",
+       .pwrdm          = { .name = "dsp_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP_SWSUP,
+       .dep_bit        = OMAP24XX_PM_WKDEP_MPU_EN_DSP_SHIFT,
+       .wkdep_srcs     = dsp_24xx_wkdeps,
+       .clktrctrl_mask = OMAP2420_AUTOSTATE_IVA_MASK,
+};
+
+static struct clockdomain dsp_2420_clkdm = {
+       .name           = "dsp_clkdm",
+       .pwrdm          = { .name = "dsp_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP_SWSUP,
+       .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSP_MASK,
+};
+
+static struct clockdomain gfx_2420_clkdm = {
+       .name           = "gfx_clkdm",
+       .pwrdm          = { .name = "gfx_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP_SWSUP,
+       .wkdep_srcs     = gfx_24xx_wkdeps,
+       .clktrctrl_mask = OMAP24XX_AUTOSTATE_GFX_MASK,
+};
+
+static struct clockdomain core_l3_2420_clkdm = {
+       .name           = "core_l3_clkdm",
+       .pwrdm          = { .name = "core_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP,
+       .wkdep_srcs     = core_2420_wkdeps,
+       .clktrctrl_mask = OMAP24XX_AUTOSTATE_L3_MASK,
+};
+
+static struct clockdomain core_l4_2420_clkdm = {
+       .name           = "core_l4_clkdm",
+       .pwrdm          = { .name = "core_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP,
+       .wkdep_srcs     = core_2420_wkdeps,
+       .clktrctrl_mask = OMAP24XX_AUTOSTATE_L4_MASK,
+};
+
+static struct clockdomain dss_2420_clkdm = {
+       .name           = "dss_clkdm",
+       .pwrdm          = { .name = "core_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP,
+       .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSS_MASK,
+};
+
+static struct clockdomain *clockdomains_omap242x[] __initdata = {
+       &wkup_common_clkdm,
+       &cm_common_clkdm,
+       &prm_common_clkdm,
+       &mpu_2420_clkdm,
+       &iva1_2420_clkdm,
+       &dsp_2420_clkdm,
+       &gfx_2420_clkdm,
+       &core_l3_2420_clkdm,
+       &core_l4_2420_clkdm,
+       &dss_2420_clkdm,
+       NULL,
+};
+
+void __init omap242x_clockdomains_init(void)
+{
+       if (!cpu_is_omap242x())
+               return;
+
+       clkdm_register_platform_funcs(&omap2_clkdm_operations);
+       clkdm_register_clkdms(clockdomains_omap242x);
+       clkdm_complete_init();
+}
diff --git a/arch/arm/mach-omap2/clockdomains2430_data.c b/arch/arm/mach-omap2/clockdomains2430_data.c
new file mode 100644 (file)
index 0000000..3645ed0
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * OMAP2xxx clockdomains
+ *
+ * Copyright (C) 2008-2009 Texas Instruments, Inc.
+ * Copyright (C) 2008-2010 Nokia Corporation
+ *
+ * Paul Walmsley, Jouni Högander
+ *
+ * This file contains clockdomains and clockdomain wakeup dependencies
+ * for OMAP2xxx chips.  Some notes:
+ *
+ * A useful validation rule for struct clockdomain: Any clockdomain
+ * referenced by a wkdep_srcs must have a dep_bit assigned.  So
+ * wkdep_srcs are really just software-controllable dependencies.
+ * Non-software-controllable dependencies do exist, but they are not
+ * encoded below (yet).
+ *
+ * 24xx does not support programmable sleep dependencies (SLEEPDEP)
+ *
+ * The overly-specific dep_bit names are due to a bit name collision
+ * with CM_FCLKEN_{DSP,IVA2}.  The DSP/IVA2 PM_WKDEP and CM_SLEEPDEP shift
+ * value are the same for all powerdomains: 2
+ *
+ * XXX should dep_bit be a mask, so we can test to see if it is 0 as a
+ * sanity check?
+ * XXX encode hardware fixed wakeup dependencies -- esp. for 3430 CORE
+ */
+
+/*
+ * To-Do List
+ * -> Port the Sleep/Wakeup dependencies for the domains
+ *    from the Power domain framework
+ */
+
+#include <linux/kernel.h>
+#include <linux/io.h>
+
+#include "clockdomain.h"
+#include "prm2xxx_3xxx.h"
+#include "cm2xxx_3xxx.h"
+#include "cm-regbits-24xx.h"
+#include "prm-regbits-24xx.h"
+
+/*
+ * Clockdomain dependencies for wkdeps
+ *
+ * XXX Hardware dependencies (e.g., dependencies that cannot be
+ * changed in software) are not included here yet, but should be.
+ */
+
+/* Wakeup dependency source arrays */
+
+/* 2430-specific possible wakeup dependencies */
+
+/* 2430 PM_WKDEP_CORE: DSP, GFX, MPU, WKUP, MDM */
+static struct clkdm_dep core_2430_wkdeps[] = {
+       { .clkdm_name = "dsp_clkdm" },
+       { .clkdm_name = "gfx_clkdm" },
+       { .clkdm_name = "mpu_clkdm" },
+       { .clkdm_name = "wkup_clkdm" },
+       { .clkdm_name = "mdm_clkdm" },
+       { NULL },
+};
+
+/* 2430 PM_WKDEP_MPU: CORE, DSP, WKUP, MDM */
+static struct clkdm_dep mpu_2430_wkdeps[] = {
+       { .clkdm_name = "core_l3_clkdm" },
+       { .clkdm_name = "core_l4_clkdm" },
+       { .clkdm_name = "dsp_clkdm" },
+       { .clkdm_name = "wkup_clkdm" },
+       { .clkdm_name = "mdm_clkdm" },
+       { NULL },
+};
+
+/* 2430 PM_WKDEP_MDM: CORE, MPU, WKUP */
+static struct clkdm_dep mdm_2430_wkdeps[] = {
+       { .clkdm_name = "core_l3_clkdm" },
+       { .clkdm_name = "core_l4_clkdm" },
+       { .clkdm_name = "mpu_clkdm" },
+       { .clkdm_name = "wkup_clkdm" },
+       { NULL },
+};
+
+/*
+ * 2430-only clockdomains
+ */
+
+static struct clockdomain mpu_2430_clkdm = {
+       .name           = "mpu_clkdm",
+       .pwrdm          = { .name = "mpu_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP_SWSUP,
+       .wkdep_srcs     = mpu_2430_wkdeps,
+       .clktrctrl_mask = OMAP24XX_AUTOSTATE_MPU_MASK,
+};
+
+/* Another case of bit name collisions between several registers: EN_MDM */
+static struct clockdomain mdm_clkdm = {
+       .name           = "mdm_clkdm",
+       .pwrdm          = { .name = "mdm_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP_SWSUP,
+       .dep_bit        = OMAP2430_PM_WKDEP_MPU_EN_MDM_SHIFT,
+       .wkdep_srcs     = mdm_2430_wkdeps,
+       .clktrctrl_mask = OMAP2430_AUTOSTATE_MDM_MASK,
+};
+
+static struct clockdomain dsp_2430_clkdm = {
+       .name           = "dsp_clkdm",
+       .pwrdm          = { .name = "dsp_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP_SWSUP,
+       .dep_bit        = OMAP24XX_PM_WKDEP_MPU_EN_DSP_SHIFT,
+       .wkdep_srcs     = dsp_24xx_wkdeps,
+       .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSP_MASK,
+};
+
+static struct clockdomain gfx_2430_clkdm = {
+       .name           = "gfx_clkdm",
+       .pwrdm          = { .name = "gfx_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP_SWSUP,
+       .wkdep_srcs     = gfx_24xx_wkdeps,
+       .clktrctrl_mask = OMAP24XX_AUTOSTATE_GFX_MASK,
+};
+
+/*
+ * XXX add usecounting for clkdm dependencies, otherwise the presence
+ * of a single dep bit for core_l3_24xx_clkdm and core_l4_24xx_clkdm
+ * could cause trouble
+ */
+static struct clockdomain core_l3_2430_clkdm = {
+       .name           = "core_l3_clkdm",
+       .pwrdm          = { .name = "core_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP,
+       .dep_bit        = OMAP24XX_EN_CORE_SHIFT,
+       .wkdep_srcs     = core_2430_wkdeps,
+       .clktrctrl_mask = OMAP24XX_AUTOSTATE_L3_MASK,
+};
+
+/*
+ * XXX add usecounting for clkdm dependencies, otherwise the presence
+ * of a single dep bit for core_l3_24xx_clkdm and core_l4_24xx_clkdm
+ * could cause trouble
+ */
+static struct clockdomain core_l4_2430_clkdm = {
+       .name           = "core_l4_clkdm",
+       .pwrdm          = { .name = "core_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP,
+       .dep_bit        = OMAP24XX_EN_CORE_SHIFT,
+       .wkdep_srcs     = core_2430_wkdeps,
+       .clktrctrl_mask = OMAP24XX_AUTOSTATE_L4_MASK,
+};
+
+static struct clockdomain dss_2430_clkdm = {
+       .name           = "dss_clkdm",
+       .pwrdm          = { .name = "core_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP,
+       .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSS_MASK,
+};
+
+static struct clockdomain *clockdomains_omap243x[] __initdata = {
+       &wkup_common_clkdm,
+       &cm_common_clkdm,
+       &prm_common_clkdm,
+       &mpu_2430_clkdm,
+       &mdm_clkdm,
+       &dsp_2430_clkdm,
+       &gfx_2430_clkdm,
+       &core_l3_2430_clkdm,
+       &core_l4_2430_clkdm,
+       &dss_2430_clkdm,
+       NULL,
+};
+
+void __init omap243x_clockdomains_init(void)
+{
+       if (!cpu_is_omap243x())
+               return;
+
+       clkdm_register_platform_funcs(&omap2_clkdm_operations);
+       clkdm_register_clkdms(clockdomains_omap243x);
+       clkdm_complete_init();
+}
+
index 13bde95b6790c57f2ec97d2ca83a0eb65c3099b0..0a6a04897d89f41074e64ab403ee42d4e0d84bb6 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * OMAP2/3 clockdomains
+ * OMAP2/3 clockdomain common data
  *
- * Copyright (C) 2008-2009 Texas Instruments, Inc.
+ * Copyright (C) 2008-2011 Texas Instruments, Inc.
  * Copyright (C) 2008-2010 Nokia Corporation
  *
  * Paul Walmsley, Jouni Högander
  * changed in software) are not included here yet, but should be.
  */
 
-/* OMAP2/3-common wakeup dependencies */
-
-/*
- * 2420/2430 PM_WKDEP_GFX: CORE, MPU, WKUP
- * 3430ES1 PM_WKDEP_GFX: adds IVA2, removes CORE
- * 3430ES2 PM_WKDEP_SGX: adds IVA2, removes CORE
- * These can share data since they will never be present simultaneously
- * on the same device.
- */
-static struct clkdm_dep gfx_sgx_wkdeps[] = {
-       {
-               .clkdm_name = "core_l3_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       {
-               .clkdm_name = "core_l4_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       {
-               .clkdm_name = "iva2_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "mpu_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX |
-                                           CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "wkup_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX |
-                                           CHIP_IS_OMAP3430)
-       },
-       { NULL },
-};
-
-
-/* 24XX-specific possible dependencies */
-
-#ifdef CONFIG_ARCH_OMAP2
-
 /* Wakeup dependency source arrays */
 
-/* 2420/2430 PM_WKDEP_DSP: CORE, MPU, WKUP */
-static struct clkdm_dep dsp_24xx_wkdeps[] = {
-       {
-               .clkdm_name = "core_l3_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       {
-               .clkdm_name = "core_l4_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       {
-               .clkdm_name = "mpu_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       {
-               .clkdm_name = "wkup_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       { NULL },
-};
-
-/*
- * 2420 PM_WKDEP_MPU: CORE, DSP, WKUP
- * 2430 adds MDM
- */
-static struct clkdm_dep mpu_24xx_wkdeps[] = {
-       {
-               .clkdm_name = "core_l3_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       {
-               .clkdm_name = "core_l4_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       {
-               .clkdm_name = "dsp_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       {
-               .clkdm_name = "wkup_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       {
-               .clkdm_name = "mdm_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
-       },
-       { NULL },
-};
-
-/*
- * 2420 PM_WKDEP_CORE: DSP, GFX, MPU, WKUP
- * 2430 adds MDM
- */
-static struct clkdm_dep core_24xx_wkdeps[] = {
-       {
-               .clkdm_name = "dsp_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       {
-               .clkdm_name = "gfx_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       {
-               .clkdm_name = "mpu_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       {
-               .clkdm_name = "wkup_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       {
-               .clkdm_name = "mdm_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
-       },
-       { NULL },
-};
-
-#endif /* CONFIG_ARCH_OMAP2 */
-
-/* 2430-specific possible wakeup dependencies */
+/* 2xxx-specific possible dependencies */
 
-#ifdef CONFIG_SOC_OMAP2430
-
-/* 2430 PM_WKDEP_MDM: CORE, MPU, WKUP */
-static struct clkdm_dep mdm_2430_wkdeps[] = {
-       {
-               .clkdm_name = "core_l3_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       {
-               .clkdm_name = "core_l4_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       {
-               .clkdm_name = "mpu_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       {
-               .clkdm_name = "wkup_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-       },
-       { NULL },
-};
-
-#endif /* CONFIG_SOC_OMAP2430 */
-
-
-/* OMAP3-specific possible dependencies */
-
-#ifdef CONFIG_ARCH_OMAP3
-
-/* 3430: PM_WKDEP_PER: CORE, IVA2, MPU, WKUP */
-static struct clkdm_dep per_wkdeps[] = {
-       {
-               .clkdm_name = "core_l3_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "core_l4_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "iva2_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "mpu_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "wkup_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       { NULL },
-};
-
-/* 3430ES2: PM_WKDEP_USBHOST: CORE, IVA2, MPU, WKUP */
-static struct clkdm_dep usbhost_wkdeps[] = {
-       {
-               .clkdm_name = "core_l3_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "core_l4_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "iva2_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "mpu_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "wkup_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
+/* 2xxx PM_WKDEP_GFX: CORE, MPU, WKUP */
+struct clkdm_dep gfx_24xx_wkdeps[] = {
+       { .clkdm_name = "core_l3_clkdm" },
+       { .clkdm_name = "core_l4_clkdm" },
+       { .clkdm_name = "mpu_clkdm" },
+       { .clkdm_name = "wkup_clkdm" },
        { NULL },
 };
 
-/* 3430 PM_WKDEP_MPU: CORE, IVA2, DSS, PER */
-static struct clkdm_dep mpu_3xxx_wkdeps[] = {
-       {
-               .clkdm_name = "core_l3_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "core_l4_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "iva2_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "dss_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "per_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
+/* 2xxx PM_WKDEP_DSP: CORE, MPU, WKUP */
+struct clkdm_dep dsp_24xx_wkdeps[] = {
+       { .clkdm_name = "core_l3_clkdm" },
+       { .clkdm_name = "core_l4_clkdm" },
+       { .clkdm_name = "mpu_clkdm" },
+       { .clkdm_name = "wkup_clkdm" },
        { NULL },
 };
 
-/* 3430 PM_WKDEP_IVA2: CORE, MPU, WKUP, DSS, PER */
-static struct clkdm_dep iva2_wkdeps[] = {
-       {
-               .clkdm_name = "core_l3_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "core_l4_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "mpu_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "wkup_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "dss_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "per_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       { NULL },
-};
-
-
-/* 3430 PM_WKDEP_CAM: IVA2, MPU, WKUP */
-static struct clkdm_dep cam_wkdeps[] = {
-       {
-               .clkdm_name = "iva2_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "mpu_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "wkup_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       { NULL },
-};
-
-/* 3430 PM_WKDEP_DSS: IVA2, MPU, WKUP */
-static struct clkdm_dep dss_wkdeps[] = {
-       {
-               .clkdm_name = "iva2_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "mpu_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "wkup_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       { NULL },
-};
-
-/* 3430: PM_WKDEP_NEON: MPU */
-static struct clkdm_dep neon_wkdeps[] = {
-       {
-               .clkdm_name = "mpu_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       { NULL },
-};
-
-
-/* Sleep dependency source arrays for OMAP3-specific clkdms */
-
-/* 3430: CM_SLEEPDEP_DSS: MPU, IVA */
-static struct clkdm_dep dss_sleepdeps[] = {
-       {
-               .clkdm_name = "mpu_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "iva2_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       { NULL },
-};
-
-/* 3430: CM_SLEEPDEP_PER: MPU, IVA */
-static struct clkdm_dep per_sleepdeps[] = {
-       {
-               .clkdm_name = "mpu_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "iva2_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       { NULL },
-};
-
-/* 3430ES2: CM_SLEEPDEP_USBHOST: MPU, IVA */
-static struct clkdm_dep usbhost_sleepdeps[] = {
-       {
-               .clkdm_name = "mpu_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm_name = "iva2_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       { NULL },
-};
-
-/* 3430: CM_SLEEPDEP_CAM: MPU */
-static struct clkdm_dep cam_sleepdeps[] = {
-       {
-               .clkdm_name = "mpu_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       { NULL },
-};
-
-/*
- * 3430ES1: CM_SLEEPDEP_GFX: MPU
- * 3430ES2: CM_SLEEPDEP_SGX: MPU
- * These can share data since they will never be present simultaneously
- * on the same device.
- */
-static struct clkdm_dep gfx_sgx_sleepdeps[] = {
-       {
-               .clkdm_name = "mpu_clkdm",
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       { NULL },
-};
-
-#endif /* CONFIG_ARCH_OMAP3 */
-
 
 /*
  * OMAP2/3-common clockdomains
@@ -430,439 +84,18 @@ static struct clkdm_dep gfx_sgx_sleepdeps[] = {
  */
 
 /* This is an implicit clockdomain - it is never defined as such in TRM */
-static struct clockdomain wkup_clkdm = {
+struct clockdomain wkup_common_clkdm = {
        .name           = "wkup_clkdm",
        .pwrdm          = { .name = "wkup_pwrdm" },
        .dep_bit        = OMAP_EN_WKUP_SHIFT,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430),
 };
 
-static struct clockdomain prm_clkdm = {
+struct clockdomain prm_common_clkdm = {
        .name           = "prm_clkdm",
        .pwrdm          = { .name = "wkup_pwrdm" },
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430),
 };
 
-static struct clockdomain cm_clkdm = {
+struct clockdomain cm_common_clkdm = {
        .name           = "cm_clkdm",
        .pwrdm          = { .name = "core_pwrdm" },
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430),
 };
-
-/*
- * 2420-only clockdomains
- */
-
-#if defined(CONFIG_SOC_OMAP2420)
-
-static struct clockdomain mpu_2420_clkdm = {
-       .name           = "mpu_clkdm",
-       .pwrdm          = { .name = "mpu_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP,
-       .wkdep_srcs     = mpu_24xx_wkdeps,
-       .clktrctrl_mask = OMAP24XX_AUTOSTATE_MPU_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
-};
-
-static struct clockdomain iva1_2420_clkdm = {
-       .name           = "iva1_clkdm",
-       .pwrdm          = { .name = "dsp_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP_SWSUP,
-       .dep_bit        = OMAP24XX_PM_WKDEP_MPU_EN_DSP_SHIFT,
-       .wkdep_srcs     = dsp_24xx_wkdeps,
-       .clktrctrl_mask = OMAP2420_AUTOSTATE_IVA_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
-};
-
-static struct clockdomain dsp_2420_clkdm = {
-       .name           = "dsp_clkdm",
-       .pwrdm          = { .name = "dsp_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP_SWSUP,
-       .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSP_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
-};
-
-static struct clockdomain gfx_2420_clkdm = {
-       .name           = "gfx_clkdm",
-       .pwrdm          = { .name = "gfx_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP_SWSUP,
-       .wkdep_srcs     = gfx_sgx_wkdeps,
-       .clktrctrl_mask = OMAP24XX_AUTOSTATE_GFX_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
-};
-
-static struct clockdomain core_l3_2420_clkdm = {
-       .name           = "core_l3_clkdm",
-       .pwrdm          = { .name = "core_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP,
-       .wkdep_srcs     = core_24xx_wkdeps,
-       .clktrctrl_mask = OMAP24XX_AUTOSTATE_L3_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
-};
-
-static struct clockdomain core_l4_2420_clkdm = {
-       .name           = "core_l4_clkdm",
-       .pwrdm          = { .name = "core_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP,
-       .wkdep_srcs     = core_24xx_wkdeps,
-       .clktrctrl_mask = OMAP24XX_AUTOSTATE_L4_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
-};
-
-static struct clockdomain dss_2420_clkdm = {
-       .name           = "dss_clkdm",
-       .pwrdm          = { .name = "core_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP,
-       .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSS_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
-};
-
-#endif   /* CONFIG_SOC_OMAP2420 */
-
-
-/*
- * 2430-only clockdomains
- */
-
-#if defined(CONFIG_SOC_OMAP2430)
-
-static struct clockdomain mpu_2430_clkdm = {
-       .name           = "mpu_clkdm",
-       .pwrdm          = { .name = "mpu_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP_SWSUP,
-       .wkdep_srcs     = mpu_24xx_wkdeps,
-       .clktrctrl_mask = OMAP24XX_AUTOSTATE_MPU_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
-};
-
-/* Another case of bit name collisions between several registers: EN_MDM */
-static struct clockdomain mdm_clkdm = {
-       .name           = "mdm_clkdm",
-       .pwrdm          = { .name = "mdm_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP_SWSUP,
-       .dep_bit        = OMAP2430_PM_WKDEP_MPU_EN_MDM_SHIFT,
-       .wkdep_srcs     = mdm_2430_wkdeps,
-       .clktrctrl_mask = OMAP2430_AUTOSTATE_MDM_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
-};
-
-static struct clockdomain dsp_2430_clkdm = {
-       .name           = "dsp_clkdm",
-       .pwrdm          = { .name = "dsp_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP_SWSUP,
-       .dep_bit        = OMAP24XX_PM_WKDEP_MPU_EN_DSP_SHIFT,
-       .wkdep_srcs     = dsp_24xx_wkdeps,
-       .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSP_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
-};
-
-static struct clockdomain gfx_2430_clkdm = {
-       .name           = "gfx_clkdm",
-       .pwrdm          = { .name = "gfx_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP_SWSUP,
-       .wkdep_srcs     = gfx_sgx_wkdeps,
-       .clktrctrl_mask = OMAP24XX_AUTOSTATE_GFX_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
-};
-
-/*
- * XXX add usecounting for clkdm dependencies, otherwise the presence
- * of a single dep bit for core_l3_24xx_clkdm and core_l4_24xx_clkdm
- * could cause trouble
- */
-static struct clockdomain core_l3_2430_clkdm = {
-       .name           = "core_l3_clkdm",
-       .pwrdm          = { .name = "core_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP,
-       .dep_bit        = OMAP24XX_EN_CORE_SHIFT,
-       .wkdep_srcs     = core_24xx_wkdeps,
-       .clktrctrl_mask = OMAP24XX_AUTOSTATE_L3_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
-};
-
-/*
- * XXX add usecounting for clkdm dependencies, otherwise the presence
- * of a single dep bit for core_l3_24xx_clkdm and core_l4_24xx_clkdm
- * could cause trouble
- */
-static struct clockdomain core_l4_2430_clkdm = {
-       .name           = "core_l4_clkdm",
-       .pwrdm          = { .name = "core_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP,
-       .dep_bit        = OMAP24XX_EN_CORE_SHIFT,
-       .wkdep_srcs     = core_24xx_wkdeps,
-       .clktrctrl_mask = OMAP24XX_AUTOSTATE_L4_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
-};
-
-static struct clockdomain dss_2430_clkdm = {
-       .name           = "dss_clkdm",
-       .pwrdm          = { .name = "core_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP,
-       .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSS_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
-};
-
-#endif    /* CONFIG_SOC_OMAP2430 */
-
-
-/*
- * OMAP3 clockdomains
- */
-
-#if defined(CONFIG_ARCH_OMAP3)
-
-static struct clockdomain mpu_3xxx_clkdm = {
-       .name           = "mpu_clkdm",
-       .pwrdm          = { .name = "mpu_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP | CLKDM_CAN_FORCE_WAKEUP,
-       .dep_bit        = OMAP3430_EN_MPU_SHIFT,
-       .wkdep_srcs     = mpu_3xxx_wkdeps,
-       .clktrctrl_mask = OMAP3430_CLKTRCTRL_MPU_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
-};
-
-static struct clockdomain neon_clkdm = {
-       .name           = "neon_clkdm",
-       .pwrdm          = { .name = "neon_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP_SWSUP,
-       .wkdep_srcs     = neon_wkdeps,
-       .clktrctrl_mask = OMAP3430_CLKTRCTRL_NEON_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
-};
-
-static struct clockdomain iva2_clkdm = {
-       .name           = "iva2_clkdm",
-       .pwrdm          = { .name = "iva2_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP_SWSUP,
-       .dep_bit        = OMAP3430_PM_WKDEP_MPU_EN_IVA2_SHIFT,
-       .wkdep_srcs     = iva2_wkdeps,
-       .clktrctrl_mask = OMAP3430_CLKTRCTRL_IVA2_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
-};
-
-static struct clockdomain gfx_3430es1_clkdm = {
-       .name           = "gfx_clkdm",
-       .pwrdm          = { .name = "gfx_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP_SWSUP,
-       .wkdep_srcs     = gfx_sgx_wkdeps,
-       .sleepdep_srcs  = gfx_sgx_sleepdeps,
-       .clktrctrl_mask = OMAP3430ES1_CLKTRCTRL_GFX_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1),
-};
-
-static struct clockdomain sgx_clkdm = {
-       .name           = "sgx_clkdm",
-       .pwrdm          = { .name = "sgx_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP_SWSUP,
-       .wkdep_srcs     = gfx_sgx_wkdeps,
-       .sleepdep_srcs  = gfx_sgx_sleepdeps,
-       .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_SGX_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
-};
-
-/*
- * The die-to-die clockdomain was documented in the 34xx ES1 TRM, but
- * then that information was removed from the 34xx ES2+ TRM.  It is
- * unclear whether the core is still there, but the clockdomain logic
- * is there, and must be programmed to an appropriate state if the
- * CORE clockdomain is to become inactive.
- */
-static struct clockdomain d2d_clkdm = {
-       .name           = "d2d_clkdm",
-       .pwrdm          = { .name = "core_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP_SWSUP,
-       .clktrctrl_mask = OMAP3430ES1_CLKTRCTRL_D2D_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
-};
-
-/*
- * XXX add usecounting for clkdm dependencies, otherwise the presence
- * of a single dep bit for core_l3_3xxx_clkdm and core_l4_3xxx_clkdm
- * could cause trouble
- */
-static struct clockdomain core_l3_3xxx_clkdm = {
-       .name           = "core_l3_clkdm",
-       .pwrdm          = { .name = "core_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP,
-       .dep_bit        = OMAP3430_EN_CORE_SHIFT,
-       .clktrctrl_mask = OMAP3430_CLKTRCTRL_L3_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
-};
-
-/*
- * XXX add usecounting for clkdm dependencies, otherwise the presence
- * of a single dep bit for core_l3_3xxx_clkdm and core_l4_3xxx_clkdm
- * could cause trouble
- */
-static struct clockdomain core_l4_3xxx_clkdm = {
-       .name           = "core_l4_clkdm",
-       .pwrdm          = { .name = "core_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP,
-       .dep_bit        = OMAP3430_EN_CORE_SHIFT,
-       .clktrctrl_mask = OMAP3430_CLKTRCTRL_L4_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
-};
-
-/* Another case of bit name collisions between several registers: EN_DSS */
-static struct clockdomain dss_3xxx_clkdm = {
-       .name           = "dss_clkdm",
-       .pwrdm          = { .name = "dss_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP_SWSUP,
-       .dep_bit        = OMAP3430_PM_WKDEP_MPU_EN_DSS_SHIFT,
-       .wkdep_srcs     = dss_wkdeps,
-       .sleepdep_srcs  = dss_sleepdeps,
-       .clktrctrl_mask = OMAP3430_CLKTRCTRL_DSS_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
-};
-
-static struct clockdomain cam_clkdm = {
-       .name           = "cam_clkdm",
-       .pwrdm          = { .name = "cam_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP_SWSUP,
-       .wkdep_srcs     = cam_wkdeps,
-       .sleepdep_srcs  = cam_sleepdeps,
-       .clktrctrl_mask = OMAP3430_CLKTRCTRL_CAM_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
-};
-
-static struct clockdomain usbhost_clkdm = {
-       .name           = "usbhost_clkdm",
-       .pwrdm          = { .name = "usbhost_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP_SWSUP,
-       .wkdep_srcs     = usbhost_wkdeps,
-       .sleepdep_srcs  = usbhost_sleepdeps,
-       .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_USBHOST_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
-};
-
-static struct clockdomain per_clkdm = {
-       .name           = "per_clkdm",
-       .pwrdm          = { .name = "per_pwrdm" },
-       .flags          = CLKDM_CAN_HWSUP_SWSUP,
-       .dep_bit        = OMAP3430_EN_PER_SHIFT,
-       .wkdep_srcs     = per_wkdeps,
-       .sleepdep_srcs  = per_sleepdeps,
-       .clktrctrl_mask = OMAP3430_CLKTRCTRL_PER_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
-};
-
-/*
- * Disable hw supervised mode for emu_clkdm, because emu_pwrdm is
- * switched of even if sdti is in use
- */
-static struct clockdomain emu_clkdm = {
-       .name           = "emu_clkdm",
-       .pwrdm          = { .name = "emu_pwrdm" },
-       .flags          = /* CLKDM_CAN_ENABLE_AUTO |  */CLKDM_CAN_SWSUP,
-       .clktrctrl_mask = OMAP3430_CLKTRCTRL_EMU_MASK,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
-};
-
-static struct clockdomain dpll1_clkdm = {
-       .name           = "dpll1_clkdm",
-       .pwrdm          = { .name = "dpll1_pwrdm" },
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
-};
-
-static struct clockdomain dpll2_clkdm = {
-       .name           = "dpll2_clkdm",
-       .pwrdm          = { .name = "dpll2_pwrdm" },
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
-};
-
-static struct clockdomain dpll3_clkdm = {
-       .name           = "dpll3_clkdm",
-       .pwrdm          = { .name = "dpll3_pwrdm" },
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
-};
-
-static struct clockdomain dpll4_clkdm = {
-       .name           = "dpll4_clkdm",
-       .pwrdm          = { .name = "dpll4_pwrdm" },
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
-};
-
-static struct clockdomain dpll5_clkdm = {
-       .name           = "dpll5_clkdm",
-       .pwrdm          = { .name = "dpll5_pwrdm" },
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
-};
-
-#endif   /* CONFIG_ARCH_OMAP3 */
-
-/*
- * Clockdomain hwsup dependencies (OMAP3 only)
- */
-
-static struct clkdm_autodep clkdm_autodeps[] = {
-       {
-               .clkdm     = { .name = "mpu_clkdm" },
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm     = { .name = "iva2_clkdm" },
-               .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
-       },
-       {
-               .clkdm     = { .name = NULL },
-       }
-};
-
-static struct clockdomain *clockdomains_omap2[] __initdata = {
-       &wkup_clkdm,
-       &cm_clkdm,
-       &prm_clkdm,
-
-#ifdef CONFIG_SOC_OMAP2420
-       &mpu_2420_clkdm,
-       &iva1_2420_clkdm,
-       &dsp_2420_clkdm,
-       &gfx_2420_clkdm,
-       &core_l3_2420_clkdm,
-       &core_l4_2420_clkdm,
-       &dss_2420_clkdm,
-#endif
-
-#ifdef CONFIG_SOC_OMAP2430
-       &mpu_2430_clkdm,
-       &mdm_clkdm,
-       &dsp_2430_clkdm,
-       &gfx_2430_clkdm,
-       &core_l3_2430_clkdm,
-       &core_l4_2430_clkdm,
-       &dss_2430_clkdm,
-#endif
-
-#ifdef CONFIG_ARCH_OMAP3
-       &mpu_3xxx_clkdm,
-       &neon_clkdm,
-       &iva2_clkdm,
-       &gfx_3430es1_clkdm,
-       &sgx_clkdm,
-       &d2d_clkdm,
-       &core_l3_3xxx_clkdm,
-       &core_l4_3xxx_clkdm,
-       &dss_3xxx_clkdm,
-       &cam_clkdm,
-       &usbhost_clkdm,
-       &per_clkdm,
-       &emu_clkdm,
-       &dpll1_clkdm,
-       &dpll2_clkdm,
-       &dpll3_clkdm,
-       &dpll4_clkdm,
-       &dpll5_clkdm,
-#endif
-       NULL,
-};
-
-void __init omap2xxx_clockdomains_init(void)
-{
-       clkdm_init(clockdomains_omap2, clkdm_autodeps, &omap2_clkdm_operations);
-}
-
-void __init omap3xxx_clockdomains_init(void)
-{
-       clkdm_init(clockdomains_omap2, clkdm_autodeps, &omap3_clkdm_operations);
-}
diff --git a/arch/arm/mach-omap2/clockdomains3xxx_data.c b/arch/arm/mach-omap2/clockdomains3xxx_data.c
new file mode 100644 (file)
index 0000000..b84e138
--- /dev/null
@@ -0,0 +1,398 @@
+/*
+ * OMAP3xxx clockdomains
+ *
+ * Copyright (C) 2008-2011 Texas Instruments, Inc.
+ * Copyright (C) 2008-2010 Nokia Corporation
+ *
+ * Paul Walmsley, Jouni Högander
+ *
+ * This file contains clockdomains and clockdomain wakeup/sleep
+ * dependencies for the OMAP3xxx chips.  Some notes:
+ *
+ * A useful validation rule for struct clockdomain: Any clockdomain
+ * referenced by a wkdep_srcs or sleepdep_srcs array must have a
+ * dep_bit assigned.  So wkdep_srcs/sleepdep_srcs are really just
+ * software-controllable dependencies.  Non-software-controllable
+ * dependencies do exist, but they are not encoded below (yet).
+ *
+ * The overly-specific dep_bit names are due to a bit name collision
+ * with CM_FCLKEN_{DSP,IVA2}.  The DSP/IVA2 PM_WKDEP and CM_SLEEPDEP shift
+ * value are the same for all powerdomains: 2
+ *
+ * XXX should dep_bit be a mask, so we can test to see if it is 0 as a
+ * sanity check?
+ * XXX encode hardware fixed wakeup dependencies -- esp. for 3430 CORE
+ */
+
+/*
+ * To-Do List
+ * -> Port the Sleep/Wakeup dependencies for the domains
+ *    from the Power domain framework
+ */
+
+#include <linux/kernel.h>
+#include <linux/io.h>
+
+#include "clockdomain.h"
+#include "prm2xxx_3xxx.h"
+#include "cm2xxx_3xxx.h"
+#include "cm-regbits-34xx.h"
+#include "prm-regbits-34xx.h"
+
+/*
+ * Clockdomain dependencies for wkdeps/sleepdeps
+ *
+ * XXX Hardware dependencies (e.g., dependencies that cannot be
+ * changed in software) are not included here yet, but should be.
+ */
+
+/* OMAP3-specific possible dependencies */
+
+/*
+ * 3430ES1 PM_WKDEP_GFX: adds IVA2, removes CORE
+ * 3430ES2 PM_WKDEP_SGX: adds IVA2, removes CORE
+ */
+static struct clkdm_dep gfx_sgx_3xxx_wkdeps[] = {
+       { .clkdm_name = "iva2_clkdm", },
+       { .clkdm_name = "mpu_clkdm", },
+       { .clkdm_name = "wkup_clkdm", },
+       { NULL },
+};
+
+/* 3430: PM_WKDEP_PER: CORE, IVA2, MPU, WKUP */
+static struct clkdm_dep per_wkdeps[] = {
+       { .clkdm_name = "core_l3_clkdm" },
+       { .clkdm_name = "core_l4_clkdm" },
+       { .clkdm_name = "iva2_clkdm" },
+       { .clkdm_name = "mpu_clkdm" },
+       { .clkdm_name = "wkup_clkdm" },
+       { NULL },
+};
+
+/* 3430ES2: PM_WKDEP_USBHOST: CORE, IVA2, MPU, WKUP */
+static struct clkdm_dep usbhost_wkdeps[] = {
+       { .clkdm_name = "core_l3_clkdm" },
+       { .clkdm_name = "core_l4_clkdm" },
+       { .clkdm_name = "iva2_clkdm" },
+       { .clkdm_name = "mpu_clkdm" },
+       { .clkdm_name = "wkup_clkdm" },
+       { NULL },
+};
+
+/* 3430 PM_WKDEP_MPU: CORE, IVA2, DSS, PER */
+static struct clkdm_dep mpu_3xxx_wkdeps[] = {
+       { .clkdm_name = "core_l3_clkdm" },
+       { .clkdm_name = "core_l4_clkdm" },
+       { .clkdm_name = "iva2_clkdm" },
+       { .clkdm_name = "dss_clkdm" },
+       { .clkdm_name = "per_clkdm" },
+       { NULL },
+};
+
+/* 3430 PM_WKDEP_IVA2: CORE, MPU, WKUP, DSS, PER */
+static struct clkdm_dep iva2_wkdeps[] = {
+       { .clkdm_name = "core_l3_clkdm" },
+       { .clkdm_name = "core_l4_clkdm" },
+       { .clkdm_name = "mpu_clkdm" },
+       { .clkdm_name = "wkup_clkdm" },
+       { .clkdm_name = "dss_clkdm" },
+       { .clkdm_name = "per_clkdm" },
+       { NULL },
+};
+
+/* 3430 PM_WKDEP_CAM: IVA2, MPU, WKUP */
+static struct clkdm_dep cam_wkdeps[] = {
+       { .clkdm_name = "iva2_clkdm" },
+       { .clkdm_name = "mpu_clkdm" },
+       { .clkdm_name = "wkup_clkdm" },
+       { NULL },
+};
+
+/* 3430 PM_WKDEP_DSS: IVA2, MPU, WKUP */
+static struct clkdm_dep dss_wkdeps[] = {
+       { .clkdm_name = "iva2_clkdm" },
+       { .clkdm_name = "mpu_clkdm" },
+       { .clkdm_name = "wkup_clkdm" },
+       { NULL },
+};
+
+/* 3430: PM_WKDEP_NEON: MPU */
+static struct clkdm_dep neon_wkdeps[] = {
+       { .clkdm_name = "mpu_clkdm" },
+       { NULL },
+};
+
+/* Sleep dependency source arrays for OMAP3-specific clkdms */
+
+/* 3430: CM_SLEEPDEP_DSS: MPU, IVA */
+static struct clkdm_dep dss_sleepdeps[] = {
+       { .clkdm_name = "mpu_clkdm" },
+       { .clkdm_name = "iva2_clkdm" },
+       { NULL },
+};
+
+/* 3430: CM_SLEEPDEP_PER: MPU, IVA */
+static struct clkdm_dep per_sleepdeps[] = {
+       { .clkdm_name = "mpu_clkdm" },
+       { .clkdm_name = "iva2_clkdm" },
+       { NULL },
+};
+
+/* 3430ES2: CM_SLEEPDEP_USBHOST: MPU, IVA */
+static struct clkdm_dep usbhost_sleepdeps[] = {
+       { .clkdm_name = "mpu_clkdm" },
+       { .clkdm_name = "iva2_clkdm" },
+       { NULL },
+};
+
+/* 3430: CM_SLEEPDEP_CAM: MPU */
+static struct clkdm_dep cam_sleepdeps[] = {
+       { .clkdm_name = "mpu_clkdm" },
+       { NULL },
+};
+
+/*
+ * 3430ES1: CM_SLEEPDEP_GFX: MPU
+ * 3430ES2: CM_SLEEPDEP_SGX: MPU
+ * These can share data since they will never be present simultaneously
+ * on the same device.
+ */
+static struct clkdm_dep gfx_sgx_sleepdeps[] = {
+       { .clkdm_name = "mpu_clkdm" },
+       { NULL },
+};
+
+/*
+ * OMAP3 clockdomains
+ */
+
+static struct clockdomain mpu_3xxx_clkdm = {
+       .name           = "mpu_clkdm",
+       .pwrdm          = { .name = "mpu_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP | CLKDM_CAN_FORCE_WAKEUP,
+       .dep_bit        = OMAP3430_EN_MPU_SHIFT,
+       .wkdep_srcs     = mpu_3xxx_wkdeps,
+       .clktrctrl_mask = OMAP3430_CLKTRCTRL_MPU_MASK,
+};
+
+static struct clockdomain neon_clkdm = {
+       .name           = "neon_clkdm",
+       .pwrdm          = { .name = "neon_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP_SWSUP,
+       .wkdep_srcs     = neon_wkdeps,
+       .clktrctrl_mask = OMAP3430_CLKTRCTRL_NEON_MASK,
+};
+
+static struct clockdomain iva2_clkdm = {
+       .name           = "iva2_clkdm",
+       .pwrdm          = { .name = "iva2_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP_SWSUP,
+       .dep_bit        = OMAP3430_PM_WKDEP_MPU_EN_IVA2_SHIFT,
+       .wkdep_srcs     = iva2_wkdeps,
+       .clktrctrl_mask = OMAP3430_CLKTRCTRL_IVA2_MASK,
+};
+
+static struct clockdomain gfx_3430es1_clkdm = {
+       .name           = "gfx_clkdm",
+       .pwrdm          = { .name = "gfx_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP_SWSUP,
+       .wkdep_srcs     = gfx_sgx_3xxx_wkdeps,
+       .sleepdep_srcs  = gfx_sgx_sleepdeps,
+       .clktrctrl_mask = OMAP3430ES1_CLKTRCTRL_GFX_MASK,
+};
+
+static struct clockdomain sgx_clkdm = {
+       .name           = "sgx_clkdm",
+       .pwrdm          = { .name = "sgx_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP_SWSUP,
+       .wkdep_srcs     = gfx_sgx_3xxx_wkdeps,
+       .sleepdep_srcs  = gfx_sgx_sleepdeps,
+       .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_SGX_MASK,
+};
+
+/*
+ * The die-to-die clockdomain was documented in the 34xx ES1 TRM, but
+ * then that information was removed from the 34xx ES2+ TRM.  It is
+ * unclear whether the core is still there, but the clockdomain logic
+ * is there, and must be programmed to an appropriate state if the
+ * CORE clockdomain is to become inactive.
+ */
+static struct clockdomain d2d_clkdm = {
+       .name           = "d2d_clkdm",
+       .pwrdm          = { .name = "core_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP_SWSUP,
+       .clktrctrl_mask = OMAP3430ES1_CLKTRCTRL_D2D_MASK,
+};
+
+/*
+ * XXX add usecounting for clkdm dependencies, otherwise the presence
+ * of a single dep bit for core_l3_3xxx_clkdm and core_l4_3xxx_clkdm
+ * could cause trouble
+ */
+static struct clockdomain core_l3_3xxx_clkdm = {
+       .name           = "core_l3_clkdm",
+       .pwrdm          = { .name = "core_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP,
+       .dep_bit        = OMAP3430_EN_CORE_SHIFT,
+       .clktrctrl_mask = OMAP3430_CLKTRCTRL_L3_MASK,
+};
+
+/*
+ * XXX add usecounting for clkdm dependencies, otherwise the presence
+ * of a single dep bit for core_l3_3xxx_clkdm and core_l4_3xxx_clkdm
+ * could cause trouble
+ */
+static struct clockdomain core_l4_3xxx_clkdm = {
+       .name           = "core_l4_clkdm",
+       .pwrdm          = { .name = "core_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP,
+       .dep_bit        = OMAP3430_EN_CORE_SHIFT,
+       .clktrctrl_mask = OMAP3430_CLKTRCTRL_L4_MASK,
+};
+
+/* Another case of bit name collisions between several registers: EN_DSS */
+static struct clockdomain dss_3xxx_clkdm = {
+       .name           = "dss_clkdm",
+       .pwrdm          = { .name = "dss_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP_SWSUP,
+       .dep_bit        = OMAP3430_PM_WKDEP_MPU_EN_DSS_SHIFT,
+       .wkdep_srcs     = dss_wkdeps,
+       .sleepdep_srcs  = dss_sleepdeps,
+       .clktrctrl_mask = OMAP3430_CLKTRCTRL_DSS_MASK,
+};
+
+static struct clockdomain cam_clkdm = {
+       .name           = "cam_clkdm",
+       .pwrdm          = { .name = "cam_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP_SWSUP,
+       .wkdep_srcs     = cam_wkdeps,
+       .sleepdep_srcs  = cam_sleepdeps,
+       .clktrctrl_mask = OMAP3430_CLKTRCTRL_CAM_MASK,
+};
+
+static struct clockdomain usbhost_clkdm = {
+       .name           = "usbhost_clkdm",
+       .pwrdm          = { .name = "usbhost_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP_SWSUP,
+       .wkdep_srcs     = usbhost_wkdeps,
+       .sleepdep_srcs  = usbhost_sleepdeps,
+       .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_USBHOST_MASK,
+};
+
+static struct clockdomain per_clkdm = {
+       .name           = "per_clkdm",
+       .pwrdm          = { .name = "per_pwrdm" },
+       .flags          = CLKDM_CAN_HWSUP_SWSUP,
+       .dep_bit        = OMAP3430_EN_PER_SHIFT,
+       .wkdep_srcs     = per_wkdeps,
+       .sleepdep_srcs  = per_sleepdeps,
+       .clktrctrl_mask = OMAP3430_CLKTRCTRL_PER_MASK,
+};
+
+/*
+ * Disable hw supervised mode for emu_clkdm, because emu_pwrdm is
+ * switched of even if sdti is in use
+ */
+static struct clockdomain emu_clkdm = {
+       .name           = "emu_clkdm",
+       .pwrdm          = { .name = "emu_pwrdm" },
+       .flags          = /* CLKDM_CAN_ENABLE_AUTO |  */CLKDM_CAN_SWSUP,
+       .clktrctrl_mask = OMAP3430_CLKTRCTRL_EMU_MASK,
+};
+
+static struct clockdomain dpll1_clkdm = {
+       .name           = "dpll1_clkdm",
+       .pwrdm          = { .name = "dpll1_pwrdm" },
+};
+
+static struct clockdomain dpll2_clkdm = {
+       .name           = "dpll2_clkdm",
+       .pwrdm          = { .name = "dpll2_pwrdm" },
+};
+
+static struct clockdomain dpll3_clkdm = {
+       .name           = "dpll3_clkdm",
+       .pwrdm          = { .name = "dpll3_pwrdm" },
+};
+
+static struct clockdomain dpll4_clkdm = {
+       .name           = "dpll4_clkdm",
+       .pwrdm          = { .name = "dpll4_pwrdm" },
+};
+
+static struct clockdomain dpll5_clkdm = {
+       .name           = "dpll5_clkdm",
+       .pwrdm          = { .name = "dpll5_pwrdm" },
+};
+
+/*
+ * Clockdomain hwsup dependencies
+ */
+
+static struct clkdm_autodep clkdm_autodeps[] = {
+       {
+               .clkdm = { .name = "mpu_clkdm" },
+       },
+       {
+               .clkdm = { .name = "iva2_clkdm" },
+       },
+       {
+               .clkdm = { .name = NULL },
+       }
+};
+
+/*
+ *
+ */
+
+static struct clockdomain *clockdomains_omap3430_common[] __initdata = {
+       &wkup_common_clkdm,
+       &cm_common_clkdm,
+       &prm_common_clkdm,
+       &mpu_3xxx_clkdm,
+       &neon_clkdm,
+       &iva2_clkdm,
+       &d2d_clkdm,
+       &core_l3_3xxx_clkdm,
+       &core_l4_3xxx_clkdm,
+       &dss_3xxx_clkdm,
+       &cam_clkdm,
+       &per_clkdm,
+       &emu_clkdm,
+       &dpll1_clkdm,
+       &dpll2_clkdm,
+       &dpll3_clkdm,
+       &dpll4_clkdm,
+       NULL
+};
+
+static struct clockdomain *clockdomains_omap3430es1[] __initdata = {
+       &gfx_3430es1_clkdm,
+       NULL,
+};
+
+static struct clockdomain *clockdomains_omap3430es2plus[] __initdata = {
+       &sgx_clkdm,
+       &dpll5_clkdm,
+       &usbhost_clkdm,
+       NULL,
+};
+
+void __init omap3xxx_clockdomains_init(void)
+{
+       struct clockdomain **sc;
+
+       if (!cpu_is_omap34xx())
+               return;
+
+       clkdm_register_platform_funcs(&omap3_clkdm_operations);
+       clkdm_register_clkdms(clockdomains_omap3430_common);
+
+       sc = (omap_rev() == OMAP3430_REV_ES1_0) ? clockdomains_omap3430es1 :
+               clockdomains_omap3430es2plus;
+
+       clkdm_register_clkdms(sc);
+
+       clkdm_register_autodeps(clkdm_autodeps);
+       clkdm_complete_init();
+}
index dccc651fa0d0ebedefb5d998bdefdfffcba32d7a..9299ac291d28165b74f23bcb5e7ed73741c6a31b 100644 (file)
 /* Static Dependencies for OMAP4 Clock Domains */
 
 static struct clkdm_dep d2d_wkup_sleep_deps[] = {
-       {
-               .clkdm_name      = "abe_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "ivahd_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_1_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_2_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_emif_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_init_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_cfg_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_per_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
+       { .clkdm_name = "abe_clkdm" },
+       { .clkdm_name = "ivahd_clkdm" },
+       { .clkdm_name = "l3_1_clkdm" },
+       { .clkdm_name = "l3_2_clkdm" },
+       { .clkdm_name = "l3_emif_clkdm" },
+       { .clkdm_name = "l3_init_clkdm" },
+       { .clkdm_name = "l4_cfg_clkdm" },
+       { .clkdm_name = "l4_per_clkdm" },
        { NULL },
 };
 
 static struct clkdm_dep ducati_wkup_sleep_deps[] = {
-       {
-               .clkdm_name      = "abe_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "ivahd_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_1_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_2_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_dss_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_emif_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_gfx_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_init_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_cfg_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_per_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_secure_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_wkup_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "tesla_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
+       { .clkdm_name = "abe_clkdm" },
+       { .clkdm_name = "ivahd_clkdm" },
+       { .clkdm_name = "l3_1_clkdm" },
+       { .clkdm_name = "l3_2_clkdm" },
+       { .clkdm_name = "l3_dss_clkdm" },
+       { .clkdm_name = "l3_emif_clkdm" },
+       { .clkdm_name = "l3_gfx_clkdm" },
+       { .clkdm_name = "l3_init_clkdm" },
+       { .clkdm_name = "l4_cfg_clkdm" },
+       { .clkdm_name = "l4_per_clkdm" },
+       { .clkdm_name = "l4_secure_clkdm" },
+       { .clkdm_name = "l4_wkup_clkdm" },
+       { .clkdm_name = "tesla_clkdm" },
        { NULL },
 };
 
 static struct clkdm_dep iss_wkup_sleep_deps[] = {
-       {
-               .clkdm_name      = "ivahd_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_1_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_emif_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
+       { .clkdm_name = "ivahd_clkdm" },
+       { .clkdm_name = "l3_1_clkdm" },
+       { .clkdm_name = "l3_emif_clkdm" },
        { NULL },
 };
 
 static struct clkdm_dep ivahd_wkup_sleep_deps[] = {
-       {
-               .clkdm_name      = "l3_1_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_emif_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
+       { .clkdm_name = "l3_1_clkdm" },
+       { .clkdm_name = "l3_emif_clkdm" },
        { NULL },
 };
 
 static struct clkdm_dep l3_dma_wkup_sleep_deps[] = {
-       {
-               .clkdm_name      = "abe_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "ducati_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "ivahd_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_1_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_dss_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_emif_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_init_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_cfg_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_per_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_secure_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_wkup_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
+       { .clkdm_name = "abe_clkdm" },
+       { .clkdm_name = "ducati_clkdm" },
+       { .clkdm_name = "ivahd_clkdm" },
+       { .clkdm_name = "l3_1_clkdm" },
+       { .clkdm_name = "l3_dss_clkdm" },
+       { .clkdm_name = "l3_emif_clkdm" },
+       { .clkdm_name = "l3_init_clkdm" },
+       { .clkdm_name = "l4_cfg_clkdm" },
+       { .clkdm_name = "l4_per_clkdm" },
+       { .clkdm_name = "l4_secure_clkdm" },
+       { .clkdm_name = "l4_wkup_clkdm" },
        { NULL },
 };
 
 static struct clkdm_dep l3_dss_wkup_sleep_deps[] = {
-       {
-               .clkdm_name      = "ivahd_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_2_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_emif_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
+       { .clkdm_name = "ivahd_clkdm" },
+       { .clkdm_name = "l3_2_clkdm" },
+       { .clkdm_name = "l3_emif_clkdm" },
        { NULL },
 };
 
 static struct clkdm_dep l3_gfx_wkup_sleep_deps[] = {
-       {
-               .clkdm_name      = "ivahd_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_1_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_emif_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
+       { .clkdm_name = "ivahd_clkdm" },
+       { .clkdm_name = "l3_1_clkdm" },
+       { .clkdm_name = "l3_emif_clkdm" },
        { NULL },
 };
 
 static struct clkdm_dep l3_init_wkup_sleep_deps[] = {
-       {
-               .clkdm_name      = "abe_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "ivahd_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_emif_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_cfg_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_per_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_secure_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_wkup_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
+       { .clkdm_name = "abe_clkdm" },
+       { .clkdm_name = "ivahd_clkdm" },
+       { .clkdm_name = "l3_emif_clkdm" },
+       { .clkdm_name = "l4_cfg_clkdm" },
+       { .clkdm_name = "l4_per_clkdm" },
+       { .clkdm_name = "l4_secure_clkdm" },
+       { .clkdm_name = "l4_wkup_clkdm" },
        { NULL },
 };
 
 static struct clkdm_dep l4_secure_wkup_sleep_deps[] = {
-       {
-               .clkdm_name      = "l3_1_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_emif_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_per_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
+       { .clkdm_name = "l3_1_clkdm" },
+       { .clkdm_name = "l3_emif_clkdm" },
+       { .clkdm_name = "l4_per_clkdm" },
        { NULL },
 };
 
 static struct clkdm_dep mpu_wkup_sleep_deps[] = {
-       {
-               .clkdm_name      = "abe_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "ducati_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "ivahd_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_1_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_2_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_dss_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_emif_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_gfx_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_init_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_cfg_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_per_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_secure_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_wkup_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "tesla_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
+       { .clkdm_name = "abe_clkdm" },
+       { .clkdm_name = "ducati_clkdm" },
+       { .clkdm_name = "ivahd_clkdm" },
+       { .clkdm_name = "l3_1_clkdm" },
+       { .clkdm_name = "l3_2_clkdm" },
+       { .clkdm_name = "l3_dss_clkdm" },
+       { .clkdm_name = "l3_emif_clkdm" },
+       { .clkdm_name = "l3_gfx_clkdm" },
+       { .clkdm_name = "l3_init_clkdm" },
+       { .clkdm_name = "l4_cfg_clkdm" },
+       { .clkdm_name = "l4_per_clkdm" },
+       { .clkdm_name = "l4_secure_clkdm" },
+       { .clkdm_name = "l4_wkup_clkdm" },
+       { .clkdm_name = "tesla_clkdm" },
        { NULL },
 };
 
 static struct clkdm_dep tesla_wkup_sleep_deps[] = {
-       {
-               .clkdm_name      = "abe_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "ivahd_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_1_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_2_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_emif_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l3_init_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_cfg_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_per_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
-       {
-               .clkdm_name      = "l4_wkup_clkdm",
-               .omap_chip       = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
-       },
+       { .clkdm_name = "abe_clkdm" },
+       { .clkdm_name = "ivahd_clkdm" },
+       { .clkdm_name = "l3_1_clkdm" },
+       { .clkdm_name = "l3_2_clkdm" },
+       { .clkdm_name = "l3_emif_clkdm" },
+       { .clkdm_name = "l3_init_clkdm" },
+       { .clkdm_name = "l4_cfg_clkdm" },
+       { .clkdm_name = "l4_per_clkdm" },
+       { .clkdm_name = "l4_wkup_clkdm" },
        { NULL },
 };
 
@@ -388,7 +160,6 @@ static struct clockdomain l4_cefuse_44xx_clkdm = {
        .cm_inst          = OMAP4430_CM2_CEFUSE_INST,
        .clkdm_offs       = OMAP4430_CM2_CEFUSE_CEFUSE_CDOFFS,
        .flags            = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain l4_cfg_44xx_clkdm = {
@@ -399,7 +170,6 @@ static struct clockdomain l4_cfg_44xx_clkdm = {
        .clkdm_offs       = OMAP4430_CM2_CORE_L4CFG_CDOFFS,
        .dep_bit          = OMAP4430_L4CFG_STATDEP_SHIFT,
        .flags            = CLKDM_CAN_HWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain tesla_44xx_clkdm = {
@@ -412,7 +182,6 @@ static struct clockdomain tesla_44xx_clkdm = {
        .wkdep_srcs       = tesla_wkup_sleep_deps,
        .sleepdep_srcs    = tesla_wkup_sleep_deps,
        .flags            = CLKDM_CAN_HWSUP_SWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain l3_gfx_44xx_clkdm = {
@@ -425,7 +194,6 @@ static struct clockdomain l3_gfx_44xx_clkdm = {
        .wkdep_srcs       = l3_gfx_wkup_sleep_deps,
        .sleepdep_srcs    = l3_gfx_wkup_sleep_deps,
        .flags            = CLKDM_CAN_HWSUP_SWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain ivahd_44xx_clkdm = {
@@ -438,7 +206,6 @@ static struct clockdomain ivahd_44xx_clkdm = {
        .wkdep_srcs       = ivahd_wkup_sleep_deps,
        .sleepdep_srcs    = ivahd_wkup_sleep_deps,
        .flags            = CLKDM_CAN_HWSUP_SWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain l4_secure_44xx_clkdm = {
@@ -451,7 +218,6 @@ static struct clockdomain l4_secure_44xx_clkdm = {
        .wkdep_srcs       = l4_secure_wkup_sleep_deps,
        .sleepdep_srcs    = l4_secure_wkup_sleep_deps,
        .flags            = CLKDM_CAN_HWSUP_SWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain l4_per_44xx_clkdm = {
@@ -462,7 +228,6 @@ static struct clockdomain l4_per_44xx_clkdm = {
        .clkdm_offs       = OMAP4430_CM2_L4PER_L4PER_CDOFFS,
        .dep_bit          = OMAP4430_L4PER_STATDEP_SHIFT,
        .flags            = CLKDM_CAN_HWSUP_SWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain abe_44xx_clkdm = {
@@ -473,7 +238,6 @@ static struct clockdomain abe_44xx_clkdm = {
        .clkdm_offs       = OMAP4430_CM1_ABE_ABE_CDOFFS,
        .dep_bit          = OMAP4430_ABE_STATDEP_SHIFT,
        .flags            = CLKDM_CAN_HWSUP_SWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain l3_instr_44xx_clkdm = {
@@ -482,7 +246,6 @@ static struct clockdomain l3_instr_44xx_clkdm = {
        .prcm_partition   = OMAP4430_CM2_PARTITION,
        .cm_inst          = OMAP4430_CM2_CORE_INST,
        .clkdm_offs       = OMAP4430_CM2_CORE_L3INSTR_CDOFFS,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain l3_init_44xx_clkdm = {
@@ -495,7 +258,6 @@ static struct clockdomain l3_init_44xx_clkdm = {
        .wkdep_srcs       = l3_init_wkup_sleep_deps,
        .sleepdep_srcs    = l3_init_wkup_sleep_deps,
        .flags            = CLKDM_CAN_HWSUP_SWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain d2d_44xx_clkdm = {
@@ -507,7 +269,6 @@ static struct clockdomain d2d_44xx_clkdm = {
        .wkdep_srcs       = d2d_wkup_sleep_deps,
        .sleepdep_srcs    = d2d_wkup_sleep_deps,
        .flags            = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain mpu0_44xx_clkdm = {
@@ -517,7 +278,6 @@ static struct clockdomain mpu0_44xx_clkdm = {
        .cm_inst          = OMAP4430_PRCM_MPU_CPU0_INST,
        .clkdm_offs       = OMAP4430_PRCM_MPU_CPU0_CPU0_CDOFFS,
        .flags            = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain mpu1_44xx_clkdm = {
@@ -527,7 +287,6 @@ static struct clockdomain mpu1_44xx_clkdm = {
        .cm_inst          = OMAP4430_PRCM_MPU_CPU1_INST,
        .clkdm_offs       = OMAP4430_PRCM_MPU_CPU1_CPU1_CDOFFS,
        .flags            = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain l3_emif_44xx_clkdm = {
@@ -538,7 +297,6 @@ static struct clockdomain l3_emif_44xx_clkdm = {
        .clkdm_offs       = OMAP4430_CM2_CORE_MEMIF_CDOFFS,
        .dep_bit          = OMAP4430_MEMIF_STATDEP_SHIFT,
        .flags            = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain l4_ao_44xx_clkdm = {
@@ -548,7 +306,6 @@ static struct clockdomain l4_ao_44xx_clkdm = {
        .cm_inst          = OMAP4430_CM2_ALWAYS_ON_INST,
        .clkdm_offs       = OMAP4430_CM2_ALWAYS_ON_ALWON_CDOFFS,
        .flags            = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain ducati_44xx_clkdm = {
@@ -561,7 +318,6 @@ static struct clockdomain ducati_44xx_clkdm = {
        .wkdep_srcs       = ducati_wkup_sleep_deps,
        .sleepdep_srcs    = ducati_wkup_sleep_deps,
        .flags            = CLKDM_CAN_HWSUP_SWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain mpu_44xx_clkdm = {
@@ -573,7 +329,6 @@ static struct clockdomain mpu_44xx_clkdm = {
        .wkdep_srcs       = mpu_wkup_sleep_deps,
        .sleepdep_srcs    = mpu_wkup_sleep_deps,
        .flags            = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain l3_2_44xx_clkdm = {
@@ -584,7 +339,6 @@ static struct clockdomain l3_2_44xx_clkdm = {
        .clkdm_offs       = OMAP4430_CM2_CORE_L3_2_CDOFFS,
        .dep_bit          = OMAP4430_L3_2_STATDEP_SHIFT,
        .flags            = CLKDM_CAN_HWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain l3_1_44xx_clkdm = {
@@ -595,7 +349,6 @@ static struct clockdomain l3_1_44xx_clkdm = {
        .clkdm_offs       = OMAP4430_CM2_CORE_L3_1_CDOFFS,
        .dep_bit          = OMAP4430_L3_1_STATDEP_SHIFT,
        .flags            = CLKDM_CAN_HWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain iss_44xx_clkdm = {
@@ -607,7 +360,6 @@ static struct clockdomain iss_44xx_clkdm = {
        .wkdep_srcs       = iss_wkup_sleep_deps,
        .sleepdep_srcs    = iss_wkup_sleep_deps,
        .flags            = CLKDM_CAN_HWSUP_SWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain l3_dss_44xx_clkdm = {
@@ -620,7 +372,6 @@ static struct clockdomain l3_dss_44xx_clkdm = {
        .wkdep_srcs       = l3_dss_wkup_sleep_deps,
        .sleepdep_srcs    = l3_dss_wkup_sleep_deps,
        .flags            = CLKDM_CAN_HWSUP_SWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain l4_wkup_44xx_clkdm = {
@@ -631,7 +382,6 @@ static struct clockdomain l4_wkup_44xx_clkdm = {
        .clkdm_offs       = OMAP4430_PRM_WKUP_CM_WKUP_CDOFFS,
        .dep_bit          = OMAP4430_L4WKUP_STATDEP_SHIFT,
        .flags            = CLKDM_CAN_HWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain emu_sys_44xx_clkdm = {
@@ -641,7 +391,6 @@ static struct clockdomain emu_sys_44xx_clkdm = {
        .cm_inst          = OMAP4430_PRM_EMU_CM_INST,
        .clkdm_offs       = OMAP4430_PRM_EMU_CM_EMU_CDOFFS,
        .flags            = CLKDM_CAN_HWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct clockdomain l3_dma_44xx_clkdm = {
@@ -653,7 +402,6 @@ static struct clockdomain l3_dma_44xx_clkdm = {
        .wkdep_srcs       = l3_dma_wkup_sleep_deps,
        .sleepdep_srcs    = l3_dma_wkup_sleep_deps,
        .flags            = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* As clockdomains are added or removed above, this list must also be changed */
@@ -685,7 +433,10 @@ static struct clockdomain *clockdomains_omap44xx[] __initdata = {
        NULL
 };
 
+
 void __init omap44xx_clockdomains_init(void)
 {
-       clkdm_init(clockdomains_omap44xx, NULL, &omap4_clkdm_operations);
+       clkdm_register_platform_funcs(&omap4_clkdm_operations);
+       clkdm_register_clkdms(clockdomains_omap44xx);
+       clkdm_complete_init();
 }
index 3f20cbb9967b6718f2fe5a02f9a0f7f124cea15e..de61f15c48e29ee7e1bdbd89b8a1f26162730366 100644 (file)
@@ -56,6 +56,12 @@ void __init omap2_set_globals_242x(void)
 {
        __omap2_set_globals(&omap242x_globals);
 }
+
+void __init omap242x_map_io(void)
+{
+       omap2_set_globals_242x();
+       omap242x_map_common_io();
+}
 #endif
 
 #if defined(CONFIG_SOC_OMAP2430)
@@ -74,6 +80,12 @@ void __init omap2_set_globals_243x(void)
 {
        __omap2_set_globals(&omap243x_globals);
 }
+
+void __init omap243x_map_io(void)
+{
+       omap2_set_globals_243x();
+       omap243x_map_common_io();
+}
 #endif
 
 #if defined(CONFIG_ARCH_OMAP3)
@@ -138,5 +150,11 @@ void __init omap2_set_globals_443x(void)
        omap2_set_globals_control(&omap4_globals);
        omap2_set_globals_prcm(&omap4_globals);
 }
+
+void __init omap4_map_io(void)
+{
+       omap2_set_globals_443x();
+       omap44xx_map_common_io();
+}
 #endif
 
index 1077ad663f936e5174f0f3c7a137bee3f57a2972..37b4ef8b07e8c36e23c539e9a987f8ba6b18547a 100644 (file)
@@ -8,7 +8,7 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -16,6 +16,7 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/slab.h>
+#include <linux/of.h>
 
 #include <mach/hardware.h>
 #include <mach/irqs.h>
@@ -26,7 +27,6 @@
 #include <plat/tc.h>
 #include <plat/board.h>
 #include <plat/mcbsp.h>
-#include <mach/gpio.h>
 #include <plat/mmc.h>
 #include <plat/dma.h>
 #include <plat/omap_hwmod.h>
@@ -44,7 +44,7 @@ static int __init omap3_l3_init(void)
 {
        int l;
        struct omap_hwmod *oh;
-       struct omap_device *od;
+       struct platform_device *pdev;
        char oh_name[L3_MODULES_MAX_LEN];
 
        /*
@@ -61,12 +61,12 @@ static int __init omap3_l3_init(void)
        if (!oh)
                pr_err("could not look up %s\n", oh_name);
 
-       od = omap_device_build("omap_l3_smx", 0, oh, NULL, 0,
+       pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0,
                                                           NULL, 0, 0);
 
-       WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name);
+       WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
 
-       return IS_ERR(od) ? PTR_ERR(od) : 0;
+       return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
 }
 postcore_initcall(omap3_l3_init);
 
@@ -74,9 +74,13 @@ static int __init omap4_l3_init(void)
 {
        int l, i;
        struct omap_hwmod *oh[3];
-       struct omap_device *od;
+       struct platform_device *pdev;
        char oh_name[L3_MODULES_MAX_LEN];
 
+       /* If dtb is there, the devices will be created dynamically */
+       if (of_have_populated_dt())
+               return -ENODEV;
+
        /*
         * To avoid code running on other OMAPs in
         * multi-omap builds
@@ -92,12 +96,12 @@ static int __init omap4_l3_init(void)
                        pr_err("could not look up %s\n", oh_name);
        }
 
-       od = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL,
+       pdev = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL,
                                                     0, NULL, 0, 0);
 
-       WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name);
+       WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
 
-       return IS_ERR(od) ? PTR_ERR(od) : 0;
+       return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
 }
 postcore_initcall(omap4_l3_init);
 
@@ -221,18 +225,10 @@ static inline void omap_init_camera(void)
 #endif
 }
 
-struct omap_device_pm_latency omap_keyboard_latency[] = {
-       {
-               .deactivate_func = omap_device_idle_hwmods,
-               .activate_func   = omap_device_enable_hwmods,
-               .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-       },
-};
-
 int __init omap4_keyboard_init(struct omap4_keypad_platform_data
                        *sdp4430_keypad_data, struct omap_board_data *bdata)
 {
-       struct omap_device *od;
+       struct platform_device *pdev;
        struct omap_hwmod *oh;
        struct omap4_keypad_platform_data *keypad_data;
        unsigned int id = -1;
@@ -247,15 +243,13 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
 
        keypad_data = sdp4430_keypad_data;
 
-       od = omap_device_build(name, id, oh, keypad_data,
-                       sizeof(struct omap4_keypad_platform_data),
-                       omap_keyboard_latency,
-                       ARRAY_SIZE(omap_keyboard_latency), 0);
+       pdev = omap_device_build(name, id, oh, keypad_data,
+                       sizeof(struct omap4_keypad_platform_data), NULL, 0, 0);
 
-       if (IS_ERR(od)) {
+       if (IS_ERR(pdev)) {
                WARN(1, "Can't build omap_device for %s:%s.\n",
                                                name, oh->name);
-               return PTR_ERR(od);
+               return PTR_ERR(pdev);
        }
        oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt);
 
@@ -263,18 +257,10 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
 }
 
 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
-static struct omap_device_pm_latency mbox_latencies[] = {
-       [0] = {
-               .activate_func = omap_device_enable_hwmods,
-               .deactivate_func = omap_device_idle_hwmods,
-               .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-       },
-};
-
 static inline void omap_init_mbox(void)
 {
        struct omap_hwmod *oh;
-       struct omap_device *od;
+       struct platform_device *pdev;
 
        oh = omap_hwmod_lookup("mailbox");
        if (!oh) {
@@ -282,10 +268,9 @@ static inline void omap_init_mbox(void)
                return;
        }
 
-       od = omap_device_build("omap-mailbox", -1, oh, NULL, 0,
-                               mbox_latencies, ARRAY_SIZE(mbox_latencies), 0);
-       WARN(IS_ERR(od), "%s: could not build device, err %ld\n",
-                                               __func__, PTR_ERR(od));
+       pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0, NULL, 0, 0);
+       WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n",
+                                               __func__, PTR_ERR(pdev));
 }
 #else
 static inline void omap_init_mbox(void) { }
@@ -334,17 +319,9 @@ static inline void omap_init_audio(void) {}
 
 #include <plat/mcspi.h>
 
-struct omap_device_pm_latency omap_mcspi_latency[] = {
-       [0] = {
-               .deactivate_func = omap_device_idle_hwmods,
-               .activate_func   = omap_device_enable_hwmods,
-               .flags           = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-       },
-};
-
 static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
 {
-       struct omap_device *od;
+       struct platform_device *pdev;
        char *name = "omap2_mcspi";
        struct omap2_mcspi_platform_config *pdata;
        static int spi_num;
@@ -371,10 +348,9 @@ static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
        }
 
        spi_num++;
-       od = omap_device_build(name, spi_num, oh, pdata,
-                               sizeof(*pdata), omap_mcspi_latency,
-                               ARRAY_SIZE(omap_mcspi_latency), 0);
-       WARN(IS_ERR(od), "Can't build omap_device for %s:%s\n",
+       pdev = omap_device_build(name, spi_num, oh, pdata,
+                               sizeof(*pdata), NULL, 0, 0);
+       WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
                                name, oh->name);
        kfree(pdata);
        return 0;
@@ -698,18 +674,10 @@ static int __init omap2_init_devices(void)
 arch_initcall(omap2_init_devices);
 
 #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
-static struct omap_device_pm_latency omap_wdt_latency[] = {
-       [0] = {
-               .deactivate_func = omap_device_idle_hwmods,
-               .activate_func   = omap_device_enable_hwmods,
-               .flags           = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-       },
-};
-
 static int __init omap_init_wdt(void)
 {
        int id = -1;
-       struct omap_device *od;
+       struct platform_device *pdev;
        struct omap_hwmod *oh;
        char *oh_name = "wd_timer2";
        char *dev_name = "omap_wdt";
@@ -723,10 +691,8 @@ static int __init omap_init_wdt(void)
                return -EINVAL;
        }
 
-       od = omap_device_build(dev_name, id, oh, NULL, 0,
-                               omap_wdt_latency,
-                               ARRAY_SIZE(omap_wdt_latency), 0);
-       WARN(IS_ERR(od), "Can't build omap_device for %s:%s.\n",
+       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;
 }
index a5b7a236aa5bf97867136373068765447e7b9838..8ad0a2f0367d70d300327dbd6989c6a32596c468 100644 (file)
@@ -35,14 +35,6 @@ static struct platform_device omap_display_device = {
        },
 };
 
-static struct omap_device_pm_latency omap_dss_latency[] = {
-       [0] = {
-               .deactivate_func        = omap_device_idle_hwmods,
-               .activate_func          = omap_device_enable_hwmods,
-               .flags                  = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-       },
-};
-
 struct omap_dss_hwmod_data {
        const char *oh_name;
        const char *dev_name;
@@ -78,7 +70,7 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
 {
        int r = 0;
        struct omap_hwmod *oh;
-       struct omap_device *od;
+       struct platform_device *pdev;
        int i, oh_count;
        struct omap_display_platform_data pdata;
        const struct omap_dss_hwmod_data *curr_dss_hwmod;
@@ -108,13 +100,12 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
                        return -ENODEV;
                }
 
-               od = omap_device_build(curr_dss_hwmod[i].dev_name,
+               pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
                                curr_dss_hwmod[i].id, oh, &pdata,
                                sizeof(struct omap_display_platform_data),
-                               omap_dss_latency,
-                               ARRAY_SIZE(omap_dss_latency), 0);
+                               NULL, 0, 0);
 
-               if (WARN((IS_ERR(od)), "Could not build omap_device for %s\n",
+               if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n",
                                curr_dss_hwmod[i].oh_name))
                        return -ENODEV;
        }
index c9ff0e79703d43d233c4533e3bf120aec1b19b14..a59a45a0096ef77276811c6641a39e8149ceef5c 100644 (file)
@@ -87,14 +87,6 @@ static u16 reg_map[] = {
        [CCDN]                  = 0xd8,
 };
 
-static struct omap_device_pm_latency omap2_dma_latency[] = {
-       {
-               .deactivate_func = omap_device_idle_hwmods,
-               .activate_func   = omap_device_enable_hwmods,
-               .flags           = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-       },
-};
-
 static void __iomem *dma_base;
 static inline void dma_write(u32 val, int reg, int lch)
 {
@@ -228,7 +220,7 @@ static u32 configure_dma_errata(void)
 /* One time initializations */
 static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 {
-       struct omap_device                      *od;
+       struct platform_device                  *pdev;
        struct omap_system_dma_plat_info        *p;
        struct resource                         *mem;
        char                                    *name = "omap_dma_system";
@@ -258,23 +250,22 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 
        p->errata               = configure_dma_errata();
 
-       od = omap_device_build(name, 0, oh, p, sizeof(*p),
-                       omap2_dma_latency, ARRAY_SIZE(omap2_dma_latency), 0);
+       pdev = omap_device_build(name, 0, oh, p, sizeof(*p), NULL, 0, 0);
        kfree(p);
-       if (IS_ERR(od)) {
+       if (IS_ERR(pdev)) {
                pr_err("%s: Can't build omap_device for %s:%s.\n",
                        __func__, name, oh->name);
-               return PTR_ERR(od);
+               return PTR_ERR(pdev);
        }
 
-       mem = platform_get_resource(&od->pdev, IORESOURCE_MEM, 0);
+       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (!mem) {
-               dev_err(&od->pdev.dev, "%s: no mem resource\n", __func__);
+               dev_err(&pdev->dev, "%s: no mem resource\n", __func__);
                return -EINVAL;
        }
        dma_base = ioremap(mem->start, resource_size(mem));
        if (!dma_base) {
-               dev_err(&od->pdev.dev, "%s: ioremap fail\n", __func__);
+               dev_err(&pdev->dev, "%s: ioremap fail\n", __func__);
                return -ENOMEM;
        }
 
@@ -283,7 +274,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
                                        (d->lch_count), GFP_KERNEL);
 
        if (!d->chan) {
-               dev_err(&od->pdev.dev, "%s: kzalloc fail\n", __func__);
+               dev_err(&pdev->dev, "%s: kzalloc fail\n", __func__);
                return -ENOMEM;
        }
        return 0;
index 2765cdc3152df6c9d5d18dcf707b98599b0bb92b..8cbfbc2918ce3b88168dadd29cdc90d0e530ffe7 100644 (file)
 #include <plat/omap_hwmod.h>
 #include <plat/omap_device.h>
 
-static struct omap_device_pm_latency omap_gpio_latency[] = {
-       [0] = {
-               .deactivate_func = omap_device_idle_hwmods,
-               .activate_func   = omap_device_enable_hwmods,
-               .flags           = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-       },
-};
-
 static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 {
-       struct omap_device *od;
+       struct platform_device *pdev;
        struct omap_gpio_platform_data *pdata;
        struct omap_gpio_dev_attr *dev_attr;
        char *name = "omap_gpio";
@@ -107,19 +99,17 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
                return -EINVAL;
        }
 
-       od = omap_device_build(name, id - 1, oh, pdata,
-                               sizeof(*pdata), omap_gpio_latency,
-                               ARRAY_SIZE(omap_gpio_latency),
-                               false);
+       pdev = omap_device_build(name, id - 1, oh, pdata,
+                               sizeof(*pdata), NULL, 0, false);
        kfree(pdata);
 
-       if (IS_ERR(od)) {
+       if (IS_ERR(pdev)) {
                WARN(1, "Can't build omap_device for %s:%s.\n",
                                        name, oh->name);
-               return PTR_ERR(od);
+               return PTR_ERR(pdev);
        }
 
-       omap_device_disable_idle_on_suspend(od);
+       omap_device_disable_idle_on_suspend(pdev);
 
        gpio_bank_count++;
        return 0;
index a9b45c76e1d36a59dc2ad288cbbf2f87cdfe4a1b..77085847e4e7dafc893a2d255bee5dbac90d4d55 100644 (file)
@@ -137,8 +137,7 @@ static void omap4_hsmmc1_before_set_reg(struct device *dev, int slot,
         */
        reg = omap4_ctrl_pad_readl(control_pbias_offset);
        reg &= ~(OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
-               OMAP4_MMC1_PWRDNZ_MASK |
-               OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
+               OMAP4_MMC1_PWRDNZ_MASK);
        omap4_ctrl_pad_writel(reg, control_pbias_offset);
 }
 
@@ -156,8 +155,7 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
                else
                        reg |= OMAP4_MMC1_PBIASLITE_VMODE_MASK;
                reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
-                       OMAP4_MMC1_PWRDNZ_MASK |
-                       OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
+                       OMAP4_MMC1_PWRDNZ_MASK);
                omap4_ctrl_pad_writel(reg, control_pbias_offset);
 
                timeout = jiffies + msecs_to_jiffies(5);
@@ -171,16 +169,14 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
                if (reg & OMAP4_MMC1_PBIASLITE_VMODE_ERROR_MASK) {
                        pr_err("Pbias Voltage is not same as LDO\n");
                        /* Caution : On VMODE_ERROR Power Down MMC IO */
-                       reg &= ~(OMAP4_MMC1_PWRDNZ_MASK |
-                               OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
+                       reg &= ~(OMAP4_MMC1_PWRDNZ_MASK);
                        omap4_ctrl_pad_writel(reg, control_pbias_offset);
                }
        } else {
                reg = omap4_ctrl_pad_readl(control_pbias_offset);
                reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
                        OMAP4_MMC1_PWRDNZ_MASK |
-                       OMAP4_MMC1_PBIASLITE_VMODE_MASK |
-                       OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
+                       OMAP4_MMC1_PBIASLITE_VMODE_MASK);
                omap4_ctrl_pad_writel(reg, control_pbias_offset);
        }
 }
@@ -413,31 +409,17 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
        return 0;
 }
 
-static struct omap_device_pm_latency omap_hsmmc_latency[] = {
-       [0] = {
-               .deactivate_func = omap_device_idle_hwmods,
-               .activate_func   = omap_device_enable_hwmods,
-               .flags           = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-       },
-       /*
-        * XXX There should also be an entry here to power off/on the
-        * MMC regulators/PBIAS cells, etc.
-        */
-};
-
 #define MAX_OMAP_MMC_HWMOD_NAME_LEN            16
 
 void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
 {
        struct omap_hwmod *oh;
-       struct omap_device *od;
-       struct omap_device_pm_latency *ohl;
+       struct platform_device *pdev;
        char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN];
        struct omap_mmc_platform_data *mmc_data;
        struct omap_mmc_dev_attr *mmc_dev_attr;
        char *name;
        int l;
-       int ohl_cnt = 0;
 
        mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL);
        if (!mmc_data) {
@@ -452,8 +434,6 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
        omap_hsmmc_mux(mmc_data, (ctrl_nr - 1));
 
        name = "omap_hsmmc";
-       ohl = omap_hsmmc_latency;
-       ohl_cnt = ARRAY_SIZE(omap_hsmmc_latency);
 
        l = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN,
                     "mmc%d", ctrl_nr);
@@ -471,9 +451,9 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
                mmc_data->controller_flags = mmc_dev_attr->flags;
        }
 
-       od = omap_device_build(name, ctrl_nr - 1, oh, mmc_data,
-               sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false);
-       if (IS_ERR(od)) {
+       pdev = omap_device_build(name, ctrl_nr - 1, oh, mmc_data,
+               sizeof(struct omap_mmc_platform_data), NULL, 0, false);
+       if (IS_ERR(pdev)) {
                WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name);
                kfree(mmc_data->slots[0].name);
                goto done;
@@ -482,7 +462,7 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
         * return device handle to board setup code
         * required to populate for regulator framework structure
         */
-       hsmmcinfo->dev = &od->pdev.dev;
+       hsmmcinfo->dev = &pdev->dev;
 
 done:
        kfree(mmc_data);
index 06d4a80660a5e17658fe8b16513e3f238aa2d10b..36e21091b06aa534e9724850e0dfc36769e36f26 100644 (file)
 #include <plat/omap_hwmod.h>
 #include <plat/omap_device.h>
 
-struct omap_device_pm_latency omap_spinlock_latency[] = {
-       {
-               .deactivate_func = omap_device_idle_hwmods,
-               .activate_func   = omap_device_enable_hwmods,
-               .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-       }
-};
-
 int __init hwspinlocks_init(void)
 {
        int retval = 0;
        struct omap_hwmod *oh;
-       struct omap_device *od;
+       struct platform_device *pdev;
        const char *oh_name = "spinlock";
        const char *dev_name = "omap_hwspinlock";
 
@@ -48,13 +40,11 @@ int __init hwspinlocks_init(void)
        if (oh == NULL)
                return -EINVAL;
 
-       od = omap_device_build(dev_name, 0, oh, NULL, 0,
-                               omap_spinlock_latency,
-                               ARRAY_SIZE(omap_spinlock_latency), false);
-       if (IS_ERR(od)) {
+       pdev = omap_device_build(dev_name, 0, oh, NULL, 0, NULL, 0, false);
+       if (IS_ERR(pdev)) {
                pr_err("Can't build omap_device for %s:%s\n", dev_name,
                                                                oh_name);
-               retval = PTR_ERR(od);
+               retval = PTR_ERR(pdev);
        }
 
        return retval;
index 37efb8696927bdf2c2d81cdf8b6a17c85ef772e2..d27daf921c7ee83d18a82e474c93d3088190d3f3 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "control.h"
 
-static struct omap_chip_id omap_chip;
 static unsigned int omap_revision;
 
 u32 omap_features;
@@ -39,19 +38,6 @@ unsigned int omap_rev(void)
 }
 EXPORT_SYMBOL(omap_rev);
 
-/**
- * omap_chip_is - test whether currently running OMAP matches a chip type
- * @oc: omap_chip_t to test against
- *
- * Test whether the currently-running OMAP chip matches the supplied
- * chip type 'oc'.  Returns 1 upon a match; 0 upon failure.
- */
-int omap_chip_is(struct omap_chip_id oci)
-{
-       return (oci.oc & omap_chip.oc) ? 1 : 0;
-}
-EXPORT_SYMBOL(omap_chip_is);
-
 int omap_type(void)
 {
        u32 val = 0;
@@ -242,14 +228,12 @@ static void __init ti816x_check_features(void)
        omap_features = OMAP3_HAS_NEON;
 }
 
-static void __init omap3_check_revision(void)
+static void __init omap3_check_revision(const char **cpu_rev)
 {
        u32 cpuid, idcode;
        u16 hawkeye;
        u8 rev;
 
-       omap_chip.oc = CHIP_IS_OMAP3430;
-
        /*
         * We cannot access revision registers on ES1.0.
         * If the processor type is Cortex-A8 and the revision is 0x0
@@ -258,7 +242,7 @@ static void __init omap3_check_revision(void)
        cpuid = read_cpuid(CPUID_ID);
        if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) {
                omap_revision = OMAP3430_REV_ES1_0;
-               omap_chip.oc |= CHIP_IS_OMAP3430ES1;
+               *cpu_rev = "1.0";
                return;
        }
 
@@ -279,77 +263,85 @@ static void __init omap3_check_revision(void)
                case 0: /* Take care of early samples */
                case 1:
                        omap_revision = OMAP3430_REV_ES2_0;
-                       omap_chip.oc |= CHIP_IS_OMAP3430ES2;
+                       *cpu_rev = "2.0";
                        break;
                case 2:
                        omap_revision = OMAP3430_REV_ES2_1;
-                       omap_chip.oc |= CHIP_IS_OMAP3430ES2;
+                       *cpu_rev = "2.1";
                        break;
                case 3:
                        omap_revision = OMAP3430_REV_ES3_0;
-                       omap_chip.oc |= CHIP_IS_OMAP3430ES3_0;
+                       *cpu_rev = "3.0";
                        break;
                case 4:
                        omap_revision = OMAP3430_REV_ES3_1;
-                       omap_chip.oc |= CHIP_IS_OMAP3430ES3_1;
+                       *cpu_rev = "3.1";
                        break;
                case 7:
                /* FALLTHROUGH */
                default:
                        /* Use the latest known revision as default */
                        omap_revision = OMAP3430_REV_ES3_1_2;
-
-                       /* REVISIT: Add CHIP_IS_OMAP3430ES3_1_2? */
-                       omap_chip.oc |= CHIP_IS_OMAP3430ES3_1;
+                       *cpu_rev = "3.1.2";
                }
                break;
        case 0xb868:
-               /* Handle OMAP35xx/AM35xx devices
+               /*
+                * Handle OMAP/AM 3505/3517 devices
                 *
-                * Set the device to be OMAP3505 here. Actual device
+                * Set the device to be OMAP3517 here. Actual device
                 * is identified later based on the features.
-                *
-                * REVISIT: AM3505/AM3517 should have their own CHIP_IS
                 */
-               omap_revision = OMAP3505_REV(rev);
-               omap_chip.oc |= CHIP_IS_OMAP3430ES3_1;
+               switch (rev) {
+               case 0:
+                       omap_revision = OMAP3517_REV_ES1_0;
+                       *cpu_rev = "1.0";
+                       break;
+               case 1:
+               /* FALLTHROUGH */
+               default:
+                       omap_revision = OMAP3517_REV_ES1_1;
+                       *cpu_rev = "1.1";
+               }
                break;
        case 0xb891:
                /* Handle 36xx devices */
-               omap_chip.oc |= CHIP_IS_OMAP3630ES1;
 
                switch(rev) {
                case 0: /* Take care of early samples */
                        omap_revision = OMAP3630_REV_ES1_0;
+                       *cpu_rev = "1.0";
                        break;
                case 1:
                        omap_revision = OMAP3630_REV_ES1_1;
-                       omap_chip.oc |= CHIP_IS_OMAP3630ES1_1;
+                       *cpu_rev = "1.1";
                        break;
                case 2:
+               /* FALLTHROUGH */
                default:
-                       omap_revision =  OMAP3630_REV_ES1_2;
-                       omap_chip.oc |= CHIP_IS_OMAP3630ES1_2;
+                       omap_revision = OMAP3630_REV_ES1_2;
+                       *cpu_rev = "1.2";
                }
                break;
        case 0xb81e:
-               omap_chip.oc = CHIP_IS_TI816X;
-
                switch (rev) {
                case 0:
                        omap_revision = TI8168_REV_ES1_0;
+                       *cpu_rev = "1.0";
                        break;
                case 1:
+               /* FALLTHROUGH */
+               default:
                        omap_revision = TI8168_REV_ES1_1;
+                       *cpu_rev = "1.1";
                        break;
-               default:
-                       omap_revision =  TI8168_REV_ES1_1;
                }
                break;
        default:
-               /* Unknown default to latest silicon rev as default*/
-               omap_revision =  OMAP3630_REV_ES1_2;
-               omap_chip.oc |= CHIP_IS_OMAP3630ES1_2;
+               /* Unknown default to latest silicon rev as default */
+               omap_revision = OMAP3630_REV_ES1_2;
+               *cpu_rev = "1.2";
+               pr_warn("Warning: unknown chip type; assuming OMAP3630ES1.2\n");
        }
 }
 
@@ -382,24 +374,20 @@ static void __init omap4_check_revision(void)
                switch (rev) {
                case 0:
                        omap_revision = OMAP4430_REV_ES1_0;
-                       omap_chip.oc |= CHIP_IS_OMAP4430ES1;
                        break;
                case 1:
                default:
                        omap_revision = OMAP4430_REV_ES2_0;
-                       omap_chip.oc |= CHIP_IS_OMAP4430ES2;
                }
                break;
        case 0xb95c:
                switch (rev) {
                case 3:
                        omap_revision = OMAP4430_REV_ES2_1;
-                       omap_chip.oc |= CHIP_IS_OMAP4430ES2_1;
                        break;
                case 4:
                default:
                        omap_revision = OMAP4430_REV_ES2_2;
-                       omap_chip.oc |= CHIP_IS_OMAP4430ES2_2;
                }
                break;
        case 0xb94e:
@@ -407,14 +395,12 @@ static void __init omap4_check_revision(void)
                case 0:
                default:
                        omap_revision = OMAP4460_REV_ES1_0;
-                       omap_chip.oc |= CHIP_IS_OMAP4460ES1_0;
                        break;
                }
                break;
        default:
                /* Unknown default to latest silicon rev as default */
                omap_revision = OMAP4430_REV_ES2_2;
-               omap_chip.oc |= CHIP_IS_OMAP4430ES2_2;
        }
 
        pr_info("OMAP%04x ES%d.%d\n", omap_rev() >> 16,
@@ -425,94 +411,33 @@ static void __init omap4_check_revision(void)
        if (omap3_has_ ##feat())                \
                printk(#feat" ");
 
-static void __init omap3_cpuinfo(void)
+static void __init omap3_cpuinfo(const char *cpu_rev)
 {
-       u8 rev = GET_OMAP_REVISION();
-       char cpu_name[16], cpu_rev[16];
+       const char *cpu_name;
 
-       /* OMAP3430 and OMAP3530 are assumed to be same.
+       /*
+        * OMAP3430 and OMAP3530 are assumed to be same.
         *
         * OMAP3525, OMAP3515 and OMAP3503 can be detected only based
         * on available features. Upon detection, update the CPU id
         * and CPU class bits.
         */
        if (cpu_is_omap3630()) {
-               strcpy(cpu_name, "OMAP3630");
-       } else if (cpu_is_omap3505()) {
-               /*
-                * AM35xx devices
-                */
-               if (omap3_has_sgx()) {
-                       omap_revision = OMAP3517_REV(rev);
-                       strcpy(cpu_name, "AM3517");
-               } else {
-                       /* Already set in omap3_check_revision() */
-                       strcpy(cpu_name, "AM3505");
-               }
+               cpu_name = "OMAP3630";
+       } else if (cpu_is_omap3517()) {
+               /* AM35xx devices */
+               cpu_name = (omap3_has_sgx()) ? "AM3517" : "AM3505";
        } else if (cpu_is_ti816x()) {
-               strcpy(cpu_name, "TI816X");
+               cpu_name = "TI816X";
        } else if (omap3_has_iva() && omap3_has_sgx()) {
                /* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices */
-               strcpy(cpu_name, "OMAP3430/3530");
+               cpu_name = "OMAP3430/3530";
        } else if (omap3_has_iva()) {
-               omap_revision = OMAP3525_REV(rev);
-               strcpy(cpu_name, "OMAP3525");
+               cpu_name = "OMAP3525";
        } else if (omap3_has_sgx()) {
-               omap_revision = OMAP3515_REV(rev);
-               strcpy(cpu_name, "OMAP3515");
+               cpu_name = "OMAP3515";
        } else {
-               omap_revision = OMAP3503_REV(rev);
-               strcpy(cpu_name, "OMAP3503");
-       }
-
-       if (cpu_is_omap3630() || cpu_is_ti816x()) {
-               switch (rev) {
-               case OMAP_REVBITS_00:
-                       strcpy(cpu_rev, "1.0");
-                       break;
-               case OMAP_REVBITS_01:
-                       strcpy(cpu_rev, "1.1");
-                       break;
-               case OMAP_REVBITS_02:
-                       /* FALLTHROUGH */
-               default:
-                       /* Use the latest known revision as default */
-                       strcpy(cpu_rev, "1.2");
-               }
-       } else if (cpu_is_omap3505() || cpu_is_omap3517()) {
-               switch (rev) {
-               case OMAP_REVBITS_00:
-                       strcpy(cpu_rev, "1.0");
-                       break;
-               case OMAP_REVBITS_01:
-                       /* FALLTHROUGH */
-               default:
-                       /* Use the latest known revision as default */
-                       strcpy(cpu_rev, "1.1");
-               }
-       } else {
-               switch (rev) {
-               case OMAP_REVBITS_00:
-                       strcpy(cpu_rev, "1.0");
-                       break;
-               case OMAP_REVBITS_01:
-                       strcpy(cpu_rev, "2.0");
-                       break;
-               case OMAP_REVBITS_02:
-                       strcpy(cpu_rev, "2.1");
-                       break;
-               case OMAP_REVBITS_03:
-                       strcpy(cpu_rev, "3.0");
-                       break;
-               case OMAP_REVBITS_04:
-                       strcpy(cpu_rev, "3.1");
-                       break;
-               case OMAP_REVBITS_05:
-                       /* FALLTHROUGH */
-               default:
-                       /* Use the latest known revision as default */
-                       strcpy(cpu_rev, "3.1.2");
-               }
+               cpu_name = "OMAP3503";
        }
 
        /* Print verbose information */
@@ -533,6 +458,8 @@ static void __init omap3_cpuinfo(void)
  */
 void __init omap2_check_revision(void)
 {
+       const char *cpu_rev;
+
        /*
         * At this point we have an idea about the processor revision set
         * earlier with omap2_set_globals_tap().
@@ -540,7 +467,7 @@ void __init omap2_check_revision(void)
        if (cpu_is_omap24xx()) {
                omap24xx_check_revision();
        } else if (cpu_is_omap34xx()) {
-               omap3_check_revision();
+               omap3_check_revision(&cpu_rev);
 
                /* TI816X doesn't have feature register */
                if (!cpu_is_ti816x())
@@ -548,7 +475,7 @@ void __init omap2_check_revision(void)
                else
                        ti816x_check_features();
 
-               omap3_cpuinfo();
+               omap3_cpuinfo(cpu_rev);
                return;
        } else if (cpu_is_omap44xx()) {
                omap4_check_revision();
@@ -557,22 +484,6 @@ void __init omap2_check_revision(void)
        } else {
                pr_err("OMAP revision unknown, please fix!\n");
        }
-
-       /*
-        * OK, now we know the exact revision. Initialize omap_chip bits
-        * for powerdowmain and clockdomain code.
-        */
-       if (cpu_is_omap243x()) {
-               /* Currently only supports 2430ES2.1 and 2430-all */
-               omap_chip.oc |= CHIP_IS_OMAP2430;
-               return;
-       } else if (cpu_is_omap242x()) {
-               /* Currently only supports 2420ES2.1.1 and 2420-all */
-               omap_chip.oc |= CHIP_IS_OMAP2420;
-               return;
-       }
-
-       pr_err("Uninitialized omap_chip, please fix!\n");
 }
 
 /*
index d6d01cb7f28a63b2a7bc3ac060cb059a030bf584..f01273006e4d1d79494b524b29fe3455566e293a 100644 (file)
@@ -37,6 +37,7 @@
 #include "io.h"
 
 #include <plat/omap-pm.h>
+#include "voltage.h"
 #include "powerdomain.h"
 
 #include "clockdomain.h"
@@ -341,18 +342,22 @@ void __init omap2_init_common_infrastructure(void)
        u8 postsetup_state;
 
        if (cpu_is_omap242x()) {
-               omap2xxx_powerdomains_init();
-               omap2xxx_clockdomains_init();
+               omap2xxx_voltagedomains_init();
+               omap242x_powerdomains_init();
+               omap242x_clockdomains_init();
                omap2420_hwmod_init();
        } else if (cpu_is_omap243x()) {
-               omap2xxx_powerdomains_init();
-               omap2xxx_clockdomains_init();
+               omap2xxx_voltagedomains_init();
+               omap243x_powerdomains_init();
+               omap243x_clockdomains_init();
                omap2430_hwmod_init();
        } else if (cpu_is_omap34xx()) {
+               omap3xxx_voltagedomains_init();
                omap3xxx_powerdomains_init();
                omap3xxx_clockdomains_init();
                omap3xxx_hwmod_init();
        } else if (cpu_is_omap44xx()) {
+               omap44xx_voltagedomains_init();
                omap44xx_powerdomains_init();
                omap44xx_clockdomains_init();
                omap44xx_hwmod_init();
@@ -376,7 +381,7 @@ void __init omap2_init_common_infrastructure(void)
         * omap_hwmod_late_init(), so boards that desire full watchdog
         * coverage of kernel initialization can reprogram the
         * postsetup_state between the calls to
-        * omap2_init_common_infra() and omap2_init_common_devices().
+        * omap2_init_common_infra() and omap_sdrc_init().
         *
         * XXX ideally we could detect whether the MPU WDT was currently
         * enabled here and make this conditional
@@ -400,7 +405,47 @@ void __init omap2_init_common_infrastructure(void)
                pr_err("Could not init clock framework - unknown SoC\n");
 }
 
-void __init omap2_init_common_devices(struct omap_sdrc_params *sdrc_cs0,
+void __init omap2420_init_early(void)
+{
+       omap2_init_common_infrastructure();
+}
+
+void __init omap2430_init_early(void)
+{
+       omap2_init_common_infrastructure();
+}
+
+void __init omap3430_init_early(void)
+{
+       omap2_init_common_infrastructure();
+}
+
+void __init omap35xx_init_early(void)
+{
+       omap2_init_common_infrastructure();
+}
+
+void __init omap3630_init_early(void)
+{
+       omap2_init_common_infrastructure();
+}
+
+void __init am35xx_init_early(void)
+{
+       omap2_init_common_infrastructure();
+}
+
+void __init ti816x_init_early(void)
+{
+       omap2_init_common_infrastructure();
+}
+
+void __init omap4430_init_early(void)
+{
+       omap2_init_common_infrastructure();
+}
+
+void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
                                      struct omap_sdrc_params *sdrc_cs1)
 {
        if (cpu_is_omap24xx() || omap3_has_sdrc()) {
index 3a12f7586a4cfc1e258aee208390065b79b6051b..65f1be6a182cf6a384b72156ced623592d549d71 100644 (file)
@@ -165,8 +165,8 @@ static void __init omap_init_irq(u32 base, int nr_irqs)
 
                omap_irq_bank_init_one(bank);
 
-               for (i = 0, j = 0; i < bank->nr_irqs; i += 32, j += 0x20)
-                       omap_alloc_gc(bank->base_reg + j, i, 32);
+               for (j = 0; j < bank->nr_irqs; j += 32)
+                       omap_alloc_gc(bank->base_reg + j, j, 32);
 
                nr_of_irqs += bank->nr_irqs;
                nr_banks++;
index 4a6ef6ab845841b1bcf1d1cbd8674f30bfd23053..292eee3be15fdc10096b6833fc438b2ecab9ccea 100644 (file)
 
 #include "control.h"
 
-/* McBSP internal signal muxing functions */
+/*
+ * 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 "cm-regbits-34xx.h"
 
-void omap2_mcbsp1_mux_clkr_src(u8 mux)
+/* McBSP internal signal muxing function */
+static int omap2_mcbsp1_mux_rx_clk(struct device *dev, const char *signal,
+                                  const char *src)
 {
        u32 v;
 
        v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
-       if (mux == CLKR_SRC_CLKR)
-               v &= ~OMAP2_MCBSP1_CLKR_MASK;
-       else if (mux == CLKR_SRC_CLKX)
-               v |= OMAP2_MCBSP1_CLKR_MASK;
-       omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
-}
-EXPORT_SYMBOL(omap2_mcbsp1_mux_clkr_src);
 
-void omap2_mcbsp1_mux_fsr_src(u8 mux)
-{
-       u32 v;
+       if (!strcmp(signal, "clkr")) {
+               if (!strcmp(src, "clkr"))
+                       v &= ~OMAP2_MCBSP1_CLKR_MASK;
+               else if (!strcmp(src, "clkx"))
+                       v |= OMAP2_MCBSP1_CLKR_MASK;
+               else
+                       return -EINVAL;
+       } else if (!strcmp(signal, "fsr")) {
+               if (!strcmp(src, "fsr"))
+                       v &= ~OMAP2_MCBSP1_FSR_MASK;
+               else if (!strcmp(src, "fsx"))
+                       v |= OMAP2_MCBSP1_FSR_MASK;
+               else
+                       return -EINVAL;
+       } else {
+               return -EINVAL;
+       }
 
-       v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
-       if (mux == FSR_SRC_FSR)
-               v &= ~OMAP2_MCBSP1_FSR_MASK;
-       else if (mux == FSR_SRC_FSX)
-               v |= OMAP2_MCBSP1_FSR_MASK;
        omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
+
+       return 0;
 }
-EXPORT_SYMBOL(omap2_mcbsp1_mux_fsr_src);
 
 /* McBSP CLKS source switching function */
-
-int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id)
+static int omap2_mcbsp_set_clk_src(struct device *dev, struct clk *clk,
+                                  const char *src)
 {
-       struct omap_mcbsp *mcbsp;
        struct clk *fck_src;
        char *fck_src_name;
        int r;
 
-       if (!omap_mcbsp_check_valid_id(id)) {
-               pr_err("%s: Invalid id (%d)\n", __func__, id + 1);
-               return -EINVAL;
-       }
-       mcbsp = id_to_mcbsp_ptr(id);
-
-       if (fck_src_id == MCBSP_CLKS_PAD_SRC)
+       if (!strcmp(src, "clks_ext"))
                fck_src_name = "pad_fck";
-       else if (fck_src_id == MCBSP_CLKS_PRCM_SRC)
+       else if (!strcmp(src, "clks_fclk"))
                fck_src_name = "prcm_fck";
        else
                return -EINVAL;
 
-       fck_src = clk_get(mcbsp->dev, fck_src_name);
+       fck_src = clk_get(dev, fck_src_name);
        if (IS_ERR_OR_NULL(fck_src)) {
                pr_err("omap-mcbsp: %s: could not clk_get() %s\n", "clks",
                       fck_src_name);
                return -EINVAL;
        }
 
-       pm_runtime_put_sync(mcbsp->dev);
+       pm_runtime_put_sync(dev);
 
-       r = clk_set_parent(mcbsp->fclk, fck_src);
+       r = clk_set_parent(clk, fck_src);
        if (IS_ERR_VALUE(r)) {
                pr_err("omap-mcbsp: %s: could not clk_set_parent() to %s\n",
                       "clks", fck_src_name);
@@ -94,21 +97,30 @@ int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id)
                return -EINVAL;
        }
 
-       pm_runtime_get_sync(mcbsp->dev);
+       pm_runtime_get_sync(dev);
 
        clk_put(fck_src);
 
        return 0;
 }
-EXPORT_SYMBOL(omap2_mcbsp_set_clks_src);
 
-struct omap_device_pm_latency omap2_mcbsp_latency[] = {
-       {
-               .deactivate_func = omap_device_idle_hwmods,
-               .activate_func   = omap_device_enable_hwmods,
-               .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-       },
-};
+static int omap3_enable_st_clock(unsigned int id, bool enable)
+{
+       unsigned int w;
+
+       /*
+        * Sidetone uses McBSP ICLK - which must not idle when sidetones
+        * are enabled or sidetones start sounding ugly.
+        */
+       w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
+       if (enable)
+               w &= ~(1 << (id - 2));
+       else
+               w |= 1 << (id - 2);
+       omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
+
+       return 0;
+}
 
 static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
 {
@@ -116,7 +128,7 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
        char *name = "omap-mcbsp";
        struct omap_hwmod *oh_device[2];
        struct omap_mcbsp_platform_data *pdata = NULL;
-       struct omap_device *od;
+       struct platform_device *pdev;
 
        sscanf(oh->name, "mcbsp%d", &id);
 
@@ -126,7 +138,13 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
                return -ENOMEM;
        }
 
-       pdata->mcbsp_config_type = oh->class->rev;
+       pdata->reg_step = 4;
+       if (oh->class->rev < MCBSP_CONFIG_TYPE2) {
+               pdata->reg_size = 2;
+       } else {
+               pdata->reg_size = 4;
+               pdata->has_ccr = true;
+       }
 
        if (oh->class->rev == MCBSP_CONFIG_TYPE3) {
                if (id == 2)
@@ -137,22 +155,28 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
                        pdata->buffer_size = 0x80;
        }
 
+       if (oh->class->rev >= MCBSP_CONFIG_TYPE3)
+               pdata->has_wakeup = true;
+
        oh_device[0] = oh;
 
        if (oh->dev_attr) {
                oh_device[1] = omap_hwmod_lookup((
                (struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone);
+               pdata->enable_st_clock = omap3_enable_st_clock;
                count++;
        }
-       od = omap_device_build_ss(name, id, oh_device, count, pdata,
-                               sizeof(*pdata), omap2_mcbsp_latency,
-                               ARRAY_SIZE(omap2_mcbsp_latency), false);
+       pdev = omap_device_build_ss(name, id, oh_device, count, pdata,
+                               sizeof(*pdata), NULL, 0, false);
        kfree(pdata);
-       if (IS_ERR(od))  {
+       if (IS_ERR(pdev))  {
                pr_err("%s: Can't build omap_device for %s:%s.\n", __func__,
                                        name, oh->name);
-               return PTR_ERR(od);
+               return PTR_ERR(pdev);
        }
+       pdata->set_clk_src = omap2_mcbsp_set_clk_src;
+       if (id == 1)
+               pdata->mux_signal = omap2_mcbsp1_mux_rx_clk;
        omap_mcbsp_count++;
        return 0;
 }
index 84cc0bdda3aecd0d5065f7d3a0b471f3eb524383..d713807050807778e33881872413ef354ba33ec7 100644 (file)
@@ -1954,9 +1954,6 @@ int __init omap_hwmod_register(struct omap_hwmod **ohs)
 
        i = 0;
        do {
-               if (!omap_chip_is(ohs[i]->omap_chip))
-                       continue;
-
                r = _register(ohs[i]);
                WARN(r, "omap_hwmod: %s: _register returned %d\n", ohs[i]->name,
                     r);
index a015c69068f68fc9d86a242fc019cd87e7beb7f3..6d7206213525d03ac830d8ca6092ce4317863f37 100644 (file)
@@ -100,7 +100,6 @@ static struct omap_hwmod omap2420_l3_main_hwmod = {
        .masters_cnt    = ARRAY_SIZE(omap2420_l3_main_masters),
        .slaves         = omap2420_l3_main_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_l3_main_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -206,7 +205,6 @@ static struct omap_hwmod omap2420_l4_core_hwmod = {
        .masters_cnt    = ARRAY_SIZE(omap2420_l4_core_masters),
        .slaves         = omap2420_l4_core_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_l4_core_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -227,7 +225,6 @@ static struct omap_hwmod omap2420_l4_wkup_hwmod = {
        .masters_cnt    = ARRAY_SIZE(omap2420_l4_wkup_masters),
        .slaves         = omap2420_l4_wkup_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_l4_wkup_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -243,7 +240,6 @@ static struct omap_hwmod omap2420_mpu_hwmod = {
        .main_clk       = "mpu_ck",
        .masters        = omap2420_mpu_masters,
        .masters_cnt    = ARRAY_SIZE(omap2420_mpu_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
 /*
@@ -271,7 +267,16 @@ static struct omap_hwmod omap2420_iva_hwmod = {
        .class          = &iva_hwmod_class,
        .masters        = omap2420_iva_masters,
        .masters_cnt    = ARRAY_SIZE(omap2420_iva_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
+};
+
+/* always-on timers dev attribute */
+static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = {
+       .timer_capability       = OMAP_TIMER_ALWON,
+};
+
+/* pwm timers dev attribute */
+static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
+       .timer_capability       = OMAP_TIMER_HAS_PWM,
 };
 
 /* timer1 */
@@ -314,10 +319,10 @@ static struct omap_hwmod omap2420_timer1_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT1_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap2420_timer1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_timer1_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
 };
 
 /* timer2 */
@@ -351,10 +356,10 @@ static struct omap_hwmod omap2420_timer2_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap2420_timer2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_timer2_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
 };
 
 /* timer3 */
@@ -388,10 +393,10 @@ static struct omap_hwmod omap2420_timer3_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap2420_timer3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_timer3_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
 };
 
 /* timer4 */
@@ -425,10 +430,10 @@ static struct omap_hwmod omap2420_timer4_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap2420_timer4_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_timer4_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
 };
 
 /* timer5 */
@@ -462,10 +467,10 @@ static struct omap_hwmod omap2420_timer5_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap2420_timer5_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_timer5_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
 };
 
 
@@ -500,10 +505,10 @@ static struct omap_hwmod omap2420_timer6_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap2420_timer6_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_timer6_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
 };
 
 /* timer7 */
@@ -537,10 +542,10 @@ static struct omap_hwmod omap2420_timer7_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap2420_timer7_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_timer7_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
 };
 
 /* timer8 */
@@ -574,10 +579,10 @@ static struct omap_hwmod omap2420_timer8_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap2420_timer8_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_timer8_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
 };
 
 /* timer9 */
@@ -611,10 +616,10 @@ static struct omap_hwmod omap2420_timer9_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT9_SHIFT,
                },
        },
+       .dev_attr       = &capability_pwm_dev_attr,
        .slaves         = omap2420_timer9_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_timer9_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
 };
 
 /* timer10 */
@@ -648,10 +653,10 @@ static struct omap_hwmod omap2420_timer10_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT10_SHIFT,
                },
        },
+       .dev_attr       = &capability_pwm_dev_attr,
        .slaves         = omap2420_timer10_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_timer10_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
 };
 
 /* timer11 */
@@ -685,10 +690,10 @@ static struct omap_hwmod omap2420_timer11_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT11_SHIFT,
                },
        },
+       .dev_attr       = &capability_pwm_dev_attr,
        .slaves         = omap2420_timer11_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_timer11_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
 };
 
 /* timer12 */
@@ -722,10 +727,10 @@ static struct omap_hwmod omap2420_timer12_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT12_SHIFT,
                },
        },
+       .dev_attr       = &capability_pwm_dev_attr,
        .slaves         = omap2420_timer12_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_timer12_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
 };
 
 /* l4_wkup -> wd_timer2 */
@@ -766,7 +771,6 @@ static struct omap_hwmod omap2420_wd_timer2_hwmod = {
        },
        .slaves         = omap2420_wd_timer2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_wd_timer2_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
 /* UART1 */
@@ -792,7 +796,6 @@ static struct omap_hwmod omap2420_uart1_hwmod = {
        .slaves         = omap2420_uart1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_uart1_slaves),
        .class          = &omap2_uart_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
 /* UART2 */
@@ -818,7 +821,6 @@ static struct omap_hwmod omap2420_uart2_hwmod = {
        .slaves         = omap2420_uart2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_uart2_slaves),
        .class          = &omap2_uart_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
 /* UART3 */
@@ -844,7 +846,6 @@ static struct omap_hwmod omap2420_uart3_hwmod = {
        .slaves         = omap2420_uart3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_uart3_slaves),
        .class          = &omap2_uart_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
 /* dss */
@@ -898,7 +899,6 @@ static struct omap_hwmod omap2420_dss_core_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2420_dss_slaves),
        .masters        = omap2420_dss_masters,
        .masters_cnt    = ARRAY_SIZE(omap2420_dss_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -938,7 +938,6 @@ static struct omap_hwmod omap2420_dss_dispc_hwmod = {
        },
        .slaves         = omap2420_dss_dispc_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_dss_dispc_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -975,7 +974,6 @@ static struct omap_hwmod omap2420_dss_rfbi_hwmod = {
        },
        .slaves         = omap2420_dss_rfbi_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_dss_rfbi_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -1013,7 +1011,6 @@ static struct omap_hwmod omap2420_dss_venc_hwmod = {
        },
        .slaves         = omap2420_dss_venc_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_dss_venc_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -1064,7 +1061,6 @@ static struct omap_hwmod omap2420_i2c1_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2420_i2c1_slaves),
        .class          = &i2c_class,
        .dev_attr       = &i2c_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
        .flags          = HWMOD_16BIT_REG,
 };
 
@@ -1092,7 +1088,6 @@ static struct omap_hwmod omap2420_i2c2_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2420_i2c2_slaves),
        .class          = &i2c_class,
        .dev_attr       = &i2c_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
        .flags          = HWMOD_16BIT_REG,
 };
 
@@ -1197,7 +1192,6 @@ static struct omap_hwmod omap2420_gpio1_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2420_gpio1_slaves),
        .class          = &omap2xxx_gpio_hwmod_class,
        .dev_attr       = &gpio_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
 /* gpio2 */
@@ -1223,7 +1217,6 @@ static struct omap_hwmod omap2420_gpio2_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2420_gpio2_slaves),
        .class          = &omap2xxx_gpio_hwmod_class,
        .dev_attr       = &gpio_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
 /* gpio3 */
@@ -1249,7 +1242,6 @@ static struct omap_hwmod omap2420_gpio3_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2420_gpio3_slaves),
        .class          = &omap2xxx_gpio_hwmod_class,
        .dev_attr       = &gpio_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
 /* gpio4 */
@@ -1275,7 +1267,6 @@ static struct omap_hwmod omap2420_gpio4_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2420_gpio4_slaves),
        .class          = &omap2xxx_gpio_hwmod_class,
        .dev_attr       = &gpio_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
 /* dma attributes */
@@ -1322,7 +1313,6 @@ static struct omap_hwmod omap2420_dma_system_hwmod = {
        .masters        = omap2420_dma_system_masters,
        .masters_cnt    = ARRAY_SIZE(omap2420_dma_system_masters),
        .dev_attr       = &dma_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -1363,7 +1353,6 @@ static struct omap_hwmod omap2420_mailbox_hwmod = {
        },
        .slaves         = omap2420_mailbox_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_mailbox_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
 /* mcspi1 */
@@ -1393,7 +1382,6 @@ static struct omap_hwmod omap2420_mcspi1_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2420_mcspi1_slaves),
        .class          = &omap2xxx_mcspi_class,
        .dev_attr       = &omap_mcspi1_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
 /* mcspi2 */
@@ -1423,7 +1411,6 @@ static struct omap_hwmod omap2420_mcspi2_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2420_mcspi2_slaves),
        .class          = &omap2xxx_mcspi_class,
        .dev_attr       = &omap_mcspi2_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
 /*
@@ -1473,7 +1460,6 @@ static struct omap_hwmod omap2420_mcbsp1_hwmod = {
        },
        .slaves         = omap2420_mcbsp1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_mcbsp1_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
 /* mcbsp2 */
@@ -1514,7 +1500,6 @@ static struct omap_hwmod omap2420_mcbsp2_hwmod = {
        },
        .slaves         = omap2420_mcbsp2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2420_mcbsp2_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
 static __initdata struct omap_hwmod *omap2420_hwmods[] = {
index 408193d8e044b6288a2c8e696f5f50f94ca46fe3..a2580d01c3ff98b25a57b6508bd959d0e58c700f 100644 (file)
@@ -110,7 +110,6 @@ static struct omap_hwmod omap2430_l3_main_hwmod = {
        .masters_cnt    = ARRAY_SIZE(omap2430_l3_main_masters),
        .slaves         = omap2430_l3_main_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_l3_main_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -250,7 +249,6 @@ static struct omap_hwmod omap2430_l4_core_hwmod = {
        .masters_cnt    = ARRAY_SIZE(omap2430_l4_core_masters),
        .slaves         = omap2430_l4_core_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_l4_core_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -301,7 +299,6 @@ static struct omap_hwmod omap2430_l4_wkup_hwmod = {
        .masters_cnt    = ARRAY_SIZE(omap2430_l4_wkup_masters),
        .slaves         = omap2430_l4_wkup_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_l4_wkup_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -317,7 +314,6 @@ static struct omap_hwmod omap2430_mpu_hwmod = {
        .main_clk       = "mpu_ck",
        .masters        = omap2430_mpu_masters,
        .masters_cnt    = ARRAY_SIZE(omap2430_mpu_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /*
@@ -345,7 +341,16 @@ static struct omap_hwmod omap2430_iva_hwmod = {
        .class          = &iva_hwmod_class,
        .masters        = omap2430_iva_masters,
        .masters_cnt    = ARRAY_SIZE(omap2430_iva_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
+};
+
+/* always-on timers dev attribute */
+static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = {
+       .timer_capability       = OMAP_TIMER_ALWON,
+};
+
+/* pwm timers dev attribute */
+static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
+       .timer_capability       = OMAP_TIMER_HAS_PWM,
 };
 
 /* timer1 */
@@ -388,10 +393,10 @@ static struct omap_hwmod omap2430_timer1_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT1_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap2430_timer1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_timer1_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
 };
 
 /* timer2 */
@@ -425,10 +430,10 @@ static struct omap_hwmod omap2430_timer2_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap2430_timer2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_timer2_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
 };
 
 /* timer3 */
@@ -462,10 +467,10 @@ static struct omap_hwmod omap2430_timer3_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap2430_timer3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_timer3_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
 };
 
 /* timer4 */
@@ -499,10 +504,10 @@ static struct omap_hwmod omap2430_timer4_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap2430_timer4_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_timer4_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
 };
 
 /* timer5 */
@@ -536,10 +541,10 @@ static struct omap_hwmod omap2430_timer5_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap2430_timer5_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_timer5_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
 };
 
 /* timer6 */
@@ -573,10 +578,10 @@ static struct omap_hwmod omap2430_timer6_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap2430_timer6_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_timer6_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
 };
 
 /* timer7 */
@@ -610,10 +615,10 @@ static struct omap_hwmod omap2430_timer7_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap2430_timer7_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_timer7_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
 };
 
 /* timer8 */
@@ -647,10 +652,10 @@ static struct omap_hwmod omap2430_timer8_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap2430_timer8_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_timer8_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
 };
 
 /* timer9 */
@@ -684,10 +689,10 @@ static struct omap_hwmod omap2430_timer9_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT9_SHIFT,
                },
        },
+       .dev_attr       = &capability_pwm_dev_attr,
        .slaves         = omap2430_timer9_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_timer9_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
 };
 
 /* timer10 */
@@ -721,10 +726,10 @@ static struct omap_hwmod omap2430_timer10_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT10_SHIFT,
                },
        },
+       .dev_attr       = &capability_pwm_dev_attr,
        .slaves         = omap2430_timer10_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_timer10_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
 };
 
 /* timer11 */
@@ -758,10 +763,10 @@ static struct omap_hwmod omap2430_timer11_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT11_SHIFT,
                },
        },
+       .dev_attr       = &capability_pwm_dev_attr,
        .slaves         = omap2430_timer11_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_timer11_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
 };
 
 /* timer12 */
@@ -795,10 +800,10 @@ static struct omap_hwmod omap2430_timer12_hwmod = {
                        .idlest_idle_bit = OMAP24XX_ST_GPT12_SHIFT,
                },
        },
+       .dev_attr       = &capability_pwm_dev_attr,
        .slaves         = omap2430_timer12_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_timer12_slaves),
        .class          = &omap2xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
 };
 
 /* l4_wkup -> wd_timer2 */
@@ -839,7 +844,6 @@ static struct omap_hwmod omap2430_wd_timer2_hwmod = {
        },
        .slaves         = omap2430_wd_timer2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_wd_timer2_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* UART1 */
@@ -865,7 +869,6 @@ static struct omap_hwmod omap2430_uart1_hwmod = {
        .slaves         = omap2430_uart1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_uart1_slaves),
        .class          = &omap2_uart_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* UART2 */
@@ -891,7 +894,6 @@ static struct omap_hwmod omap2430_uart2_hwmod = {
        .slaves         = omap2430_uart2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_uart2_slaves),
        .class          = &omap2_uart_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* UART3 */
@@ -917,7 +919,6 @@ static struct omap_hwmod omap2430_uart3_hwmod = {
        .slaves         = omap2430_uart3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_uart3_slaves),
        .class          = &omap2_uart_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* dss */
@@ -965,7 +966,6 @@ static struct omap_hwmod omap2430_dss_core_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2430_dss_slaves),
        .masters        = omap2430_dss_masters,
        .masters_cnt    = ARRAY_SIZE(omap2430_dss_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -999,7 +999,6 @@ static struct omap_hwmod omap2430_dss_dispc_hwmod = {
        },
        .slaves         = omap2430_dss_dispc_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_dss_dispc_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -1030,7 +1029,6 @@ static struct omap_hwmod omap2430_dss_rfbi_hwmod = {
        },
        .slaves         = omap2430_dss_rfbi_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_dss_rfbi_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -1062,7 +1060,6 @@ static struct omap_hwmod omap2430_dss_venc_hwmod = {
        },
        .slaves         = omap2430_dss_venc_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_dss_venc_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -1123,7 +1120,6 @@ static struct omap_hwmod omap2430_i2c1_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2430_i2c1_slaves),
        .class          = &i2c_class,
        .dev_attr       = &i2c_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* I2C2 */
@@ -1151,7 +1147,6 @@ static struct omap_hwmod omap2430_i2c2_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2430_i2c2_slaves),
        .class          = &i2c_class,
        .dev_attr       = &i2c_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* l4_wkup -> gpio1 */
@@ -1273,7 +1268,6 @@ static struct omap_hwmod omap2430_gpio1_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2430_gpio1_slaves),
        .class          = &omap2xxx_gpio_hwmod_class,
        .dev_attr       = &gpio_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* gpio2 */
@@ -1299,7 +1293,6 @@ static struct omap_hwmod omap2430_gpio2_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2430_gpio2_slaves),
        .class          = &omap2xxx_gpio_hwmod_class,
        .dev_attr       = &gpio_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* gpio3 */
@@ -1325,7 +1318,6 @@ static struct omap_hwmod omap2430_gpio3_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2430_gpio3_slaves),
        .class          = &omap2xxx_gpio_hwmod_class,
        .dev_attr       = &gpio_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* gpio4 */
@@ -1351,7 +1343,6 @@ static struct omap_hwmod omap2430_gpio4_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2430_gpio4_slaves),
        .class          = &omap2xxx_gpio_hwmod_class,
        .dev_attr       = &gpio_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* gpio5 */
@@ -1382,7 +1373,6 @@ static struct omap_hwmod omap2430_gpio5_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2430_gpio5_slaves),
        .class          = &omap2xxx_gpio_hwmod_class,
        .dev_attr       = &gpio_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* dma attributes */
@@ -1429,7 +1419,6 @@ static struct omap_hwmod omap2430_dma_system_hwmod = {
        .masters        = omap2430_dma_system_masters,
        .masters_cnt    = ARRAY_SIZE(omap2430_dma_system_masters),
        .dev_attr       = &dma_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -1469,7 +1458,6 @@ static struct omap_hwmod omap2430_mailbox_hwmod = {
        },
        .slaves         = omap2430_mailbox_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_mailbox_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* mcspi1 */
@@ -1499,7 +1487,6 @@ static struct omap_hwmod omap2430_mcspi1_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2430_mcspi1_slaves),
        .class          = &omap2xxx_mcspi_class,
        .dev_attr       = &omap_mcspi1_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* mcspi2 */
@@ -1529,7 +1516,6 @@ static struct omap_hwmod omap2430_mcspi2_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2430_mcspi2_slaves),
        .class          = &omap2xxx_mcspi_class,
        .dev_attr       = &omap_mcspi2_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* mcspi3 */
@@ -1572,7 +1558,6 @@ static struct omap_hwmod omap2430_mcspi3_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap2430_mcspi3_slaves),
        .class          = &omap2xxx_mcspi_class,
        .dev_attr       = &omap_mcspi3_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /*
@@ -1628,7 +1613,6 @@ static struct omap_hwmod omap2430_usbhsotg_hwmod = {
         */
        .flags          = HWMOD_NO_OCP_AUTOIDLE | HWMOD_SWSUP_SIDLE
                                | HWMOD_SWSUP_MSTANDBY,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
 };
 
 /*
@@ -1689,7 +1673,6 @@ static struct omap_hwmod omap2430_mcbsp1_hwmod = {
        },
        .slaves         = omap2430_mcbsp1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_mcbsp1_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* mcbsp2 */
@@ -1731,7 +1714,6 @@ static struct omap_hwmod omap2430_mcbsp2_hwmod = {
        },
        .slaves         = omap2430_mcbsp2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_mcbsp2_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* mcbsp3 */
@@ -1783,7 +1765,6 @@ static struct omap_hwmod omap2430_mcbsp3_hwmod = {
        },
        .slaves         = omap2430_mcbsp3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_mcbsp3_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* mcbsp4 */
@@ -1841,7 +1822,6 @@ static struct omap_hwmod omap2430_mcbsp4_hwmod = {
        },
        .slaves         = omap2430_mcbsp4_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_mcbsp4_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* mcbsp5 */
@@ -1899,7 +1879,6 @@ static struct omap_hwmod omap2430_mcbsp5_hwmod = {
        },
        .slaves         = omap2430_mcbsp5_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_mcbsp5_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* MMC/SD/SDIO common */
@@ -1966,7 +1945,6 @@ static struct omap_hwmod omap2430_mmc1_hwmod = {
        .slaves         = omap2430_mmc1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_mmc1_slaves),
        .class          = &omap2430_mmc_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* MMC/SD/SDIO2 */
@@ -2010,7 +1988,6 @@ static struct omap_hwmod omap2430_mmc2_hwmod = {
        .slaves         = omap2430_mmc2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap2430_mmc2_slaves),
        .class          = &omap2430_mmc_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 static __initdata struct omap_hwmod *omap2430_hwmods[] = {
index 25bf43b5a4ec02922049abd9fd16806297fc1b37..3008e1672c7a051e54e84ed2e147ea2674e019e4 100644 (file)
@@ -156,7 +156,6 @@ static struct omap_hwmod omap3xxx_l3_main_hwmod = {
        .masters_cnt    = ARRAY_SIZE(omap3xxx_l3_main_masters),
        .slaves         = omap3xxx_l3_main_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_l3_main_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -459,7 +458,6 @@ static struct omap_hwmod omap3xxx_l4_core_hwmod = {
        .class          = &l4_hwmod_class,
        .slaves         = omap3xxx_l4_core_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_l4_core_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -474,7 +472,6 @@ static struct omap_hwmod omap3xxx_l4_per_hwmod = {
        .class          = &l4_hwmod_class,
        .slaves         = omap3xxx_l4_per_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_l4_per_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -489,7 +486,6 @@ static struct omap_hwmod omap3xxx_l4_wkup_hwmod = {
        .class          = &l4_hwmod_class,
        .slaves         = omap3xxx_l4_wkup_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_l4_wkup_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -505,7 +501,6 @@ static struct omap_hwmod omap3xxx_mpu_hwmod = {
        .main_clk       = "arm_fck",
        .masters        = omap3xxx_mpu_masters,
        .masters_cnt    = ARRAY_SIZE(omap3xxx_mpu_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /*
@@ -533,7 +528,6 @@ static struct omap_hwmod omap3xxx_iva_hwmod = {
        .class          = &iva_hwmod_class,
        .masters        = omap3xxx_iva_masters,
        .masters_cnt    = ARRAY_SIZE(omap3xxx_iva_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
 };
 
 /* timer class */
@@ -570,6 +564,21 @@ static struct omap_hwmod_class omap3xxx_timer_hwmod_class = {
        .rev =  OMAP_TIMER_IP_VERSION_1,
 };
 
+/* secure timers dev attribute */
+static struct omap_timer_capability_dev_attr capability_secure_dev_attr = {
+       .timer_capability       = OMAP_TIMER_SECURE,
+};
+
+/* always-on timers dev attribute */
+static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = {
+       .timer_capability       = OMAP_TIMER_ALWON,
+};
+
+/* pwm timers dev attribute */
+static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
+       .timer_capability       = OMAP_TIMER_HAS_PWM,
+};
+
 /* timer1 */
 static struct omap_hwmod omap3xxx_timer1_hwmod;
 
@@ -610,10 +619,10 @@ static struct omap_hwmod omap3xxx_timer1_hwmod = {
                        .idlest_idle_bit = OMAP3430_ST_GPT1_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap3xxx_timer1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_timer1_slaves),
        .class          = &omap3xxx_timer_1ms_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
 };
 
 /* timer2 */
@@ -656,10 +665,10 @@ static struct omap_hwmod omap3xxx_timer2_hwmod = {
                        .idlest_idle_bit = OMAP3430_ST_GPT2_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap3xxx_timer2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_timer2_slaves),
        .class          = &omap3xxx_timer_1ms_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
 };
 
 /* timer3 */
@@ -702,10 +711,10 @@ static struct omap_hwmod omap3xxx_timer3_hwmod = {
                        .idlest_idle_bit = OMAP3430_ST_GPT3_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap3xxx_timer3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_timer3_slaves),
        .class          = &omap3xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
 };
 
 /* timer4 */
@@ -748,10 +757,10 @@ static struct omap_hwmod omap3xxx_timer4_hwmod = {
                        .idlest_idle_bit = OMAP3430_ST_GPT4_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap3xxx_timer4_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_timer4_slaves),
        .class          = &omap3xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
 };
 
 /* timer5 */
@@ -794,10 +803,10 @@ static struct omap_hwmod omap3xxx_timer5_hwmod = {
                        .idlest_idle_bit = OMAP3430_ST_GPT5_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap3xxx_timer5_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_timer5_slaves),
        .class          = &omap3xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
 };
 
 /* timer6 */
@@ -840,10 +849,10 @@ static struct omap_hwmod omap3xxx_timer6_hwmod = {
                        .idlest_idle_bit = OMAP3430_ST_GPT6_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap3xxx_timer6_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_timer6_slaves),
        .class          = &omap3xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
 };
 
 /* timer7 */
@@ -886,10 +895,10 @@ static struct omap_hwmod omap3xxx_timer7_hwmod = {
                        .idlest_idle_bit = OMAP3430_ST_GPT7_SHIFT,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap3xxx_timer7_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_timer7_slaves),
        .class          = &omap3xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
 };
 
 /* timer8 */
@@ -932,10 +941,10 @@ static struct omap_hwmod omap3xxx_timer8_hwmod = {
                        .idlest_idle_bit = OMAP3430_ST_GPT8_SHIFT,
                },
        },
+       .dev_attr       = &capability_pwm_dev_attr,
        .slaves         = omap3xxx_timer8_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_timer8_slaves),
        .class          = &omap3xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
 };
 
 /* timer9 */
@@ -978,10 +987,10 @@ static struct omap_hwmod omap3xxx_timer9_hwmod = {
                        .idlest_idle_bit = OMAP3430_ST_GPT9_SHIFT,
                },
        },
+       .dev_attr       = &capability_pwm_dev_attr,
        .slaves         = omap3xxx_timer9_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_timer9_slaves),
        .class          = &omap3xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
 };
 
 /* timer10 */
@@ -1015,10 +1024,10 @@ static struct omap_hwmod omap3xxx_timer10_hwmod = {
                        .idlest_idle_bit = OMAP3430_ST_GPT10_SHIFT,
                },
        },
+       .dev_attr       = &capability_pwm_dev_attr,
        .slaves         = omap3xxx_timer10_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_timer10_slaves),
        .class          = &omap3xxx_timer_1ms_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
 };
 
 /* timer11 */
@@ -1052,10 +1061,10 @@ static struct omap_hwmod omap3xxx_timer11_hwmod = {
                        .idlest_idle_bit = OMAP3430_ST_GPT11_SHIFT,
                },
        },
+       .dev_attr       = &capability_pwm_dev_attr,
        .slaves         = omap3xxx_timer11_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_timer11_slaves),
        .class          = &omap3xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
 };
 
 /* timer12*/
@@ -1102,10 +1111,10 @@ static struct omap_hwmod omap3xxx_timer12_hwmod = {
                        .idlest_idle_bit = OMAP3430_ST_GPT12_SHIFT,
                },
        },
+       .dev_attr       = &capability_secure_dev_attr,
        .slaves         = omap3xxx_timer12_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_timer12_slaves),
        .class          = &omap3xxx_timer_hwmod_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
 };
 
 /* l4_wkup -> wd_timer2 */
@@ -1182,7 +1191,6 @@ static struct omap_hwmod omap3xxx_wd_timer2_hwmod = {
        },
        .slaves         = omap3xxx_wd_timer2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_wd_timer2_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
        /*
         * XXX: Use software supervised mode, HW supervised smartidle seems to
         * block CORE power domain idle transitions. Maybe a HW bug in wdt2?
@@ -1213,7 +1221,6 @@ static struct omap_hwmod omap3xxx_uart1_hwmod = {
        .slaves         = omap3xxx_uart1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_uart1_slaves),
        .class          = &omap2_uart_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* UART2 */
@@ -1239,7 +1246,6 @@ static struct omap_hwmod omap3xxx_uart2_hwmod = {
        .slaves         = omap3xxx_uart2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_uart2_slaves),
        .class          = &omap2_uart_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* UART3 */
@@ -1265,7 +1271,6 @@ static struct omap_hwmod omap3xxx_uart3_hwmod = {
        .slaves         = omap3xxx_uart3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_uart3_slaves),
        .class          = &omap2_uart_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* UART4 */
@@ -1302,7 +1307,6 @@ static struct omap_hwmod omap3xxx_uart4_hwmod = {
        .slaves         = omap3xxx_uart4_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_uart4_slaves),
        .class          = &omap2_uart_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3630ES1),
 };
 
 static struct omap_hwmod_class i2c_class = {
@@ -1390,7 +1394,6 @@ static struct omap_hwmod omap3430es1_dss_core_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap3430es1_dss_slaves),
        .masters        = omap3xxx_dss_masters,
        .masters_cnt    = ARRAY_SIZE(omap3xxx_dss_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -1415,8 +1418,6 @@ static struct omap_hwmod omap3xxx_dss_core_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_dss_slaves),
        .masters        = omap3xxx_dss_masters,
        .masters_cnt    = ARRAY_SIZE(omap3xxx_dss_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2 |
-                               CHIP_IS_OMAP3630ES1 | CHIP_GE_OMAP3630ES1_1),
 };
 
 /* l4_core -> dss_dispc */
@@ -1454,9 +1455,6 @@ static struct omap_hwmod omap3xxx_dss_dispc_hwmod = {
        },
        .slaves         = omap3xxx_dss_dispc_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_dss_dispc_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1 |
-                               CHIP_GE_OMAP3430ES2 | CHIP_IS_OMAP3630ES1 |
-                               CHIP_GE_OMAP3630ES1_1),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -1518,9 +1516,6 @@ static struct omap_hwmod omap3xxx_dss_dsi1_hwmod = {
        },
        .slaves         = omap3xxx_dss_dsi1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_dss_dsi1_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1 |
-                               CHIP_GE_OMAP3430ES2 | CHIP_IS_OMAP3630ES1 |
-                               CHIP_GE_OMAP3630ES1_1),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -1558,9 +1553,6 @@ static struct omap_hwmod omap3xxx_dss_rfbi_hwmod = {
        },
        .slaves         = omap3xxx_dss_rfbi_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_dss_rfbi_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1 |
-                               CHIP_GE_OMAP3430ES2 | CHIP_IS_OMAP3630ES1 |
-                               CHIP_GE_OMAP3630ES1_1),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -1599,9 +1591,6 @@ static struct omap_hwmod omap3xxx_dss_venc_hwmod = {
        },
        .slaves         = omap3xxx_dss_venc_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_dss_venc_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1 |
-                               CHIP_GE_OMAP3430ES2 | CHIP_IS_OMAP3630ES1 |
-                               CHIP_GE_OMAP3630ES1_1),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -1637,7 +1626,6 @@ static struct omap_hwmod omap3xxx_i2c1_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_i2c1_slaves),
        .class          = &i2c_class,
        .dev_attr       = &i2c1_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* I2C2 */
@@ -1672,7 +1660,6 @@ static struct omap_hwmod omap3xxx_i2c2_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_i2c2_slaves),
        .class          = &i2c_class,
        .dev_attr       = &i2c2_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* I2C3 */
@@ -1718,7 +1705,6 @@ static struct omap_hwmod omap3xxx_i2c3_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_i2c3_slaves),
        .class          = &i2c_class,
        .dev_attr       = &i2c3_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* l4_wkup -> gpio1 */
@@ -1880,7 +1866,6 @@ static struct omap_hwmod omap3xxx_gpio1_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_gpio1_slaves),
        .class          = &omap3xxx_gpio_hwmod_class,
        .dev_attr       = &gpio_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* gpio2 */
@@ -1912,7 +1897,6 @@ static struct omap_hwmod omap3xxx_gpio2_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_gpio2_slaves),
        .class          = &omap3xxx_gpio_hwmod_class,
        .dev_attr       = &gpio_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* gpio3 */
@@ -1944,7 +1928,6 @@ static struct omap_hwmod omap3xxx_gpio3_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_gpio3_slaves),
        .class          = &omap3xxx_gpio_hwmod_class,
        .dev_attr       = &gpio_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* gpio4 */
@@ -1976,7 +1959,6 @@ static struct omap_hwmod omap3xxx_gpio4_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_gpio4_slaves),
        .class          = &omap3xxx_gpio_hwmod_class,
        .dev_attr       = &gpio_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* gpio5 */
@@ -2013,7 +1995,6 @@ static struct omap_hwmod omap3xxx_gpio5_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_gpio5_slaves),
        .class          = &omap3xxx_gpio_hwmod_class,
        .dev_attr       = &gpio_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* gpio6 */
@@ -2050,7 +2031,6 @@ static struct omap_hwmod omap3xxx_gpio6_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_gpio6_slaves),
        .class          = &omap3xxx_gpio_hwmod_class,
        .dev_attr       = &gpio_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* dma_system -> L3 */
@@ -2134,7 +2114,6 @@ static struct omap_hwmod omap3xxx_dma_system_hwmod = {
        .masters        = omap3xxx_dma_system_masters,
        .masters_cnt    = ARRAY_SIZE(omap3xxx_dma_system_masters),
        .dev_attr       = &dma_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
        .flags          = HWMOD_NO_IDLEST,
 };
 
@@ -2207,7 +2186,6 @@ static struct omap_hwmod omap3xxx_mcbsp1_hwmod = {
        },
        .slaves         = omap3xxx_mcbsp1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_mcbsp1_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* mcbsp2 */
@@ -2264,7 +2242,6 @@ static struct omap_hwmod omap3xxx_mcbsp2_hwmod = {
        .slaves         = omap3xxx_mcbsp2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_mcbsp2_slaves),
        .dev_attr       = &omap34xx_mcbsp2_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* mcbsp3 */
@@ -2321,7 +2298,6 @@ static struct omap_hwmod omap3xxx_mcbsp3_hwmod = {
        .slaves         = omap3xxx_mcbsp3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_mcbsp3_slaves),
        .dev_attr       = &omap34xx_mcbsp3_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* mcbsp4 */
@@ -2379,7 +2355,6 @@ static struct omap_hwmod omap3xxx_mcbsp4_hwmod = {
        },
        .slaves         = omap3xxx_mcbsp4_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_mcbsp4_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* mcbsp5 */
@@ -2437,7 +2412,6 @@ static struct omap_hwmod omap3xxx_mcbsp5_hwmod = {
        },
        .slaves         = omap3xxx_mcbsp5_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_mcbsp5_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 /* 'mcbsp sidetone' class */
 
@@ -2498,7 +2472,6 @@ static struct omap_hwmod omap3xxx_mcbsp2_sidetone_hwmod = {
        },
        .slaves         = omap3xxx_mcbsp2_sidetone_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_mcbsp2_sidetone_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* mcbsp3_sidetone */
@@ -2547,7 +2520,6 @@ static struct omap_hwmod omap3xxx_mcbsp3_sidetone_hwmod = {
        },
        .slaves         = omap3xxx_mcbsp3_sidetone_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_mcbsp3_sidetone_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 
@@ -2597,7 +2569,7 @@ static struct omap_hwmod omap34xx_sr1_hwmod = {
        .name           = "sr1_hwmod",
        .class          = &omap34xx_smartreflex_hwmod_class,
        .main_clk       = "sr1_fck",
-       .vdd_name       = "mpu",
+       .vdd_name       = "mpu_iva",
        .prcm           = {
                .omap2 = {
                        .prcm_reg_id = 1,
@@ -2609,9 +2581,6 @@ static struct omap_hwmod omap34xx_sr1_hwmod = {
        },
        .slaves         = omap3_sr1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3_sr1_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES2 |
-                                       CHIP_IS_OMAP3430ES3_0 |
-                                       CHIP_IS_OMAP3430ES3_1),
        .flags          = HWMOD_SET_DEFAULT_CLOCKACT,
 };
 
@@ -2619,7 +2588,7 @@ static struct omap_hwmod omap36xx_sr1_hwmod = {
        .name           = "sr1_hwmod",
        .class          = &omap36xx_smartreflex_hwmod_class,
        .main_clk       = "sr1_fck",
-       .vdd_name       = "mpu",
+       .vdd_name       = "mpu_iva",
        .prcm           = {
                .omap2 = {
                        .prcm_reg_id = 1,
@@ -2631,7 +2600,6 @@ static struct omap_hwmod omap36xx_sr1_hwmod = {
        },
        .slaves         = omap3_sr1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3_sr1_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3630ES1),
 };
 
 /* SR2 */
@@ -2655,9 +2623,6 @@ static struct omap_hwmod omap34xx_sr2_hwmod = {
        },
        .slaves         = omap3_sr2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3_sr2_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES2 |
-                                       CHIP_IS_OMAP3430ES3_0 |
-                                       CHIP_IS_OMAP3430ES3_1),
        .flags          = HWMOD_SET_DEFAULT_CLOCKACT,
 };
 
@@ -2677,7 +2642,6 @@ static struct omap_hwmod omap36xx_sr2_hwmod = {
        },
        .slaves         = omap3_sr2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3_sr2_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3630ES1),
 };
 
 /*
@@ -2745,7 +2709,6 @@ static struct omap_hwmod omap3xxx_mailbox_hwmod = {
        },
        .slaves         = omap3xxx_mailbox_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_mailbox_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* l4 core -> mcspi1 interface */
@@ -2843,7 +2806,6 @@ static struct omap_hwmod omap34xx_mcspi1 = {
        .slaves_cnt     = ARRAY_SIZE(omap34xx_mcspi1_slaves),
        .class          = &omap34xx_mcspi_class,
        .dev_attr       = &omap_mcspi1_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* mcspi2 */
@@ -2873,7 +2835,6 @@ static struct omap_hwmod omap34xx_mcspi2 = {
        .slaves_cnt     = ARRAY_SIZE(omap34xx_mcspi2_slaves),
        .class          = &omap34xx_mcspi_class,
        .dev_attr       = &omap_mcspi2_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* mcspi3 */
@@ -2916,7 +2877,6 @@ static struct omap_hwmod omap34xx_mcspi3 = {
        .slaves_cnt     = ARRAY_SIZE(omap34xx_mcspi3_slaves),
        .class          = &omap34xx_mcspi_class,
        .dev_attr       = &omap_mcspi3_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* SPI4 */
@@ -2957,7 +2917,6 @@ static struct omap_hwmod omap34xx_mcspi4 = {
        .slaves_cnt     = ARRAY_SIZE(omap34xx_mcspi4_slaves),
        .class          = &omap34xx_mcspi_class,
        .dev_attr       = &omap_mcspi4_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /*
@@ -3014,7 +2973,6 @@ static struct omap_hwmod omap3xxx_usbhsotg_hwmod = {
         */
        .flags          = HWMOD_NO_OCP_AUTOIDLE | HWMOD_SWSUP_SIDLE
                                | HWMOD_SWSUP_MSTANDBY,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
 };
 
 /* usb_otg_hs */
@@ -3042,7 +3000,6 @@ static struct omap_hwmod am35xx_usbhsotg_hwmod = {
        .slaves         = am35xx_usbhsotg_slaves,
        .slaves_cnt     = ARRAY_SIZE(am35xx_usbhsotg_slaves),
        .class          = &am35xx_usbotg_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES3_1)
 };
 
 /* MMC/SD/SDIO common */
@@ -3108,7 +3065,6 @@ static struct omap_hwmod omap3xxx_mmc1_hwmod = {
        .slaves         = omap3xxx_mmc1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_mmc1_slaves),
        .class          = &omap34xx_mmc_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* MMC/SD/SDIO2 */
@@ -3151,7 +3107,6 @@ static struct omap_hwmod omap3xxx_mmc2_hwmod = {
        .slaves         = omap3xxx_mmc2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_mmc2_slaves),
        .class          = &omap34xx_mmc_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* MMC/SD/SDIO3 */
@@ -3193,7 +3148,6 @@ static struct omap_hwmod omap3xxx_mmc3_hwmod = {
        .slaves         = omap3xxx_mmc3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap3xxx_mmc3_slaves),
        .class          = &omap34xx_mmc_class,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
@@ -3224,10 +3178,7 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
        &omap3xxx_uart1_hwmod,
        &omap3xxx_uart2_hwmod,
        &omap3xxx_uart3_hwmod,
-       &omap3xxx_uart4_hwmod,
        /* dss class */
-       &omap3430es1_dss_core_hwmod,
-       &omap3xxx_dss_core_hwmod,
        &omap3xxx_dss_dispc_hwmod,
        &omap3xxx_dss_dsi1_hwmod,
        &omap3xxx_dss_rfbi_hwmod,
@@ -3239,9 +3190,6 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
        &omap3xxx_i2c3_hwmod,
        &omap34xx_sr1_hwmod,
        &omap34xx_sr2_hwmod,
-       &omap36xx_sr1_hwmod,
-       &omap36xx_sr2_hwmod,
-
 
        /* gpio class */
        &omap3xxx_gpio1_hwmod,
@@ -3272,16 +3220,96 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
        &omap34xx_mcspi3,
        &omap34xx_mcspi4,
 
-       /* usbotg class */
+       NULL,
+};
+
+/* 3430ES1-only hwmods */
+static __initdata struct omap_hwmod *omap3430es1_hwmods[] = {
+       &omap3430es1_dss_core_hwmod,
+       NULL
+};
+
+/* 3430ES2+-only hwmods */
+static __initdata struct omap_hwmod *omap3430es2plus_hwmods[] = {
+       &omap3xxx_dss_core_hwmod,
        &omap3xxx_usbhsotg_hwmod,
+       NULL
+};
 
-       /* usbotg for am35x */
-       &am35xx_usbhsotg_hwmod,
+/* 34xx-only hwmods (all ES revisions) */
+static __initdata struct omap_hwmod *omap34xx_hwmods[] = {
+       &omap34xx_sr1_hwmod,
+       &omap34xx_sr2_hwmod,
+       NULL
+};
 
-       NULL,
+/* 36xx-only hwmods (all ES revisions) */
+static __initdata struct omap_hwmod *omap36xx_hwmods[] = {
+       &omap3xxx_uart4_hwmod,
+       &omap3xxx_dss_core_hwmod,
+       &omap36xx_sr1_hwmod,
+       &omap36xx_sr2_hwmod,
+       &omap3xxx_usbhsotg_hwmod,
+       NULL
+};
+
+static __initdata struct omap_hwmod *am35xx_hwmods[] = {
+       &omap3xxx_dss_core_hwmod, /* XXX ??? */
+       &am35xx_usbhsotg_hwmod,
+       NULL
 };
 
 int __init omap3xxx_hwmod_init(void)
 {
-       return omap_hwmod_register(omap3xxx_hwmods);
+       int r;
+       struct omap_hwmod **h = NULL;
+       unsigned int rev;
+
+       /* Register hwmods common to all OMAP3 */
+       r = omap_hwmod_register(omap3xxx_hwmods);
+       if (!r)
+               return r;
+
+       rev = omap_rev();
+
+       /*
+        * Register hwmods common to individual OMAP3 families, all
+        * silicon revisions (e.g., 34xx, or AM3505/3517, or 36xx)
+        * All possible revisions should be included in this conditional.
+        */
+       if (rev == OMAP3430_REV_ES1_0 || rev == OMAP3430_REV_ES2_0 ||
+           rev == OMAP3430_REV_ES2_1 || rev == OMAP3430_REV_ES3_0 ||
+           rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2) {
+               h = omap34xx_hwmods;
+       } else if (rev == OMAP3517_REV_ES1_0 || rev == OMAP3517_REV_ES1_1) {
+               h = am35xx_hwmods;
+       } else if (rev == OMAP3630_REV_ES1_0 || rev == OMAP3630_REV_ES1_1 ||
+                  rev == OMAP3630_REV_ES1_2) {
+               h = omap36xx_hwmods;
+       } else {
+               WARN(1, "OMAP3 hwmod family init: unknown chip type\n");
+               return -EINVAL;
+       };
+
+       r = omap_hwmod_register(h);
+       if (!r)
+               return r;
+
+       /*
+        * Register hwmods specific to certain ES levels of a
+        * particular family of silicon (e.g., 34xx ES1.0)
+        */
+       h = NULL;
+       if (rev == OMAP3430_REV_ES1_0) {
+               h = omap3430es1_hwmods;
+       } else if (rev == OMAP3430_REV_ES2_0 || rev == OMAP3430_REV_ES2_1 ||
+                  rev == OMAP3430_REV_ES3_0 || rev == OMAP3430_REV_ES3_1 ||
+                  rev == OMAP3430_REV_ES3_1_2) {
+               h = omap3430es2plus_hwmods;
+       };
+
+       if (h)
+               r = omap_hwmod_register(h);
+
+       return r;
 }
index 6201422c0606b5103c01e563f67060134658774d..393afac9caf6d2cb15605749e9e5786bdfb4c857 100644 (file)
@@ -29,6 +29,7 @@
 #include <plat/mcbsp.h>
 #include <plat/mmc.h>
 #include <plat/i2c.h>
+#include <plat/dmtimer.h>
 
 #include "omap_hwmod_common_data.h"
 
@@ -133,7 +134,6 @@ static struct omap_hwmod omap44xx_dmm_hwmod = {
        .slaves         = omap44xx_dmm_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_dmm_slaves),
        .mpu_irqs       = omap44xx_dmm_irqs,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -189,7 +189,6 @@ static struct omap_hwmod omap44xx_emif_fw_hwmod = {
        },
        .slaves         = omap44xx_emif_fw_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_emif_fw_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -236,7 +235,6 @@ static struct omap_hwmod omap44xx_l3_instr_hwmod = {
        },
        .slaves         = omap44xx_l3_instr_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_l3_instr_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* l3_main_1 */
@@ -336,7 +334,6 @@ static struct omap_hwmod omap44xx_l3_main_1_hwmod = {
        },
        .slaves         = omap44xx_l3_main_1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_l3_main_1_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* l3_main_2 */
@@ -438,7 +435,6 @@ static struct omap_hwmod omap44xx_l3_main_2_hwmod = {
        },
        .slaves         = omap44xx_l3_main_2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_l3_main_2_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* l3_main_3 */
@@ -496,7 +492,6 @@ static struct omap_hwmod omap44xx_l3_main_3_hwmod = {
        },
        .slaves         = omap44xx_l3_main_3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_l3_main_3_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -559,7 +554,6 @@ static struct omap_hwmod omap44xx_l4_abe_hwmod = {
        },
        .slaves         = omap44xx_l4_abe_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_l4_abe_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* l4_cfg */
@@ -588,7 +582,6 @@ static struct omap_hwmod omap44xx_l4_cfg_hwmod = {
        },
        .slaves         = omap44xx_l4_cfg_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_l4_cfg_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* l4_per */
@@ -617,7 +610,6 @@ static struct omap_hwmod omap44xx_l4_per_hwmod = {
        },
        .slaves         = omap44xx_l4_per_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_l4_per_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* l4_wkup */
@@ -646,7 +638,6 @@ static struct omap_hwmod omap44xx_l4_wkup_hwmod = {
        },
        .slaves         = omap44xx_l4_wkup_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_l4_wkup_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -677,7 +668,6 @@ static struct omap_hwmod omap44xx_mpu_private_hwmod = {
        .clkdm_name     = "mpuss_clkdm",
        .slaves         = omap44xx_mpu_private_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_mpu_private_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -828,7 +818,6 @@ static struct omap_hwmod omap44xx_aess_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap44xx_aess_slaves),
        .masters        = omap44xx_aess_masters,
        .masters_cnt    = ARRAY_SIZE(omap44xx_aess_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -856,7 +845,6 @@ static struct omap_hwmod omap44xx_bandgap_hwmod = {
        },
        .opt_clks       = bandgap_opt_clks,
        .opt_clks_cnt   = ARRAY_SIZE(bandgap_opt_clks),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -917,7 +905,6 @@ static struct omap_hwmod omap44xx_counter_32k_hwmod = {
        },
        .slaves         = omap44xx_counter_32k_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_counter_32k_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -1005,7 +992,6 @@ static struct omap_hwmod omap44xx_dma_system_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap44xx_dma_system_slaves),
        .masters        = omap44xx_dma_system_masters,
        .masters_cnt    = ARRAY_SIZE(omap44xx_dma_system_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -1098,7 +1084,6 @@ static struct omap_hwmod omap44xx_dmic_hwmod = {
        },
        .slaves         = omap44xx_dmic_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_dmic_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -1164,7 +1149,6 @@ static struct omap_hwmod omap44xx_dsp_c0_hwmod = {
                        .rstctrl_offs = OMAP4_RM_TESLA_RSTCTRL_OFFSET,
                },
        },
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct omap_hwmod omap44xx_dsp_hwmod = {
@@ -1187,7 +1171,6 @@ static struct omap_hwmod omap44xx_dsp_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap44xx_dsp_slaves),
        .masters        = omap44xx_dsp_masters,
        .masters_cnt    = ARRAY_SIZE(omap44xx_dsp_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -1278,7 +1261,6 @@ static struct omap_hwmod omap44xx_dss_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap44xx_dss_slaves),
        .masters        = omap44xx_dss_masters,
        .masters_cnt    = ARRAY_SIZE(omap44xx_dss_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -1381,7 +1363,6 @@ static struct omap_hwmod omap44xx_dss_dispc_hwmod = {
        .opt_clks_cnt   = ARRAY_SIZE(dss_dispc_opt_clks),
        .slaves         = omap44xx_dss_dispc_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_dss_dispc_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -1480,7 +1461,6 @@ static struct omap_hwmod omap44xx_dss_dsi1_hwmod = {
        .opt_clks_cnt   = ARRAY_SIZE(dss_dsi1_opt_clks),
        .slaves         = omap44xx_dss_dsi1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_dss_dsi1_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* dss_dsi2 */
@@ -1558,7 +1538,6 @@ static struct omap_hwmod omap44xx_dss_dsi2_hwmod = {
        .opt_clks_cnt   = ARRAY_SIZE(dss_dsi2_opt_clks),
        .slaves         = omap44xx_dss_dsi2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_dss_dsi2_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -1656,7 +1635,6 @@ static struct omap_hwmod omap44xx_dss_hdmi_hwmod = {
        .opt_clks_cnt   = ARRAY_SIZE(dss_hdmi_opt_clks),
        .slaves         = omap44xx_dss_hdmi_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_dss_hdmi_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -1748,7 +1726,6 @@ static struct omap_hwmod omap44xx_dss_rfbi_hwmod = {
        .opt_clks_cnt   = ARRAY_SIZE(dss_rfbi_opt_clks),
        .slaves         = omap44xx_dss_rfbi_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_dss_rfbi_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -1817,7 +1794,6 @@ static struct omap_hwmod omap44xx_dss_venc_hwmod = {
        },
        .slaves         = omap44xx_dss_venc_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_dss_venc_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -1901,7 +1877,6 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = {
        .dev_attr       = &gpio_dev_attr,
        .slaves         = omap44xx_gpio1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_gpio1_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* gpio2 */
@@ -1957,7 +1932,6 @@ static struct omap_hwmod omap44xx_gpio2_hwmod = {
        .dev_attr       = &gpio_dev_attr,
        .slaves         = omap44xx_gpio2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_gpio2_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* gpio3 */
@@ -2013,7 +1987,6 @@ static struct omap_hwmod omap44xx_gpio3_hwmod = {
        .dev_attr       = &gpio_dev_attr,
        .slaves         = omap44xx_gpio3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_gpio3_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* gpio4 */
@@ -2069,7 +2042,6 @@ static struct omap_hwmod omap44xx_gpio4_hwmod = {
        .dev_attr       = &gpio_dev_attr,
        .slaves         = omap44xx_gpio4_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_gpio4_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* gpio5 */
@@ -2125,7 +2097,6 @@ static struct omap_hwmod omap44xx_gpio5_hwmod = {
        .dev_attr       = &gpio_dev_attr,
        .slaves         = omap44xx_gpio5_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_gpio5_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* gpio6 */
@@ -2181,7 +2152,6 @@ static struct omap_hwmod omap44xx_gpio6_hwmod = {
        .dev_attr       = &gpio_dev_attr,
        .slaves         = omap44xx_gpio6_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_gpio6_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -2261,7 +2231,6 @@ static struct omap_hwmod omap44xx_hsi_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap44xx_hsi_slaves),
        .masters        = omap44xx_hsi_masters,
        .masters_cnt    = ARRAY_SIZE(omap44xx_hsi_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -2345,7 +2314,6 @@ static struct omap_hwmod omap44xx_i2c1_hwmod = {
        .slaves         = omap44xx_i2c1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_i2c1_slaves),
        .dev_attr       = &i2c_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* i2c2 */
@@ -2402,7 +2370,6 @@ static struct omap_hwmod omap44xx_i2c2_hwmod = {
        .slaves         = omap44xx_i2c2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_i2c2_slaves),
        .dev_attr       = &i2c_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* i2c3 */
@@ -2459,7 +2426,6 @@ static struct omap_hwmod omap44xx_i2c3_hwmod = {
        .slaves         = omap44xx_i2c3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_i2c3_slaves),
        .dev_attr       = &i2c_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* i2c4 */
@@ -2516,7 +2482,6 @@ static struct omap_hwmod omap44xx_i2c4_hwmod = {
        .slaves         = omap44xx_i2c4_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_i2c4_slaves),
        .dev_attr       = &i2c_dev_attr,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -2577,7 +2542,6 @@ static struct omap_hwmod omap44xx_ipu_c0_hwmod = {
                        .rstctrl_offs = OMAP4_RM_DUCATI_RSTCTRL_OFFSET,
                },
        },
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* Pseudo hwmod for reset control purpose only */
@@ -2593,7 +2557,6 @@ static struct omap_hwmod omap44xx_ipu_c1_hwmod = {
                        .rstctrl_offs = OMAP4_RM_DUCATI_RSTCTRL_OFFSET,
                },
        },
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct omap_hwmod omap44xx_ipu_hwmod = {
@@ -2616,7 +2579,6 @@ static struct omap_hwmod omap44xx_ipu_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap44xx_ipu_slaves),
        .masters        = omap44xx_ipu_masters,
        .masters_cnt    = ARRAY_SIZE(omap44xx_ipu_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -2706,7 +2668,6 @@ static struct omap_hwmod omap44xx_iss_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap44xx_iss_slaves),
        .masters        = omap44xx_iss_masters,
        .masters_cnt    = ARRAY_SIZE(omap44xx_iss_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -2781,7 +2742,6 @@ static struct omap_hwmod omap44xx_iva_seq0_hwmod = {
                        .rstctrl_offs = OMAP4_RM_IVAHD_RSTCTRL_OFFSET,
                },
        },
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* Pseudo hwmod for reset control purpose only */
@@ -2797,7 +2757,6 @@ static struct omap_hwmod omap44xx_iva_seq1_hwmod = {
                        .rstctrl_offs = OMAP4_RM_IVAHD_RSTCTRL_OFFSET,
                },
        },
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static struct omap_hwmod omap44xx_iva_hwmod = {
@@ -2820,7 +2779,6 @@ static struct omap_hwmod omap44xx_iva_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap44xx_iva_slaves),
        .masters        = omap44xx_iva_masters,
        .masters_cnt    = ARRAY_SIZE(omap44xx_iva_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -2890,7 +2848,6 @@ static struct omap_hwmod omap44xx_kbd_hwmod = {
        },
        .slaves         = omap44xx_kbd_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_kbd_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -2956,7 +2913,6 @@ static struct omap_hwmod omap44xx_mailbox_hwmod = {
        },
        .slaves         = omap44xx_mailbox_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_mailbox_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -3051,7 +3007,6 @@ static struct omap_hwmod omap44xx_mcbsp1_hwmod = {
        },
        .slaves         = omap44xx_mcbsp1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_mcbsp1_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* mcbsp2 */
@@ -3127,7 +3082,6 @@ static struct omap_hwmod omap44xx_mcbsp2_hwmod = {
        },
        .slaves         = omap44xx_mcbsp2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_mcbsp2_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* mcbsp3 */
@@ -3203,7 +3157,6 @@ static struct omap_hwmod omap44xx_mcbsp3_hwmod = {
        },
        .slaves         = omap44xx_mcbsp3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_mcbsp3_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* mcbsp4 */
@@ -3258,7 +3211,6 @@ static struct omap_hwmod omap44xx_mcbsp4_hwmod = {
        },
        .slaves         = omap44xx_mcbsp4_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_mcbsp4_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -3353,7 +3305,6 @@ static struct omap_hwmod omap44xx_mcpdm_hwmod = {
        },
        .slaves         = omap44xx_mcpdm_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_mcpdm_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -3442,7 +3393,6 @@ static struct omap_hwmod omap44xx_mcspi1_hwmod = {
        .dev_attr       = &mcspi1_dev_attr,
        .slaves         = omap44xx_mcspi1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_mcspi1_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* mcspi2 */
@@ -3505,7 +3455,6 @@ static struct omap_hwmod omap44xx_mcspi2_hwmod = {
        .dev_attr       = &mcspi2_dev_attr,
        .slaves         = omap44xx_mcspi2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_mcspi2_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* mcspi3 */
@@ -3568,7 +3517,6 @@ static struct omap_hwmod omap44xx_mcspi3_hwmod = {
        .dev_attr       = &mcspi3_dev_attr,
        .slaves         = omap44xx_mcspi3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_mcspi3_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* mcspi4 */
@@ -3629,7 +3577,6 @@ static struct omap_hwmod omap44xx_mcspi4_hwmod = {
        .dev_attr       = &mcspi4_dev_attr,
        .slaves         = omap44xx_mcspi4_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_mcspi4_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -3718,7 +3665,6 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap44xx_mmc1_slaves),
        .masters        = omap44xx_mmc1_masters,
        .masters_cnt    = ARRAY_SIZE(omap44xx_mmc1_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* mmc2 */
@@ -3779,7 +3725,6 @@ static struct omap_hwmod omap44xx_mmc2_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap44xx_mmc2_slaves),
        .masters        = omap44xx_mmc2_masters,
        .masters_cnt    = ARRAY_SIZE(omap44xx_mmc2_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* mmc3 */
@@ -3834,7 +3779,6 @@ static struct omap_hwmod omap44xx_mmc3_hwmod = {
        },
        .slaves         = omap44xx_mmc3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_mmc3_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* mmc4 */
@@ -3890,7 +3834,6 @@ static struct omap_hwmod omap44xx_mmc4_hwmod = {
        },
        .slaves         = omap44xx_mmc4_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_mmc4_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* mmc5 */
@@ -3945,7 +3888,6 @@ static struct omap_hwmod omap44xx_mmc5_hwmod = {
        },
        .slaves         = omap44xx_mmc5_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_mmc5_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -3987,7 +3929,6 @@ static struct omap_hwmod omap44xx_mpu_hwmod = {
        },
        .masters        = omap44xx_mpu_masters,
        .masters_cnt    = ARRAY_SIZE(omap44xx_mpu_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -4063,7 +4004,6 @@ static struct omap_hwmod omap44xx_smartreflex_core_hwmod = {
        },
        .slaves         = omap44xx_smartreflex_core_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_smartreflex_core_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* smartreflex_iva */
@@ -4112,7 +4052,6 @@ static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = {
        },
        .slaves         = omap44xx_smartreflex_iva_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_smartreflex_iva_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* smartreflex_mpu */
@@ -4161,7 +4100,6 @@ static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = {
        },
        .slaves         = omap44xx_smartreflex_mpu_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_smartreflex_mpu_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -4224,7 +4162,6 @@ static struct omap_hwmod omap44xx_spinlock_hwmod = {
        },
        .slaves         = omap44xx_spinlock_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_spinlock_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -4265,6 +4202,16 @@ static struct omap_hwmod_class omap44xx_timer_hwmod_class = {
        .sysc   = &omap44xx_timer_sysc,
 };
 
+/* always-on timers dev attribute */
+static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = {
+       .timer_capability       = OMAP_TIMER_ALWON,
+};
+
+/* pwm timers dev attribute */
+static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
+       .timer_capability       = OMAP_TIMER_HAS_PWM,
+};
+
 /* timer1 */
 static struct omap_hwmod omap44xx_timer1_hwmod;
 static struct omap_hwmod_irq_info omap44xx_timer1_irqs[] = {
@@ -4308,9 +4255,9 @@ static struct omap_hwmod omap44xx_timer1_hwmod = {
                        .modulemode   = MODULEMODE_SWCTRL,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap44xx_timer1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_timer1_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* timer2 */
@@ -4356,9 +4303,9 @@ static struct omap_hwmod omap44xx_timer2_hwmod = {
                        .modulemode   = MODULEMODE_SWCTRL,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap44xx_timer2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_timer2_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* timer3 */
@@ -4404,9 +4351,9 @@ static struct omap_hwmod omap44xx_timer3_hwmod = {
                        .modulemode   = MODULEMODE_SWCTRL,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap44xx_timer3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_timer3_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* timer4 */
@@ -4452,9 +4399,9 @@ static struct omap_hwmod omap44xx_timer4_hwmod = {
                        .modulemode   = MODULEMODE_SWCTRL,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap44xx_timer4_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_timer4_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* timer5 */
@@ -4519,9 +4466,9 @@ static struct omap_hwmod omap44xx_timer5_hwmod = {
                        .modulemode   = MODULEMODE_SWCTRL,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap44xx_timer5_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_timer5_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* timer6 */
@@ -4587,9 +4534,9 @@ static struct omap_hwmod omap44xx_timer6_hwmod = {
                        .modulemode   = MODULEMODE_SWCTRL,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap44xx_timer6_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_timer6_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* timer7 */
@@ -4654,9 +4601,9 @@ static struct omap_hwmod omap44xx_timer7_hwmod = {
                        .modulemode   = MODULEMODE_SWCTRL,
                },
        },
+       .dev_attr       = &capability_alwon_dev_attr,
        .slaves         = omap44xx_timer7_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_timer7_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* timer8 */
@@ -4721,9 +4668,9 @@ static struct omap_hwmod omap44xx_timer8_hwmod = {
                        .modulemode   = MODULEMODE_SWCTRL,
                },
        },
+       .dev_attr       = &capability_pwm_dev_attr,
        .slaves         = omap44xx_timer8_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_timer8_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* timer9 */
@@ -4769,9 +4716,9 @@ static struct omap_hwmod omap44xx_timer9_hwmod = {
                        .modulemode   = MODULEMODE_SWCTRL,
                },
        },
+       .dev_attr       = &capability_pwm_dev_attr,
        .slaves         = omap44xx_timer9_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_timer9_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* timer10 */
@@ -4817,9 +4764,9 @@ static struct omap_hwmod omap44xx_timer10_hwmod = {
                        .modulemode   = MODULEMODE_SWCTRL,
                },
        },
+       .dev_attr       = &capability_pwm_dev_attr,
        .slaves         = omap44xx_timer10_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_timer10_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* timer11 */
@@ -4865,9 +4812,9 @@ static struct omap_hwmod omap44xx_timer11_hwmod = {
                        .modulemode   = MODULEMODE_SWCTRL,
                },
        },
+       .dev_attr       = &capability_pwm_dev_attr,
        .slaves         = omap44xx_timer11_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_timer11_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -4944,7 +4891,6 @@ static struct omap_hwmod omap44xx_uart1_hwmod = {
        },
        .slaves         = omap44xx_uart1_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_uart1_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* uart2 */
@@ -4999,7 +4945,6 @@ static struct omap_hwmod omap44xx_uart2_hwmod = {
        },
        .slaves         = omap44xx_uart2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_uart2_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* uart3 */
@@ -5055,7 +5000,6 @@ static struct omap_hwmod omap44xx_uart3_hwmod = {
        },
        .slaves         = omap44xx_uart3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_uart3_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* uart4 */
@@ -5110,7 +5054,6 @@ static struct omap_hwmod omap44xx_uart4_hwmod = {
        },
        .slaves         = omap44xx_uart4_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_uart4_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -5195,7 +5138,6 @@ static struct omap_hwmod omap44xx_usb_otg_hs_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap44xx_usb_otg_hs_slaves),
        .masters        = omap44xx_usb_otg_hs_masters,
        .masters_cnt    = ARRAY_SIZE(omap44xx_usb_otg_hs_masters),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /*
@@ -5266,7 +5208,6 @@ static struct omap_hwmod omap44xx_wd_timer2_hwmod = {
        },
        .slaves         = omap44xx_wd_timer2_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_wd_timer2_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* wd_timer3 */
@@ -5333,7 +5274,6 @@ static struct omap_hwmod omap44xx_wd_timer3_hwmod = {
        },
        .slaves         = omap44xx_wd_timer3_slaves,
        .slaves_cnt     = ARRAY_SIZE(omap44xx_wd_timer3_slaves),
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
index 7b9f1909ddb2a3bc110d83b721a2466ec574f01a..c8b1bef92e5ad372cf02699bed78a302da236dc4 100644 (file)
@@ -1,25 +1,25 @@
 /*
 * OMAP4XXX L3 Interconnect error handling driver
 *
 * Copyright (C) 2011 Texas Corporation
 *    Santosh Shilimkar <santosh.shilimkar@ti.com>
 *    Sricharan <r.sricharan@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
 */
+ * OMAP4XXX L3 Interconnect error handling driver
+ *
+ * Copyright (C) 2011 Texas Corporation
    Santosh Shilimkar <santosh.shilimkar@ti.com>
    Sricharan <r.sricharan@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 <linux/init.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
 static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
 {
 
-       struct omap4_l3         *l3 = _l3;
-       int inttype, i, j;
+       struct omap4_l3 *l3 = _l3;
+       int inttype, i, k;
        int err_src = 0;
-       u32 std_err_main_addr, std_err_main, err_reg;
-       u32 base, slave_addr, clear;
-       char *source_name;
+       u32 std_err_main, err_reg, clear, masterid;
+       void __iomem *base, *l3_targ_base;
+       char *target_name, *master_name = "UN IDENTIFIED";
 
        /* Get the Type of interrupt */
        inttype = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR;
@@ -70,43 +70,50 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
                 * Read the regerr register of the clock domain
                 * to determine the source
                 */
-               base = (u32)l3->l3_base[i];
-               err_reg =  readl(base + l3_flagmux[i] + (inttype << 3));
+               base = l3->l3_base[i];
+               err_reg = __raw_readl(base + l3_flagmux[i] +
+                                       + L3_FLAGMUX_REGERR0 + (inttype << 3));
 
                /* Get the corresponding error and analyse */
                if (err_reg) {
                        /* Identify the source from control status register */
-                       for (j = 0; !(err_reg & (1 << j)); j++)
-                                                                       ;
+                       err_src = __ffs(err_reg);
 
-                       err_src = j;
                        /* Read the stderrlog_main_source from clk domain */
-                       std_err_main_addr = base + *(l3_targ[i] + err_src);
-                       std_err_main = readl(std_err_main_addr);
+                       l3_targ_base = base + *(l3_targ[i] + err_src);
+                       std_err_main =  __raw_readl(l3_targ_base +
+                                       L3_TARG_STDERRLOG_MAIN);
+                       masterid = __raw_readl(l3_targ_base +
+                                       L3_TARG_STDERRLOG_MSTADDR);
 
                        switch (std_err_main & CUSTOM_ERROR) {
                        case STANDARD_ERROR:
-                               source_name =
-                               l3_targ_stderrlog_main_name[i][err_src];
-
-                               slave_addr = std_err_main_addr +
-                                               L3_SLAVE_ADDRESS_OFFSET;
-                               WARN(true, "L3 standard error: SOURCE:%s at address 0x%x\n",
-                                       source_name, readl(slave_addr));
+                               target_name =
+                                       l3_targ_inst_name[i][err_src];
+                               WARN(true, "L3 standard error: TARGET:%s at address 0x%x\n",
+                                       target_name,
+                                       __raw_readl(l3_targ_base +
+                                               L3_TARG_STDERRLOG_SLVOFSLSB));
                                /* clear the std error log*/
                                clear = std_err_main | CLEAR_STDERR_LOG;
-                               writel(clear, std_err_main_addr);
+                               writel(clear, l3_targ_base +
+                                       L3_TARG_STDERRLOG_MAIN);
                                break;
 
                        case CUSTOM_ERROR:
-                               source_name =
-                               l3_targ_stderrlog_main_name[i][err_src];
-
-                               WARN(true, "CUSTOM SRESP error with SOURCE:%s\n",
-                                                       source_name);
+                               target_name =
+                                       l3_targ_inst_name[i][err_src];
+                               for (k = 0; k < NUM_OF_L3_MASTERS; k++) {
+                                       if (masterid == l3_masters[k].id)
+                                               master_name =
+                                                       l3_masters[k].name;
+                               }
+                               WARN(true, "L3 custom error: MASTER:%s TARGET:%s\n",
+                                       master_name, target_name);
                                /* clear the std error log*/
                                clear = std_err_main | CLEAR_STDERR_LOG;
-                               writel(clear, std_err_main_addr);
+                               writel(clear, l3_targ_base +
+                                       L3_TARG_STDERRLOG_MAIN);
                                break;
 
                        default:
@@ -120,12 +127,11 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
        return IRQ_HANDLED;
 }
 
-static int __init omap4_l3_probe(struct platform_device *pdev)
+static int __devinit omap4_l3_probe(struct platform_device *pdev)
 {
-       static struct omap4_l3          *l3;
-       struct resource         *res;
-       int                     ret;
-       int                     irq;
+       static struct omap4_l3 *l3;
+       struct resource *res;
+       int ret;
 
        l3 = kzalloc(sizeof(*l3), GFP_KERNEL);
        if (!l3)
@@ -177,27 +183,25 @@ static int __init omap4_l3_probe(struct platform_device *pdev)
        /*
         * Setup interrupt Handlers
         */
-       irq = platform_get_irq(pdev, 0);
-       ret = request_irq(irq,
+       l3->debug_irq = platform_get_irq(pdev, 0);
+       ret = request_irq(l3->debug_irq,
                        l3_interrupt_handler,
                        IRQF_DISABLED, "l3-dbg-irq", l3);
        if (ret) {
                pr_crit("L3: request_irq failed to register for 0x%x\n",
-                                        OMAP44XX_IRQ_L3_DBG);
+                                               OMAP44XX_IRQ_L3_DBG);
                goto err3;
        }
-       l3->debug_irq = irq;
 
-       irq = platform_get_irq(pdev, 1);
-       ret = request_irq(irq,
+       l3->app_irq = platform_get_irq(pdev, 1);
+       ret = request_irq(l3->app_irq,
                        l3_interrupt_handler,
                        IRQF_DISABLED, "l3-app-irq", l3);
        if (ret) {
                pr_crit("L3: request_irq failed to register for 0x%x\n",
-                                        OMAP44XX_IRQ_L3_APP);
+                                               OMAP44XX_IRQ_L3_APP);
                goto err4;
        }
-       l3->app_irq = irq;
 
        return 0;
 
@@ -214,9 +218,9 @@ err0:
        return ret;
 }
 
-static int __exit omap4_l3_remove(struct platform_device *pdev)
+static int __devexit omap4_l3_remove(struct platform_device *pdev)
 {
-       struct omap4_l3         *l3 = platform_get_drvdata(pdev);
+       struct omap4_l3 *l3 = platform_get_drvdata(pdev);
 
        free_irq(l3->app_irq, l3);
        free_irq(l3->debug_irq, l3);
@@ -228,16 +232,29 @@ static int __exit omap4_l3_remove(struct platform_device *pdev)
        return 0;
 }
 
+#if defined(CONFIG_OF)
+static const struct of_device_id l3_noc_match[] = {
+       {.compatible = "ti,omap4-l3-noc", },
+       {},
+}
+MODULE_DEVICE_TABLE(of, l3_noc_match);
+#else
+#define l3_noc_match NULL
+#endif
+
 static struct platform_driver omap4_l3_driver = {
-       .remove         = __exit_p(omap4_l3_remove),
+       .probe          = omap4_l3_probe,
+       .remove         = __devexit_p(omap4_l3_remove),
        .driver         = {
-       .name           = "omap_l3_noc",
+               .name           = "omap_l3_noc",
+               .owner          = THIS_MODULE,
+               .of_match_table = l3_noc_match,
        },
 };
 
 static int __init omap4_l3_init(void)
 {
-       return platform_driver_probe(&omap4_l3_driver, omap4_l3_probe);
+       return platform_driver_register(&omap4_l3_driver);
 }
 postcore_initcall_sync(omap4_l3_init);
 
index 359b83348aed0045ee480a48c874cb4cc07505a8..90b50984cd2e0b871e8926aeba1df34125afc4e3 100644 (file)
- /*
 * OMAP4XXX L3 Interconnect  error handling driver header
 *
 * Copyright (C) 2011 Texas Corporation
 *    Santosh Shilimkar <santosh.shilimkar@ti.com>
 *    sricharan <r.sricharan@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
 */
+/*
+ * OMAP4XXX L3 Interconnect  error handling driver header
+ *
+ * Copyright (C) 2011 Texas Corporation
    Santosh Shilimkar <santosh.shilimkar@ti.com>
    sricharan <r.sricharan@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 __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H
 #define __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H
 
-/*
- * L3 register offsets
- */
 #define L3_MODULES                     3
 #define CLEAR_STDERR_LOG               (1 << 31)
 #define CUSTOM_ERROR                   0x2
 #define STANDARD_ERROR                 0x0
 #define INBAND_ERROR                   0x0
-#define EMIF_KERRLOG_OFFSET            0x10
-#define L3_SLAVE_ADDRESS_OFFSET                0x14
-#define LOGICAL_ADDR_ERRORLOG          0x4
 #define L3_APPLICATION_ERROR           0x0
 #define L3_DEBUG_ERROR                 0x1
 
-u32 l3_flagmux[L3_MODULES] = {
-       0x50C,
-       0x100C,
-       0X020C
+/* L3 TARG register offsets */
+#define L3_TARG_STDERRLOG_MAIN         0x48
+#define L3_TARG_STDERRLOG_SLVOFSLSB    0x5c
+#define L3_TARG_STDERRLOG_MSTADDR      0x68
+#define L3_FLAGMUX_REGERR0             0xc
+
+#define NUM_OF_L3_MASTERS      (sizeof(l3_masters)/sizeof(l3_masters[0]))
+
+static u32 l3_flagmux[L3_MODULES] = {
+       0x500,
+       0x1000,
+       0X0200
 };
 
-/*
- * L3 Target standard Error register offsets
- */
-u32 l3_targ_stderrlog_main_clk1[] = {
-       0x148, /* DMM1 */
-       0x248, /* DMM2 */
-       0x348, /* ABE */
-       0x448, /* L4CFG */
-       0x648  /* CLK2 PWR DISC */
+/* L3 Target standard Error register offsets */
+static u32 l3_targ_inst_clk1[] = {
+       0x100, /* DMM1 */
+       0x200, /* DMM2 */
+       0x300, /* ABE */
+       0x400, /* L4CFG */
+       0x600  /* CLK2 PWR DISC */
 };
 
-u32 l3_targ_stderrlog_main_clk2[] = {
-       0x548,          /* CORTEX M3 */
-       0x348,          /* DSS */
-       0x148,          /* GPMC */
-       0x448,          /* ISS */
-       0x748,          /* IVAHD */
-       0xD48,          /* missing in TRM  corresponds to AES1*/
-       0x948,          /* L4 PER0*/
-       0x248,          /* OCMRAM */
-       0x148,          /* missing in TRM corresponds to GPMC sERROR*/
-       0x648,          /* SGX */
-       0x848,          /* SL2 */
-       0x1648,         /* C2C */
-       0x1148,         /* missing in TRM corresponds PWR DISC CLK1*/
-       0xF48,          /* missing in TRM corrsponds to SHA1*/
-       0xE48,          /* missing in TRM corresponds to AES2*/
-       0xC48,          /* L4 PER3 */
-       0xA48,          /* L4 PER1*/
-       0xB48           /* L4 PER2*/
+static u32 l3_targ_inst_clk2[] = {
+       0x500, /* CORTEX M3 */
+       0x300, /* DSS */
+       0x100, /* GPMC */
+       0x400, /* ISS */
+       0x700, /* IVAHD */
+       0xD00, /* missing in TRM  corresponds to AES1*/
+       0x900, /* L4 PER0*/
+       0x200, /* OCMRAM */
+       0x100, /* missing in TRM corresponds to GPMC sERROR*/
+       0x600, /* SGX */
+       0x800, /* SL2 */
+       0x1600, /* C2C */
+       0x1100, /* missing in TRM corresponds PWR DISC CLK1*/
+       0xF00, /* missing in TRM corrsponds to SHA1*/
+       0xE00, /* missing in TRM corresponds to AES2*/
+       0xC00, /* L4 PER3 */
+       0xA00, /* L4 PER1*/
+       0xB00 /* L4 PER2*/
 };
 
-u32 l3_targ_stderrlog_main_clk3[] = {
-       0x0148  /* EMUSS */
+static u32 l3_targ_inst_clk3[] = {
+       0x0100  /* EMUSS */
 };
 
-char *l3_targ_stderrlog_main_name[L3_MODULES][18] = {
+static struct l3_masters_data {
+       u32 id;
+       char name[10];
+} l3_masters[] = {
+       { 0x0 , "MPU"},
+       { 0x10, "CS_ADP"},
+       { 0x14, "xxx"},
+       { 0x20, "DSP"},
+       { 0x30, "IVAHD"},
+       { 0x40, "ISS"},
+       { 0x44, "DucatiM3"},
+       { 0x48, "FaceDetect"},
+       { 0x50, "SDMA_Rd"},
+       { 0x54, "SDMA_Wr"},
+       { 0x58, "xxx"},
+       { 0x5C, "xxx"},
+       { 0x60, "SGX"},
+       { 0x70, "DSS"},
+       { 0x80, "C2C"},
+       { 0x88, "xxx"},
+       { 0x8C, "xxx"},
+       { 0x90, "HSI"},
+       { 0xA0, "MMC1"},
+       { 0xA4, "MMC2"},
+       { 0xA8, "MMC6"},
+       { 0xB0, "UNIPRO1"},
+       { 0xC0, "USBHOSTHS"},
+       { 0xC4, "USBOTGHS"},
+       { 0xC8, "USBHOSTFS"}
+};
+
+static char *l3_targ_inst_name[L3_MODULES][18] = {
        {
-       "DMM1",
-       "DMM2",
-       "ABE",
-       "L4CFG",
-       "CLK2 PWR DISC",
+               "DMM1",
+               "DMM2",
+               "ABE",
+               "L4CFG",
+               "CLK2 PWR DISC",
        },
        {
-       "CORTEX M3" ,
-       "DSS ",
-       "GPMC ",
-       "ISS ",
-       "IVAHD ",
-       "AES1",
-       "L4 PER0",
-       "OCMRAM ",
-       "GPMC sERROR",
-       "SGX ",
-       "SL2 ",
-       "C2C ",
-       "PWR DISC CLK1",
-       "SHA1",
-       "AES2",
-       "L4 PER3",
-       "L4 PER1",
-       "L4 PER2",
+               "CORTEX M3" ,
+               "DSS ",
+               "GPMC ",
+               "ISS ",
+               "IVAHD ",
+               "AES1",
+               "L4 PER0",
+               "OCMRAM ",
+               "GPMC sERROR",
+               "SGX ",
+               "SL2 ",
+               "C2C ",
+               "PWR DISC CLK1",
+               "SHA1",
+               "AES2",
+               "L4 PER3",
+               "L4 PER1",
+               "L4 PER2",
        },
        {
-       "EMUSS",
+               "EMUSS",
        },
 };
 
-u32 *l3_targ[L3_MODULES] = {
-       l3_targ_stderrlog_main_clk1,
-       l3_targ_stderrlog_main_clk2,
-       l3_targ_stderrlog_main_clk3,
+static u32 *l3_targ[L3_MODULES] = {
+       l3_targ_inst_clk1,
+       l3_targ_inst_clk2,
+       l3_targ_inst_clk3,
 };
 
 struct omap4_l3 {
-       struct device   *dev;
-       struct clk      *ick;
+       struct device *dev;
+       struct clk *ick;
 
        /* memory base */
-       void __iomem *l3_base[4];
+       void __iomem *l3_base[L3_MODULES];
 
-       int             debug_irq;
-       int             app_irq;
+       int debug_irq;
+       int app_irq;
 };
-
 #endif
index 873c0e33b512e1da521e2277a8122b60aa84a779..a05a62f9ee5b2e7bce17e9b89fc4ce6ff0f18d2b 100644 (file)
@@ -1,26 +1,26 @@
- /*
 * OMAP3XXX L3 Interconnect Driver
 *
 * Copyright (C) 2011 Texas Corporation
 *    Felipe Balbi <balbi@ti.com>
 *    Santosh Shilimkar <santosh.shilimkar@ti.com>
 *    Sricharan <r.sricharan@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
 */
+/*
+ * OMAP3XXX L3 Interconnect Driver
+ *
+ * Copyright (C) 2011 Texas Corporation
    Felipe Balbi <balbi@ti.com>
    Santosh Shilimkar <santosh.shilimkar@ti.com>
    Sricharan <r.sricharan@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 <linux/kernel.h>
 #include <linux/slab.h>
@@ -135,7 +135,7 @@ static char *omap3_l3_initiator_string(u8 initid)
        }
 }
 
-/**
+/*
  * omap3_l3_block_irq - handles a register block's irq
  * @l3: struct omap3_l3 *
  * @base: register block base address
@@ -150,30 +150,29 @@ static char *omap3_l3_initiator_string(u8 initid)
 static irqreturn_t omap3_l3_block_irq(struct omap3_l3 *l3,
                                        u64 error, int error_addr)
 {
-       u8                      code = omap3_l3_decode_error_code(error);
-       u8                      initid = omap3_l3_decode_initid(error);
-       u8                      multi = error & L3_ERROR_LOG_MULTI;
-       u32                     address = omap3_l3_decode_addr(error_addr);
+       u8 code = omap3_l3_decode_error_code(error);
+       u8 initid = omap3_l3_decode_initid(error);
+       u8 multi = error & L3_ERROR_LOG_MULTI;
+       u32 address = omap3_l3_decode_addr(error_addr);
 
        WARN(true, "%s seen by %s %s at address %x\n",
-                                omap3_l3_code_string(code),
-                         omap3_l3_initiator_string(initid),
-                            multi ? "Multiple Errors" : "",
-                                                  address);
+                       omap3_l3_code_string(code),
+                       omap3_l3_initiator_string(initid),
+                       multi ? "Multiple Errors" : "", address);
 
        return IRQ_HANDLED;
 }
 
 static irqreturn_t omap3_l3_app_irq(int irq, void *_l3)
 {
-       struct omap3_l3         *l3 = _l3;
-       u64                     status, clear;
-       u64                     error;
-       u64                     error_addr;
-       u64                     err_source = 0;
-       void                    __iomem *base;
-       int                     int_type;
-       irqreturn_t             ret = IRQ_NONE;
+       struct omap3_l3 *l3 = _l3;
+       u64 status, clear;
+       u64 error;
+       u64 error_addr;
+       u64 err_source = 0;
+       void __iomem *base;
+       int int_type;
+       irqreturn_t ret = IRQ_NONE;
 
        int_type = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR;
        if (!int_type) {
@@ -191,14 +190,12 @@ static irqreturn_t omap3_l3_app_irq(int irq, void *_l3)
        }
 
        /* identify the error source */
-       for (err_source = 0; !(status & (1 << err_source)); err_source++)
-                                                                       ;
+       err_source = __ffs(status);
 
-       base = l3->rt + *(omap3_l3_bases[int_type] + err_source);
+       base = l3->rt + omap3_l3_bases[int_type][err_source];
        error = omap3_l3_readll(base, L3_ERROR_LOG);
        if (error) {
                error_addr = omap3_l3_readll(base, L3_ERROR_LOG_ADDR);
-
                ret |= omap3_l3_block_irq(l3, error, error_addr);
        }
 
@@ -215,9 +212,9 @@ static irqreturn_t omap3_l3_app_irq(int irq, void *_l3)
 
 static int __init omap3_l3_probe(struct platform_device *pdev)
 {
-       struct omap3_l3         *l3;
-       struct resource         *res;
-       int                     ret;
+       struct omap3_l3 *l3;
+       struct resource *res;
+       int ret;
 
        l3 = kzalloc(sizeof(*l3), GFP_KERNEL);
        if (!l3)
index ba2ed9a850cc37df280a9ef88ecefb4dbf3859c7..4f3cebca4179f7b64d2be2dde31787cc561a6eaa 100644 (file)
@@ -1,26 +1,26 @@
- /*
 * OMAP3XXX L3 Interconnect Driver header
 *
 * Copyright (C) 2011 Texas Corporation
 *    Felipe Balbi <balbi@ti.com>
 *    Santosh Shilimkar <santosh.shilimkar@ti.com>
 *    sricharan <r.sricharan@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
 */
+/*
+ * OMAP3XXX L3 Interconnect Driver header
+ *
+ * Copyright (C) 2011 Texas Corporation
    Felipe Balbi <balbi@ti.com>
    Santosh Shilimkar <santosh.shilimkar@ti.com>
    sricharan <r.sricharan@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 __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H
 #define __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H
 
@@ -40,7 +40,7 @@
 #define L3_SI_CONTROL                  0x020
 #define L3_SI_FLAG_STATUS_0            0x510
 
-const u64 shift = 1;
+static const u64 shift = 1;
 
 #define L3_STATUS_0_MPUIA_BRST         (shift << 0)
 #define L3_STATUS_0_MPUIA_RSP          (shift << 1)
@@ -78,32 +78,32 @@ const u64 shift = 1;
 #define L3_STATUS_0_L4EMUTA_REQ                (shift << 60)
 #define L3_STATUS_0_MAD2DTA_REQ                (shift << 61)
 
-#define L3_STATUS_0_TIMEOUT_MASK       (L3_STATUS_0_MPUIA_BRST         \
-                                       | L3_STATUS_0_MPUIA_RSP         \
-                                       | L3_STATUS_0_IVAIA_BRST        \
-                                       | L3_STATUS_0_IVAIA_RSP         \
-                                       | L3_STATUS_0_SGXIA_BRST        \
-                                       | L3_STATUS_0_SGXIA_RSP         \
-                                       | L3_STATUS_0_CAMIA_BRST        \
-                                       | L3_STATUS_0_CAMIA_RSP         \
-                                       | L3_STATUS_0_DISPIA_BRST       \
-                                       | L3_STATUS_0_DISPIA_RSP        \
-                                       | L3_STATUS_0_DMARDIA_BRST      \
-                                       | L3_STATUS_0_DMARDIA_RSP       \
-                                       | L3_STATUS_0_DMAWRIA_BRST      \
-                                       | L3_STATUS_0_DMAWRIA_RSP       \
-                                       | L3_STATUS_0_USBOTGIA_BRST     \
-                                       | L3_STATUS_0_USBOTGIA_RSP      \
-                                       | L3_STATUS_0_USBHOSTIA_BRST    \
-                                       | L3_STATUS_0_SMSTA_REQ         \
-                                       | L3_STATUS_0_GPMCTA_REQ        \
-                                       | L3_STATUS_0_OCMRAMTA_REQ      \
-                                       | L3_STATUS_0_OCMROMTA_REQ      \
-                                       | L3_STATUS_0_IVATA_REQ         \
-                                       | L3_STATUS_0_SGXTA_REQ         \
-                                       | L3_STATUS_0_L4CORETA_REQ      \
-                                       | L3_STATUS_0_L4PERTA_REQ       \
-                                       | L3_STATUS_0_L4EMUTA_REQ       \
+#define L3_STATUS_0_TIMEOUT_MASK       (L3_STATUS_0_MPUIA_BRST         \
+                                       | L3_STATUS_0_MPUIA_RSP         \
+                                       | L3_STATUS_0_IVAIA_BRST        \
+                                       | L3_STATUS_0_IVAIA_RSP         \
+                                       | L3_STATUS_0_SGXIA_BRST        \
+                                       | L3_STATUS_0_SGXIA_RSP         \
+                                       | L3_STATUS_0_CAMIA_BRST        \
+                                       | L3_STATUS_0_CAMIA_RSP         \
+                                       | L3_STATUS_0_DISPIA_BRST       \
+                                       | L3_STATUS_0_DISPIA_RSP        \
+                                       | L3_STATUS_0_DMARDIA_BRST      \
+                                       | L3_STATUS_0_DMARDIA_RSP       \
+                                       | L3_STATUS_0_DMAWRIA_BRST      \
+                                       | L3_STATUS_0_DMAWRIA_RSP       \
+                                       | L3_STATUS_0_USBOTGIA_BRST     \
+                                       | L3_STATUS_0_USBOTGIA_RSP      \
+                                       | L3_STATUS_0_USBHOSTIA_BRST    \
+                                       | L3_STATUS_0_SMSTA_REQ         \
+                                       | L3_STATUS_0_GPMCTA_REQ        \
+                                       | L3_STATUS_0_OCMRAMTA_REQ      \
+                                       | L3_STATUS_0_OCMROMTA_REQ      \
+                                       | L3_STATUS_0_IVATA_REQ         \
+                                       | L3_STATUS_0_SGXTA_REQ         \
+                                       | L3_STATUS_0_L4CORETA_REQ      \
+                                       | L3_STATUS_0_L4PERTA_REQ       \
+                                       | L3_STATUS_0_L4EMUTA_REQ       \
                                        | L3_STATUS_0_MAD2DTA_REQ)
 
 #define L3_SI_FLAG_STATUS_1            0x530
@@ -137,19 +137,19 @@ const u64 shift = 1;
 
 enum omap3_l3_initiator_id {
        /* LCD has 1 ID */
-       OMAP_L3_LCD             = 29,
+       OMAP_L3_LCD = 29,
        /* SAD2D has 1 ID */
-       OMAP_L3_SAD2D           = 28,
+       OMAP_L3_SAD2D = 28,
        /* MPU has 5 IDs */
-       OMAP_L3_IA_MPU_SS_1     = 27,
-       OMAP_L3_IA_MPU_SS_2     = 26,
-       OMAP_L3_IA_MPU_SS_3     = 25,
-       OMAP_L3_IA_MPU_SS_4     = 24,
-       OMAP_L3_IA_MPU_SS_5     = 23,
+       OMAP_L3_IA_MPU_SS_1 = 27,
+       OMAP_L3_IA_MPU_SS_2 = 26,
+       OMAP_L3_IA_MPU_SS_3 = 25,
+       OMAP_L3_IA_MPU_SS_4 = 24,
+       OMAP_L3_IA_MPU_SS_5 = 23,
        /* IVA2.2 SS has 3 IDs*/
-       OMAP_L3_IA_IVA_SS_1     = 22,
-       OMAP_L3_IA_IVA_SS_2     = 21,
-       OMAP_L3_IA_IVA_SS_3     = 20,
+       OMAP_L3_IA_IVA_SS_1 = 22,
+       OMAP_L3_IA_IVA_SS_2 = 21,
+       OMAP_L3_IA_IVA_SS_3 = 20,
        /* IVA 2.2 SS DMA has 6 IDS */
        OMAP_L3_IA_IVA_SS_DMA_1 = 19,
        OMAP_L3_IA_IVA_SS_DMA_2 = 18,
@@ -158,25 +158,25 @@ enum omap3_l3_initiator_id {
        OMAP_L3_IA_IVA_SS_DMA_5 = 15,
        OMAP_L3_IA_IVA_SS_DMA_6 = 14,
        /* SGX has 1 ID */
-       OMAP_L3_IA_SGX          = 13,
+       OMAP_L3_IA_SGX = 13,
        /* CAM has 3 ID */
-       OMAP_L3_IA_CAM_1        = 12,
-       OMAP_L3_IA_CAM_2        = 11,
-       OMAP_L3_IA_CAM_3        = 10,
+       OMAP_L3_IA_CAM_1 = 12,
+       OMAP_L3_IA_CAM_2 = 11,
+       OMAP_L3_IA_CAM_3 = 10,
        /* DAP has 1 ID */
-       OMAP_L3_IA_DAP          = 9,
+       OMAP_L3_IA_DAP = 9,
        /* SDMA WR has 2 IDs */
-       OMAP_L3_SDMA_WR_1       = 8,
-       OMAP_L3_SDMA_WR_2       = 7,
+       OMAP_L3_SDMA_WR_1 = 8,
+       OMAP_L3_SDMA_WR_2 = 7,
        /* SDMA RD has 4 IDs */
-       OMAP_L3_SDMA_RD_1       = 6,
-       OMAP_L3_SDMA_RD_2       = 5,
-       OMAP_L3_SDMA_RD_3       = 4,
-       OMAP_L3_SDMA_RD_4       = 3,
+       OMAP_L3_SDMA_RD_1 = 6,
+       OMAP_L3_SDMA_RD_2 = 5,
+       OMAP_L3_SDMA_RD_3 = 4,
+       OMAP_L3_SDMA_RD_4 = 3,
        /* HSUSB OTG has 1 ID */
-       OMAP_L3_USBOTG          = 2,
+       OMAP_L3_USBOTG = 2,
        /* HSUSB HOST has 1 ID */
-       OMAP_L3_USBHOST         = 1,
+       OMAP_L3_USBHOST = 1,
 };
 
 enum omap3_l3_code {
@@ -192,21 +192,21 @@ enum omap3_l3_code {
 };
 
 struct omap3_l3 {
-       struct device   *dev;
-       struct clk      *ick;
+       struct device *dev;
+       struct clk *ick;
 
        /* memory base*/
-       void __iomem    *rt;
+       void __iomem *rt;
 
-       int             debug_irq;
-       int             app_irq;
+       int debug_irq;
+       int app_irq;
 
        /* true when and inband functional error occurs */
-       unsigned        inband:1;
+       unsigned inband:1;
 };
 
 /* offsets for l3 agents in order with the Flag status register */
-unsigned int __iomem omap3_l3_app_bases[] = {
+static unsigned int omap3_l3_app_bases[] = {
        /* MPU IA */
        0x1400,
        0x1400,
@@ -305,7 +305,7 @@ unsigned int __iomem omap3_l3_app_bases[] = {
        0,
 };
 
-unsigned int __iomem omap3_l3_debug_bases[] = {
+static unsigned int omap3_l3_debug_bases[] = {
        /* MPU DATA IA */
        0x1400,
        /* RESERVED */
@@ -321,7 +321,7 @@ unsigned int __iomem omap3_l3_debug_bases[] = {
        /* REST RESERVED */
 };
 
-u32 *omap3_l3_bases[] = {
+static u32 *omap3_l3_bases[] = {
        omap3_l3_app_bases,
        omap3_l3_debug_bases,
 };
index 07d6140baa9d605cf6af4c34265701f36648d101..f515a1a056d55c96facdb49c9eec0911d8f6c728 100644 (file)
 
 #define OMAP4_SRI2C_SLAVE_ADDR         0x12
 #define OMAP4_VDD_MPU_SR_VOLT_REG      0x55
+#define OMAP4_VDD_MPU_SR_CMD_REG       0x56
 #define OMAP4_VDD_IVA_SR_VOLT_REG      0x5B
+#define OMAP4_VDD_IVA_SR_CMD_REG       0x5C
 #define OMAP4_VDD_CORE_SR_VOLT_REG     0x61
+#define OMAP4_VDD_CORE_SR_CMD_REG      0x62
 
 #define OMAP4_VP_CONFIG_ERROROFFSET    0x00
 #define OMAP4_VP_VSTEPMIN_VSTEPMIN     0x01
@@ -95,6 +98,8 @@ static unsigned long twl6030_vsel_to_uv(const u8 vsel)
                is_offset_valid = true;
        }
 
+       if (!vsel)
+               return 0;
        /*
         * There is no specific formula for voltage to vsel
         * conversion above 1.3V. There are special hardcoded
@@ -106,9 +111,9 @@ static unsigned long twl6030_vsel_to_uv(const u8 vsel)
                return 1350000;
 
        if (smps_offset & 0x8)
-               return ((((vsel - 1) * 125) + 7000)) * 100;
+               return ((((vsel - 1) * 1266) + 70900)) * 10;
        else
-               return ((((vsel - 1) * 125) + 6000)) * 100;
+               return ((((vsel - 1) * 1266) + 60770)) * 10;
 }
 
 static u8 twl6030_uv_to_vsel(unsigned long uv)
@@ -127,6 +132,8 @@ static u8 twl6030_uv_to_vsel(unsigned long uv)
                is_offset_valid = true;
        }
 
+       if (!uv)
+               return 0x00;
        /*
         * There is no specific formula for voltage to vsel
         * conversion above 1.3V. There are special hardcoded
@@ -134,16 +141,21 @@ static u8 twl6030_uv_to_vsel(unsigned long uv)
         * hardcoding only for 1.35 V which is used for 1GH OPP for
         * OMAP4430.
         */
-       if (uv == 1350000)
+       if (uv > twl6030_vsel_to_uv(0x39)) {
+               if (uv == 1350000)
+                       return 0x3A;
+               pr_err("%s:OUT OF RANGE! non mapped vsel for %ld Vs max %ld\n",
+                       __func__, uv, twl6030_vsel_to_uv(0x39));
                return 0x3A;
+       }
 
        if (smps_offset & 0x8)
-               return DIV_ROUND_UP(uv - 700000, 12500) + 1;
+               return DIV_ROUND_UP(uv - 709000, 12660) + 1;
        else
-               return DIV_ROUND_UP(uv - 600000, 12500) + 1;
+               return DIV_ROUND_UP(uv - 607700, 12660) + 1;
 }
 
-static struct omap_volt_pmic_info omap3_mpu_volt_info = {
+static struct omap_voltdm_pmic omap3_mpu_pmic = {
        .slew_rate              = 4000,
        .step_size              = 12500,
        .on_volt                = 1200000,
@@ -158,12 +170,13 @@ static struct omap_volt_pmic_info omap3_mpu_volt_info = {
        .vp_vddmax              = OMAP3430_VP1_VLIMITTO_VDDMAX,
        .vp_timeout_us          = OMAP3_VP_VLIMITTO_TIMEOUT_US,
        .i2c_slave_addr         = OMAP3_SRI2C_SLAVE_ADDR,
-       .pmic_reg               = OMAP3_VDD_MPU_SR_CONTROL_REG,
+       .volt_reg_addr          = OMAP3_VDD_MPU_SR_CONTROL_REG,
+       .i2c_high_speed         = true,
        .vsel_to_uv             = twl4030_vsel_to_uv,
        .uv_to_vsel             = twl4030_uv_to_vsel,
 };
 
-static struct omap_volt_pmic_info omap3_core_volt_info = {
+static struct omap_voltdm_pmic omap3_core_pmic = {
        .slew_rate              = 4000,
        .step_size              = 12500,
        .on_volt                = 1200000,
@@ -178,18 +191,19 @@ static struct omap_volt_pmic_info omap3_core_volt_info = {
        .vp_vddmax              = OMAP3430_VP2_VLIMITTO_VDDMAX,
        .vp_timeout_us          = OMAP3_VP_VLIMITTO_TIMEOUT_US,
        .i2c_slave_addr         = OMAP3_SRI2C_SLAVE_ADDR,
-       .pmic_reg               = OMAP3_VDD_CORE_SR_CONTROL_REG,
+       .volt_reg_addr          = OMAP3_VDD_CORE_SR_CONTROL_REG,
+       .i2c_high_speed         = true,
        .vsel_to_uv             = twl4030_vsel_to_uv,
        .uv_to_vsel             = twl4030_uv_to_vsel,
 };
 
-static struct omap_volt_pmic_info omap4_mpu_volt_info = {
+static struct omap_voltdm_pmic omap4_mpu_pmic = {
        .slew_rate              = 4000,
-       .step_size              = 12500,
-       .on_volt                = 1350000,
-       .onlp_volt              = 1350000,
-       .ret_volt               = 837500,
-       .off_volt               = 600000,
+       .step_size              = 12660,
+       .on_volt                = 1375000,
+       .onlp_volt              = 1375000,
+       .ret_volt               = 830000,
+       .off_volt               = 0,
        .volt_setup_time        = 0,
        .vp_erroroffset         = OMAP4_VP_CONFIG_ERROROFFSET,
        .vp_vstepmin            = OMAP4_VP_VSTEPMIN_VSTEPMIN,
@@ -198,18 +212,20 @@ static struct omap_volt_pmic_info omap4_mpu_volt_info = {
        .vp_vddmax              = OMAP4_VP_MPU_VLIMITTO_VDDMAX,
        .vp_timeout_us          = OMAP4_VP_VLIMITTO_TIMEOUT_US,
        .i2c_slave_addr         = OMAP4_SRI2C_SLAVE_ADDR,
-       .pmic_reg               = OMAP4_VDD_MPU_SR_VOLT_REG,
+       .volt_reg_addr          = OMAP4_VDD_MPU_SR_VOLT_REG,
+       .cmd_reg_addr           = OMAP4_VDD_MPU_SR_CMD_REG,
+       .i2c_high_speed         = true,
        .vsel_to_uv             = twl6030_vsel_to_uv,
        .uv_to_vsel             = twl6030_uv_to_vsel,
 };
 
-static struct omap_volt_pmic_info omap4_iva_volt_info = {
+static struct omap_voltdm_pmic omap4_iva_pmic = {
        .slew_rate              = 4000,
-       .step_size              = 12500,
-       .on_volt                = 1100000,
-       .onlp_volt              = 1100000,
-       .ret_volt               = 837500,
-       .off_volt               = 600000,
+       .step_size              = 12660,
+       .on_volt                = 1188000,
+       .onlp_volt              = 1188000,
+       .ret_volt               = 830000,
+       .off_volt               = 0,
        .volt_setup_time        = 0,
        .vp_erroroffset         = OMAP4_VP_CONFIG_ERROROFFSET,
        .vp_vstepmin            = OMAP4_VP_VSTEPMIN_VSTEPMIN,
@@ -218,18 +234,20 @@ static struct omap_volt_pmic_info omap4_iva_volt_info = {
        .vp_vddmax              = OMAP4_VP_IVA_VLIMITTO_VDDMAX,
        .vp_timeout_us          = OMAP4_VP_VLIMITTO_TIMEOUT_US,
        .i2c_slave_addr         = OMAP4_SRI2C_SLAVE_ADDR,
-       .pmic_reg               = OMAP4_VDD_IVA_SR_VOLT_REG,
+       .volt_reg_addr          = OMAP4_VDD_IVA_SR_VOLT_REG,
+       .cmd_reg_addr           = OMAP4_VDD_IVA_SR_CMD_REG,
+       .i2c_high_speed         = true,
        .vsel_to_uv             = twl6030_vsel_to_uv,
        .uv_to_vsel             = twl6030_uv_to_vsel,
 };
 
-static struct omap_volt_pmic_info omap4_core_volt_info = {
+static struct omap_voltdm_pmic omap4_core_pmic = {
        .slew_rate              = 4000,
-       .step_size              = 12500,
-       .on_volt                = 1100000,
-       .onlp_volt              = 1100000,
-       .ret_volt               = 837500,
-       .off_volt               = 600000,
+       .step_size              = 12660,
+       .on_volt                = 1200000,
+       .onlp_volt              = 1200000,
+       .ret_volt               = 830000,
+       .off_volt               = 0,
        .volt_setup_time        = 0,
        .vp_erroroffset         = OMAP4_VP_CONFIG_ERROROFFSET,
        .vp_vstepmin            = OMAP4_VP_VSTEPMIN_VSTEPMIN,
@@ -238,7 +256,8 @@ static struct omap_volt_pmic_info omap4_core_volt_info = {
        .vp_vddmax              = OMAP4_VP_CORE_VLIMITTO_VDDMAX,
        .vp_timeout_us          = OMAP4_VP_VLIMITTO_TIMEOUT_US,
        .i2c_slave_addr         = OMAP4_SRI2C_SLAVE_ADDR,
-       .pmic_reg               = OMAP4_VDD_CORE_SR_VOLT_REG,
+       .volt_reg_addr          = OMAP4_VDD_CORE_SR_VOLT_REG,
+       .cmd_reg_addr           = OMAP4_VDD_CORE_SR_CMD_REG,
        .vsel_to_uv             = twl6030_vsel_to_uv,
        .uv_to_vsel             = twl6030_uv_to_vsel,
 };
@@ -250,14 +269,14 @@ int __init omap4_twl_init(void)
        if (!cpu_is_omap44xx())
                return -ENODEV;
 
-       voltdm = omap_voltage_domain_lookup("mpu");
-       omap_voltage_register_pmic(voltdm, &omap4_mpu_volt_info);
+       voltdm = voltdm_lookup("mpu");
+       omap_voltage_register_pmic(voltdm, &omap4_mpu_pmic);
 
-       voltdm = omap_voltage_domain_lookup("iva");
-       omap_voltage_register_pmic(voltdm, &omap4_iva_volt_info);
+       voltdm = voltdm_lookup("iva");
+       omap_voltage_register_pmic(voltdm, &omap4_iva_pmic);
 
-       voltdm = omap_voltage_domain_lookup("core");
-       omap_voltage_register_pmic(voltdm, &omap4_core_volt_info);
+       voltdm = voltdm_lookup("core");
+       omap_voltage_register_pmic(voltdm, &omap4_core_pmic);
 
        return 0;
 }
@@ -270,10 +289,10 @@ int __init omap3_twl_init(void)
                return -ENODEV;
 
        if (cpu_is_omap3630()) {
-               omap3_mpu_volt_info.vp_vddmin = OMAP3630_VP1_VLIMITTO_VDDMIN;
-               omap3_mpu_volt_info.vp_vddmax = OMAP3630_VP1_VLIMITTO_VDDMAX;
-               omap3_core_volt_info.vp_vddmin = OMAP3630_VP2_VLIMITTO_VDDMIN;
-               omap3_core_volt_info.vp_vddmax = OMAP3630_VP2_VLIMITTO_VDDMAX;
+               omap3_mpu_pmic.vp_vddmin = OMAP3630_VP1_VLIMITTO_VDDMIN;
+               omap3_mpu_pmic.vp_vddmax = OMAP3630_VP1_VLIMITTO_VDDMAX;
+               omap3_core_pmic.vp_vddmin = OMAP3630_VP2_VLIMITTO_VDDMIN;
+               omap3_core_pmic.vp_vddmax = OMAP3630_VP2_VLIMITTO_VDDMAX;
        }
 
        /*
@@ -288,11 +307,11 @@ int __init omap3_twl_init(void)
        if (!twl_sr_enable_autoinit)
                omap3_twl_set_sr_bit(true);
 
-       voltdm = omap_voltage_domain_lookup("mpu");
-       omap_voltage_register_pmic(voltdm, &omap3_mpu_volt_info);
+       voltdm = voltdm_lookup("mpu_iva");
+       omap_voltage_register_pmic(voltdm, &omap3_mpu_pmic);
 
-       voltdm = omap_voltage_domain_lookup("core");
-       omap_voltage_register_pmic(voltdm, &omap3_core_volt_info);
+       voltdm = voltdm_lookup("core");
+       omap_voltage_register_pmic(voltdm, &omap3_core_pmic);
 
        return 0;
 }
index ab8b35b780b5b6767d6df0e060c8a01e0bcf4ce9..9262a6b47702582d30a2a75d21cb3637c2252a24 100644 (file)
@@ -69,7 +69,7 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def,
                                opp_def->hwmod_name, i);
                        return -EINVAL;
                }
-               dev = &oh->od->pdev.dev;
+               dev = &oh->od->pdev->dev;
 
                r = opp_add(dev, opp_def->freq, opp_def->u_volt);
                if (r) {
index 472bf22d5e84875416854c3e76c206fa02c85302..2ab7a9e17fe2683889762494249f356c3b5beab0 100644 (file)
 
 static struct omap_device_pm_latency *pm_lats;
 
-static struct device *mpu_dev;
-static struct device *iva_dev;
-static struct device *l3_dev;
-static struct device *dsp_dev;
-
-struct device *omap2_get_mpuss_device(void)
-{
-       WARN_ON_ONCE(!mpu_dev);
-       return mpu_dev;
-}
-
-struct device *omap2_get_iva_device(void)
-{
-       WARN_ON_ONCE(!iva_dev);
-       return iva_dev;
-}
-
-struct device *omap2_get_l3_device(void)
-{
-       WARN_ON_ONCE(!l3_dev);
-       return l3_dev;
-}
-
-struct device *omap4_get_dsp_device(void)
-{
-       WARN_ON_ONCE(!dsp_dev);
-       return dsp_dev;
-}
-EXPORT_SYMBOL(omap4_get_dsp_device);
-
-/* static int _init_omap_device(struct omap_hwmod *oh, void *user) */
-static int _init_omap_device(char *name, struct device **new_dev)
+static int _init_omap_device(char *name)
 {
        struct omap_hwmod *oh;
-       struct omap_device *od;
+       struct platform_device *pdev;
 
        oh = omap_hwmod_lookup(name);
        if (WARN(!oh, "%s: could not find omap_hwmod for %s\n",
                 __func__, name))
                return -ENODEV;
 
-       od = omap_device_build(oh->name, 0, oh, NULL, 0, pm_lats, 0, false);
-       if (WARN(IS_ERR(od), "%s: could not build omap_device for %s\n",
+       pdev = omap_device_build(oh->name, 0, oh, NULL, 0, pm_lats, 0, false);
+       if (WARN(IS_ERR(pdev), "%s: could not build omap_device for %s\n",
                 __func__, name))
                return -ENODEV;
 
-       *new_dev = &od->pdev.dev;
-
        return 0;
 }
 
@@ -82,16 +49,16 @@ static int _init_omap_device(char *name, struct device **new_dev)
  */
 static void omap2_init_processor_devices(void)
 {
-       _init_omap_device("mpu", &mpu_dev);
+       _init_omap_device("mpu");
        if (omap3_has_iva())
-               _init_omap_device("iva", &iva_dev);
+               _init_omap_device("iva");
 
        if (cpu_is_omap44xx()) {
-               _init_omap_device("l3_main_1", &l3_dev);
-               _init_omap_device("dsp", &dsp_dev);
-               _init_omap_device("iva", &iva_dev);
+               _init_omap_device("l3_main_1");
+               _init_omap_device("dsp");
+               _init_omap_device("iva");
        } else {
-               _init_omap_device("l3_main", &l3_dev);
+               _init_omap_device("l3_main");
        }
 }
 
@@ -136,8 +103,8 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
 
        ret = pwrdm_set_next_pwrst(pwrdm, state);
        if (ret) {
-               printk(KERN_ERR "Unable to set state of powerdomain: %s\n",
-                      pwrdm->name);
+               pr_err("%s: unable to set state of powerdomain: %s\n",
+                      __func__, pwrdm->name);
                goto err;
        }
 
@@ -161,37 +128,44 @@ err:
 }
 
 /*
- * This API is to be called during init to put the various voltage
+ * This API is to be called during init to set the various voltage
  * domains to the voltage as per the opp table. Typically we boot up
  * at the nominal voltage. So this function finds out the rate of
  * the clock associated with the voltage domain, finds out the correct
- * opp entry and puts the voltage domain to the voltage specifies
+ * opp entry and sets the voltage domain to the voltage specified
  * in the opp entry
  */
 static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
-                                               struct device *dev)
+                                        const char *oh_name)
 {
        struct voltagedomain *voltdm;
        struct clk *clk;
        struct opp *opp;
        unsigned long freq, bootup_volt;
+       struct device *dev;
+
+       if (!vdd_name || !clk_name || !oh_name) {
+               pr_err("%s: invalid parameters\n", __func__);
+               goto exit;
+       }
 
-       if (!vdd_name || !clk_name || !dev) {
-               printk(KERN_ERR "%s: Invalid parameters!\n", __func__);
+       dev = omap_device_get_by_hwmod_name(oh_name);
+       if (IS_ERR(dev)) {
+               pr_err("%s: Unable to get dev pointer for hwmod %s\n",
+                       __func__, oh_name);
                goto exit;
        }
 
-       voltdm = omap_voltage_domain_lookup(vdd_name);
+       voltdm = voltdm_lookup(vdd_name);
        if (IS_ERR(voltdm)) {
-               printk(KERN_ERR "%s: Unable to get vdd pointer for vdd_%s\n",
+               pr_err("%s: unable to get vdd pointer for vdd_%s\n",
                        __func__, vdd_name);
                goto exit;
        }
 
        clk =  clk_get(NULL, clk_name);
        if (IS_ERR(clk)) {
-               printk(KERN_ERR "%s: unable to get clk %s\n",
-                       __func__, clk_name);
+               pr_err("%s: unable to get clk %s\n", __func__, clk_name);
                goto exit;
        }
 
@@ -200,24 +174,23 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
 
        opp = opp_find_freq_ceil(dev, &freq);
        if (IS_ERR(opp)) {
-               printk(KERN_ERR "%s: unable to find boot up OPP for vdd_%s\n",
+               pr_err("%s: unable to find boot up OPP for vdd_%s\n",
                        __func__, vdd_name);
                goto exit;
        }
 
        bootup_volt = opp_get_voltage(opp);
        if (!bootup_volt) {
-               printk(KERN_ERR "%s: unable to find voltage corresponding"
+               pr_err("%s: unable to find voltage corresponding "
                        "to the bootup OPP for vdd_%s\n", __func__, vdd_name);
                goto exit;
        }
 
-       omap_voltage_scale_vdd(voltdm, bootup_volt);
+       voltdm_scale(voltdm, bootup_volt);
        return 0;
 
 exit:
-       printk(KERN_ERR "%s: Unable to put vdd_%s to its init voltage\n\n",
-               __func__, vdd_name);
+       pr_err("%s: unable to set vdd_%s\n", __func__, vdd_name);
        return -EINVAL;
 }
 
@@ -226,8 +199,8 @@ static void __init omap3_init_voltages(void)
        if (!cpu_is_omap34xx())
                return;
 
-       omap2_set_init_voltage("mpu", "dpll1_ck", mpu_dev);
-       omap2_set_init_voltage("core", "l3_ick", l3_dev);
+       omap2_set_init_voltage("mpu_iva", "dpll1_ck", "mpu");
+       omap2_set_init_voltage("core", "l3_ick", "l3_main");
 }
 
 static void __init omap4_init_voltages(void)
@@ -235,14 +208,15 @@ static void __init omap4_init_voltages(void)
        if (!cpu_is_omap44xx())
                return;
 
-       omap2_set_init_voltage("mpu", "dpll_mpu_ck", mpu_dev);
-       omap2_set_init_voltage("core", "l3_div_ck", l3_dev);
-       omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", iva_dev);
+       omap2_set_init_voltage("mpu", "dpll_mpu_ck", "mpu");
+       omap2_set_init_voltage("core", "l3_div_ck", "l3_main_1");
+       omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva");
 }
 
 static int __init omap2_common_pm_init(void)
 {
-       omap2_init_processor_devices();
+       if (!of_have_populated_dt())
+               omap2_init_processor_devices();
        omap_pm_if_init();
 
        return 0;
index bf089e743ed98ecd6dc8536e57c5a39791eb9813..cf0c216132ab2a4f9aa67dd86a904ea954cb27ed 100644 (file)
@@ -53,8 +53,6 @@
 #include "powerdomain.h"
 #include "clockdomain.h"
 
-static int omap2_pm_debug;
-
 #ifdef CONFIG_SUSPEND
 static suspend_state_t suspend_state = PM_SUSPEND_ON;
 static inline bool is_suspending(void)
@@ -96,7 +94,6 @@ static int omap2_fclks_active(void)
 static void omap2_enter_full_retention(void)
 {
        u32 l;
-       struct timespec ts_preidle, ts_postidle, ts_idle;
 
        /* There is 1 reference hold for all children of the oscillator
         * clock, the following will remove it. If no one else uses the
@@ -124,10 +121,6 @@ static void omap2_enter_full_retention(void)
 
        omap2_gpio_prepare_for_idle(0);
 
-       if (omap2_pm_debug) {
-               getnstimeofday(&ts_preidle);
-       }
-
        /* One last check for pending IRQs to avoid extra latency due
         * to sleeping unnecessarily. */
        if (omap_irq_pending())
@@ -155,13 +148,6 @@ static void omap2_enter_full_retention(void)
                console_unlock();
 
 no_sleep:
-       if (omap2_pm_debug) {
-               unsigned long long tmp;
-
-               getnstimeofday(&ts_postidle);
-               ts_idle = timespec_sub(ts_postidle, ts_preidle);
-               tmp = timespec_to_ns(&ts_idle) * NSEC_PER_USEC;
-       }
        omap2_gpio_resume_after_idle();
 
        clk_enable(osc_ck);
@@ -219,7 +205,6 @@ static int omap2_allow_mpu_retention(void)
 static void omap2_enter_mpu_retention(void)
 {
        int only_idle = 0;
-       struct timespec ts_preidle, ts_postidle, ts_idle;
 
        /* Putting MPU into the WFI state while a transfer is active
         * seems to cause the I2C block to timeout. Why? Good question. */
@@ -246,19 +231,7 @@ static void omap2_enter_mpu_retention(void)
                only_idle = 1;
        }
 
-       if (omap2_pm_debug) {
-               getnstimeofday(&ts_preidle);
-       }
-
        omap2_sram_idle();
-
-       if (omap2_pm_debug) {
-               unsigned long long tmp;
-
-               getnstimeofday(&ts_postidle);
-               ts_idle = timespec_sub(ts_postidle, ts_preidle);
-               tmp = timespec_to_ns(&ts_idle) * NSEC_PER_USEC;
-       }
 }
 
 static int omap2_can_sleep(void)
index 7255d9bce8689baff0f4db0519ad590120a68874..c8cbd00a41af9cf6da518a67f9bff37784ebcbd3 100644 (file)
@@ -55,7 +55,7 @@
 static suspend_state_t suspend_state = PM_SUSPEND_ON;
 static inline bool is_suspending(void)
 {
-       return (suspend_state != PM_SUSPEND_ON);
+       return (suspend_state != PM_SUSPEND_ON) && console_suspend_enabled;
 }
 #else
 static inline bool is_suspending(void)
index 171fccd208c730e7f003f06de576c6f2a166694c..f97afff68d6dc172cbceff966ee6ead2820787d3 100644 (file)
@@ -1,9 +1,8 @@
 /*
- *  linux/arch/arm/mach-omap2/powerdomain-common.c
- *  Contains common powerdomain framework functions
+ * Common powerdomain framework functions
  *
- *  Copyright (C) 2010 Texas Instruments, Inc.
- *  Copyright (C) 2010 Nokia Corporation
+ * Copyright (C) 2010-2011 Texas Instruments, Inc.
+ * Copyright (C) 2010 Nokia Corporation
  *
  * Derived from mach-omap2/powerdomain.c written by Paul Walmsley
  *
index ef71fdd40fc47b05072821ede75365606d20ab61..5164d587ef52a17fa5083c71506ed801ce9dd382 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP powerdomain control
  *
- * Copyright (C) 2007-2008 Texas Instruments, Inc.
+ * Copyright (C) 2007-2008, 2011 Texas Instruments, Inc.
  * Copyright (C) 2007-2011 Nokia Corporation
  *
  * Written by Paul Walmsley
@@ -77,13 +77,11 @@ static struct powerdomain *_pwrdm_lookup(const char *name)
 static int _pwrdm_register(struct powerdomain *pwrdm)
 {
        int i;
+       struct voltagedomain *voltdm;
 
        if (!pwrdm || !pwrdm->name)
                return -EINVAL;
 
-       if (!omap_chip_is(pwrdm->omap_chip))
-               return -EINVAL;
-
        if (cpu_is_omap44xx() &&
            pwrdm->prcm_partition == OMAP4430_INVALID_PRCM_PARTITION) {
                pr_err("powerdomain: %s: missing OMAP4 PRCM partition ID\n",
@@ -94,6 +92,16 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
        if (_pwrdm_lookup(pwrdm->name))
                return -EEXIST;
 
+       voltdm = voltdm_lookup(pwrdm->voltdm.name);
+       if (!voltdm) {
+               pr_err("powerdomain: %s: voltagedomain %s does not exist\n",
+                      pwrdm->name, pwrdm->voltdm.name);
+               return -EINVAL;
+       }
+       pwrdm->voltdm.ptr = voltdm;
+       INIT_LIST_HEAD(&pwrdm->voltdm_node);
+       voltdm_add_pwrdm(voltdm, pwrdm);
+
        list_add(&pwrdm->node, &pwrdm_list);
 
        /* Initialize the powerdomain's state counter */
@@ -194,36 +202,76 @@ static int _pwrdm_post_transition_cb(struct powerdomain *pwrdm, void *unused)
 /* Public functions */
 
 /**
- * pwrdm_init - set up the powerdomain layer
- * @pwrdms: array of struct powerdomain pointers to register
- * @custom_funcs: func pointers for arch specific implementations
+ * pwrdm_register_platform_funcs - register powerdomain implementation fns
+ * @po: func pointers for arch specific implementations
  *
- * Loop through the array of powerdomains @pwrdms, registering all
- * that are available on the current CPU.  Also, program all
- * powerdomain target state as ON; this is to prevent domains from
- * hitting low power states (if bootloader has target states set to
- * something other than ON) and potentially even losing context while
- * PM is not fully initialized.  The PM late init code can then program
- * the desired target state for all the power domains.  No return
- * value.
+ * Register the list of function pointers used to implement the
+ * powerdomain functions on different OMAP SoCs.  Should be called
+ * before any other pwrdm_register*() function.  Returns -EINVAL if
+ * @po is null, -EEXIST if platform functions have already been
+ * registered, or 0 upon success.
  */
-void pwrdm_init(struct powerdomain **pwrdms, struct pwrdm_ops *custom_funcs)
+int pwrdm_register_platform_funcs(struct pwrdm_ops *po)
+{
+       if (!po)
+               return -EINVAL;
+
+       if (arch_pwrdm)
+               return -EEXIST;
+
+       arch_pwrdm = po;
+
+       return 0;
+}
+
+/**
+ * pwrdm_register_pwrdms - register SoC powerdomains
+ * @ps: pointer to an array of struct powerdomain to register
+ *
+ * Register the powerdomains available on a particular OMAP SoC.  Must
+ * be called after pwrdm_register_platform_funcs().  May be called
+ * multiple times.  Returns -EACCES if called before
+ * pwrdm_register_platform_funcs(); -EINVAL if the argument @ps is
+ * null; or 0 upon success.
+ */
+int pwrdm_register_pwrdms(struct powerdomain **ps)
 {
        struct powerdomain **p = NULL;
-       struct powerdomain *temp_p;
 
-       if (!custom_funcs)
-               WARN(1, "powerdomain: No custom pwrdm functions registered\n");
-       else
-               arch_pwrdm = custom_funcs;
+       if (!arch_pwrdm)
+               return -EEXIST;
 
-       if (pwrdms) {
-               for (p = pwrdms; *p; p++)
-                       _pwrdm_register(*p);
-       }
+       if (!ps)
+               return -EINVAL;
+
+       for (p = ps; *p; p++)
+               _pwrdm_register(*p);
+
+       return 0;
+}
+
+/**
+ * pwrdm_complete_init - set up the powerdomain layer
+ *
+ * Do whatever is necessary to initialize registered powerdomains and
+ * powerdomain code.  Currently, this programs the next power state
+ * for each powerdomain to ON.  This prevents powerdomains from
+ * unexpectedly losing context or entering high wakeup latency modes
+ * with non-power-management-enabled kernels.  Must be called after
+ * pwrdm_register_pwrdms().  Returns -EACCES if called before
+ * pwrdm_register_pwrdms(), or 0 upon success.
+ */
+int pwrdm_complete_init(void)
+{
+       struct powerdomain *temp_p;
+
+       if (list_empty(&pwrdm_list))
+               return -EACCES;
 
        list_for_each_entry(temp_p, &pwrdm_list, node)
                pwrdm_set_next_pwrst(temp_p, PWRDM_POWER_ON);
+
+       return 0;
 }
 
 /**
@@ -389,6 +437,18 @@ int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
        return ret;
 }
 
+/**
+ * pwrdm_get_voltdm - return a ptr to the voltdm that this pwrdm resides in
+ * @pwrdm: struct powerdomain *
+ *
+ * Return a pointer to the struct voltageomain that the specified powerdomain
+ * @pwrdm exists in.
+ */
+struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm)
+{
+       return pwrdm->voltdm.ptr;
+}
+
 /**
  * pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain
  * @pwrdm: struct powerdomain *
index d23d979b9c34ef9fd11c7163224f59dd8e0b0368..42e6dd8f2a78dd37521f06780cc76bb5050b01de 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <plat/cpu.h>
 
+#include "voltage.h"
+
 /* Powerdomain basic power states */
 #define PWRDM_POWER_OFF                0x0
 #define PWRDM_POWER_RET                0x1
@@ -78,7 +80,7 @@ struct powerdomain;
 /**
  * struct powerdomain - OMAP powerdomain
  * @name: Powerdomain name
- * @omap_chip: represents the OMAP chip types containing this pwrdm
+ * @voltdm: voltagedomain containing this powerdomain
  * @prcm_offs: the address offset from CM_BASE/PRM_BASE
  * @prcm_partition: (OMAP4 only) the PRCM partition ID containing @prcm_offs
  * @pwrsts: Possible powerdomain power states
@@ -89,6 +91,7 @@ struct powerdomain;
  * @pwrsts_mem_on: Possible memory bank pwrstates when pwrdm in ON
  * @pwrdm_clkdms: Clockdomains in this powerdomain
  * @node: list_head linking all powerdomains
+ * @voltdm_node: list_head linking all powerdomains in a voltagedomain
  * @state:
  * @state_counter:
  * @timer:
@@ -98,7 +101,10 @@ struct powerdomain;
  */
 struct powerdomain {
        const char *name;
-       const struct omap_chip_id omap_chip;
+       union {
+               const char *name;
+               struct voltagedomain *ptr;
+       } voltdm;
        const s16 prcm_offs;
        const u8 pwrsts;
        const u8 pwrsts_logic_ret;
@@ -109,6 +115,7 @@ struct powerdomain {
        const u8 prcm_partition;
        struct clockdomain *pwrdm_clkdms[PWRDM_MAX_CLKDMS];
        struct list_head node;
+       struct list_head voltdm_node;
        int state;
        unsigned state_counter[PWRDM_MAX_PWRSTS];
        unsigned ret_logic_off_counter;
@@ -162,7 +169,9 @@ struct pwrdm_ops {
        int     (*pwrdm_wait_transition)(struct powerdomain *pwrdm);
 };
 
-void pwrdm_init(struct powerdomain **pwrdm_list, struct pwrdm_ops *custom_funcs);
+int pwrdm_register_platform_funcs(struct pwrdm_ops *custom_funcs);
+int pwrdm_register_pwrdms(struct powerdomain **pwrdm_list);
+int pwrdm_complete_init(void);
 
 struct powerdomain *pwrdm_lookup(const char *name);
 
@@ -176,6 +185,7 @@ int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm);
 int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
                         int (*fn)(struct powerdomain *pwrdm,
                                   struct clockdomain *clkdm));
+struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm);
 
 int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm);
 
@@ -210,7 +220,8 @@ int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm);
 u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm);
 bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm);
 
-extern void omap2xxx_powerdomains_init(void);
+extern void omap242x_powerdomains_init(void);
+extern void omap243x_powerdomains_init(void);
 extern void omap3xxx_powerdomains_init(void);
 extern void omap44xx_powerdomains_init(void);
 
index cf600e22bf8e723668dc9a20c893e163d6f5c76a..6a17e4ca1d793817a96f870e70a3b87e73d0ca8a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP2 and OMAP3 powerdomain control
  *
- * Copyright (C) 2009-2010 Texas Instruments, Inc.
+ * Copyright (C) 2009-2011 Texas Instruments, Inc.
  * Copyright (C) 2007-2009 Nokia Corporation
  *
  * Derived from mach-omap2/powerdomain.c written by Paul Walmsley
index 4210c33997697ab8f72636de6fdf72d19d6c803b..d3a5399091ad35817267c75ea008d060f0962e9a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP2/3 common powerdomain definitions
  *
- * Copyright (C) 2007-2008 Texas Instruments, Inc.
+ * Copyright (C) 2007-2008, 2011 Texas Instruments, Inc.
  * Copyright (C) 2007-2011 Nokia Corporation
  *
  * Paul Walmsley, Jouni Högander
  * published by the Free Software Foundation.
  */
 
-/*
- * To Do List
- * -> Move the Sleep/Wakeup dependencies from Power Domain framework to
- *    Clock Domain Framework
- */
-
-/*
- * This file contains all of the powerdomains that have some element
- * of software control for the OMAP24xx and OMAP34xx chips.
- *
- * This is not an exhaustive listing of powerdomains on the chips; only
- * powerdomains that can be controlled in software.
- */
-
 /*
  * The names for the DSP/IVA2 powerdomains are confusing.
  *
@@ -59,8 +45,6 @@
 struct powerdomain gfx_omap2_pwrdm = {
        .name             = "gfx_pwrdm",
        .prcm_offs        = GFX_MOD,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX |
-                                          CHIP_IS_OMAP3430ES1),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_RET,
        .banks            = 1,
@@ -70,11 +54,12 @@ struct powerdomain gfx_omap2_pwrdm = {
        .pwrsts_mem_on    = {
                [0] = PWRSTS_ON,  /* MEMONSTATE */
        },
+       .voltdm           = { .name = "core" },
 };
 
 struct powerdomain wkup_omap2_pwrdm = {
        .name           = "wkup_pwrdm",
        .prcm_offs      = WKUP_MOD,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430),
        .pwrsts         = PWRSTS_ON,
+       .voltdm         = { .name = "wakeup" },
 };
index cc389fb2005d9c15ca54ca9430a5c23944d548c9..2385c1f009ee32338db1508a71863801dbd6e60c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP2XXX powerdomain definitions
  *
- * Copyright (C) 2007-2008 Texas Instruments, Inc.
+ * Copyright (C) 2007-2008, 2011 Texas Instruments, Inc.
  * Copyright (C) 2007-2011 Nokia Corporation
  *
  * Paul Walmsley, Jouni Högander
@@ -28,7 +28,6 @@
 static struct powerdomain dsp_pwrdm = {
        .name             = "dsp_pwrdm",
        .prcm_offs        = OMAP24XX_DSP_MOD,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_RET,
        .banks            = 1,
@@ -38,12 +37,12 @@ static struct powerdomain dsp_pwrdm = {
        .pwrsts_mem_on    = {
                [0] = PWRSTS_ON,
        },
+       .voltdm           = { .name = "core" },
 };
 
 static struct powerdomain mpu_24xx_pwrdm = {
        .name             = "mpu_pwrdm",
        .prcm_offs        = MPU_MOD,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_OFF_RET,
        .banks            = 1,
@@ -53,12 +52,12 @@ static struct powerdomain mpu_24xx_pwrdm = {
        .pwrsts_mem_on    = {
                [0] = PWRSTS_ON,
        },
+       .voltdm           = { .name = "core" },
 };
 
 static struct powerdomain core_24xx_pwrdm = {
        .name             = "core_pwrdm",
        .prcm_offs        = CORE_MOD,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .banks            = 3,
        .pwrsts_mem_ret   = {
@@ -71,6 +70,7 @@ static struct powerdomain core_24xx_pwrdm = {
                [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
                [2] = PWRSTS_OFF_RET_ON, /* MEM3ONSTATE */
        },
+       .voltdm           = { .name = "core" },
 };
 
 
@@ -78,14 +78,11 @@ static struct powerdomain core_24xx_pwrdm = {
  * 2430-specific powerdomains
  */
 
-#ifdef CONFIG_SOC_OMAP2430
-
 /* XXX 2430 KILLDOMAINWKUP bit?  No current users apparently */
 
 static struct powerdomain mdm_pwrdm = {
        .name             = "mdm_pwrdm",
        .prcm_offs        = OMAP2430_MDM_MOD,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_RET,
        .banks            = 1,
@@ -95,29 +92,44 @@ static struct powerdomain mdm_pwrdm = {
        .pwrsts_mem_on    = {
                [0] = PWRSTS_ON,  /* MEMONSTATE */
        },
+       .voltdm           = { .name = "core" },
 };
 
-#endif     /* CONFIG_SOC_OMAP2430 */
-
-/* As powerdomains are added or removed above, this list must also be changed */
-static struct powerdomain *powerdomains_omap2xxx[] __initdata = {
+/*
+ *
+ */
 
+static struct powerdomain *powerdomains_omap24xx[] __initdata = {
        &wkup_omap2_pwrdm,
        &gfx_omap2_pwrdm,
-
-#ifdef CONFIG_ARCH_OMAP2
        &dsp_pwrdm,
        &mpu_24xx_pwrdm,
        &core_24xx_pwrdm,
-#endif
+       NULL
+};
 
-#ifdef CONFIG_SOC_OMAP2430
+static struct powerdomain *powerdomains_omap2430[] __initdata = {
        &mdm_pwrdm,
-#endif
        NULL
 };
 
-void __init omap2xxx_powerdomains_init(void)
+void __init omap242x_powerdomains_init(void)
+{
+       if (!cpu_is_omap2420())
+               return;
+
+       pwrdm_register_platform_funcs(&omap2_pwrdm_operations);
+       pwrdm_register_pwrdms(powerdomains_omap24xx);
+       pwrdm_complete_init();
+}
+
+void __init omap243x_powerdomains_init(void)
 {
-       pwrdm_init(powerdomains_omap2xxx, &omap2_pwrdm_operations);
+       if (!cpu_is_omap2430())
+               return;
+
+       pwrdm_register_platform_funcs(&omap2_pwrdm_operations);
+       pwrdm_register_pwrdms(powerdomains_omap24xx);
+       pwrdm_register_pwrdms(powerdomains_omap2430);
+       pwrdm_complete_init();
 }
index 469a920a74dc42c9692c77e94e33c37a900aa429..8ef26daeed68f966b64fb410e346dc073e940fe3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP3 powerdomain definitions
  *
- * Copyright (C) 2007-2008 Texas Instruments, Inc.
+ * Copyright (C) 2007-2008, 2011 Texas Instruments, Inc.
  * Copyright (C) 2007-2011 Nokia Corporation
  *
  * Paul Walmsley, Jouni Högander
@@ -14,6 +14,8 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 
+#include <plat/cpu.h>
+
 #include "powerdomain.h"
 #include "powerdomains2xxx_3xxx_data.h"
 
@@ -27,8 +29,6 @@
  * 34XX-specific powerdomains, dependencies
  */
 
-#ifdef CONFIG_ARCH_OMAP3
-
 /*
  * Powerdomains
  */
@@ -36,7 +36,6 @@
 static struct powerdomain iva2_pwrdm = {
        .name             = "iva2_pwrdm",
        .prcm_offs        = OMAP3430_IVA2_MOD,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_OFF_RET,
        .banks            = 4,
@@ -52,12 +51,12 @@ static struct powerdomain iva2_pwrdm = {
                [2] = PWRSTS_OFF_ON,
                [3] = PWRSTS_ON,
        },
+       .voltdm           = { .name = "mpu_iva" },
 };
 
 static struct powerdomain mpu_3xxx_pwrdm = {
        .name             = "mpu_pwrdm",
        .prcm_offs        = MPU_MOD,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_OFF_RET,
        .flags            = PWRDM_HAS_MPU_QUIRK,
@@ -68,6 +67,7 @@ static struct powerdomain mpu_3xxx_pwrdm = {
        .pwrsts_mem_on    = {
                [0] = PWRSTS_OFF_ON,
        },
+       .voltdm           = { .name = "mpu_iva" },
 };
 
 /*
@@ -83,10 +83,6 @@ static struct powerdomain mpu_3xxx_pwrdm = {
 static struct powerdomain core_3xxx_pre_es3_1_pwrdm = {
        .name             = "core_pwrdm",
        .prcm_offs        = CORE_MOD,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1 |
-                                          CHIP_IS_OMAP3430ES2 |
-                                          CHIP_IS_OMAP3430ES3_0 |
-                                          CHIP_IS_OMAP3630ES1),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_OFF_RET,
        .banks            = 2,
@@ -98,13 +94,12 @@ static struct powerdomain core_3xxx_pre_es3_1_pwrdm = {
                [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
                [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
        },
+       .voltdm           = { .name = "core" },
 };
 
 static struct powerdomain core_3xxx_es3_1_pwrdm = {
        .name             = "core_pwrdm",
        .prcm_offs        = CORE_MOD,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES3_1 |
-                                         CHIP_GE_OMAP3630ES1_1),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_OFF_RET,
        /*
@@ -121,11 +116,11 @@ static struct powerdomain core_3xxx_es3_1_pwrdm = {
                [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
                [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
        },
+       .voltdm           = { .name = "core" },
 };
 
 static struct powerdomain dss_pwrdm = {
        .name             = "dss_pwrdm",
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
        .prcm_offs        = OMAP3430_DSS_MOD,
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_RET,
@@ -136,6 +131,7 @@ static struct powerdomain dss_pwrdm = {
        .pwrsts_mem_on    = {
                [0] = PWRSTS_ON,  /* MEMONSTATE */
        },
+       .voltdm           = { .name = "core" },
 };
 
 /*
@@ -146,7 +142,6 @@ static struct powerdomain dss_pwrdm = {
 static struct powerdomain sgx_pwrdm = {
        .name             = "sgx_pwrdm",
        .prcm_offs        = OMAP3430ES2_SGX_MOD,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
        /* XXX This is accurate for 3430 SGX, but what about GFX? */
        .pwrsts           = PWRSTS_OFF_ON,
        .pwrsts_logic_ret = PWRSTS_RET,
@@ -157,11 +152,11 @@ static struct powerdomain sgx_pwrdm = {
        .pwrsts_mem_on    = {
                [0] = PWRSTS_ON,  /* MEMONSTATE */
        },
+       .voltdm           = { .name = "core" },
 };
 
 static struct powerdomain cam_pwrdm = {
        .name             = "cam_pwrdm",
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
        .prcm_offs        = OMAP3430_CAM_MOD,
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_RET,
@@ -172,12 +167,12 @@ static struct powerdomain cam_pwrdm = {
        .pwrsts_mem_on    = {
                [0] = PWRSTS_ON,  /* MEMONSTATE */
        },
+       .voltdm           = { .name = "core" },
 };
 
 static struct powerdomain per_pwrdm = {
        .name             = "per_pwrdm",
        .prcm_offs        = OMAP3430_PER_MOD,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_OFF_RET,
        .banks            = 1,
@@ -187,26 +182,26 @@ static struct powerdomain per_pwrdm = {
        .pwrsts_mem_on    = {
                [0] = PWRSTS_ON,  /* MEMONSTATE */
        },
+       .voltdm           = { .name = "core" },
 };
 
 static struct powerdomain emu_pwrdm = {
        .name           = "emu_pwrdm",
        .prcm_offs      = OMAP3430_EMU_MOD,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+       .voltdm           = { .name = "core" },
 };
 
 static struct powerdomain neon_pwrdm = {
        .name             = "neon_pwrdm",
        .prcm_offs        = OMAP3430_NEON_MOD,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_RET,
+       .voltdm           = { .name = "mpu_iva" },
 };
 
 static struct powerdomain usbhost_pwrdm = {
        .name             = "usbhost_pwrdm",
        .prcm_offs        = OMAP3430ES2_USBHOST_MOD,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_RET,
        /*
@@ -223,65 +218,103 @@ static struct powerdomain usbhost_pwrdm = {
        .pwrsts_mem_on    = {
                [0] = PWRSTS_ON,  /* MEMONSTATE */
        },
+       .voltdm           = { .name = "core" },
 };
 
 static struct powerdomain dpll1_pwrdm = {
        .name           = "dpll1_pwrdm",
        .prcm_offs      = MPU_MOD,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+       .voltdm           = { .name = "mpu_iva" },
 };
 
 static struct powerdomain dpll2_pwrdm = {
        .name           = "dpll2_pwrdm",
        .prcm_offs      = OMAP3430_IVA2_MOD,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+       .voltdm           = { .name = "mpu_iva" },
 };
 
 static struct powerdomain dpll3_pwrdm = {
        .name           = "dpll3_pwrdm",
        .prcm_offs      = PLL_MOD,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+       .voltdm           = { .name = "core" },
 };
 
 static struct powerdomain dpll4_pwrdm = {
        .name           = "dpll4_pwrdm",
        .prcm_offs      = PLL_MOD,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+       .voltdm           = { .name = "core" },
 };
 
 static struct powerdomain dpll5_pwrdm = {
        .name           = "dpll5_pwrdm",
        .prcm_offs      = PLL_MOD,
-       .omap_chip      = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
+       .voltdm           = { .name = "core" },
 };
 
 /* As powerdomains are added or removed above, this list must also be changed */
-static struct powerdomain *powerdomains_omap3xxx[] __initdata = {
-
+static struct powerdomain *powerdomains_omap3430_common[] __initdata = {
        &wkup_omap2_pwrdm,
-       &gfx_omap2_pwrdm,
        &iva2_pwrdm,
        &mpu_3xxx_pwrdm,
        &neon_pwrdm,
-       &core_3xxx_pre_es3_1_pwrdm,
-       &core_3xxx_es3_1_pwrdm,
        &cam_pwrdm,
        &dss_pwrdm,
        &per_pwrdm,
        &emu_pwrdm,
-       &sgx_pwrdm,
-       &usbhost_pwrdm,
        &dpll1_pwrdm,
        &dpll2_pwrdm,
        &dpll3_pwrdm,
        &dpll4_pwrdm,
+       NULL
+};
+
+static struct powerdomain *powerdomains_omap3430es1[] __initdata = {
+       &gfx_omap2_pwrdm,
+       &core_3xxx_pre_es3_1_pwrdm,
+       NULL
+};
+
+/* also includes 3630ES1.0 */
+static struct powerdomain *powerdomains_omap3430es2_es3_0[] __initdata = {
+       &core_3xxx_pre_es3_1_pwrdm,
+       &sgx_pwrdm,
+       &usbhost_pwrdm,
        &dpll5_pwrdm,
-#endif
        NULL
 };
 
+/* also includes 3630ES1.1+ */
+static struct powerdomain *powerdomains_omap3430es3_1plus[] __initdata = {
+       &core_3xxx_es3_1_pwrdm,
+       &sgx_pwrdm,
+       &usbhost_pwrdm,
+       &dpll5_pwrdm,
+       NULL
+};
 
 void __init omap3xxx_powerdomains_init(void)
 {
-       pwrdm_init(powerdomains_omap3xxx, &omap3_pwrdm_operations);
+       unsigned int rev;
+
+       if (!cpu_is_omap34xx())
+               return;
+
+       pwrdm_register_platform_funcs(&omap3_pwrdm_operations);
+       pwrdm_register_pwrdms(powerdomains_omap3430_common);
+
+       rev = omap_rev();
+
+       if (rev == OMAP3430_REV_ES1_0)
+               pwrdm_register_pwrdms(powerdomains_omap3430es1);
+       else if (rev == OMAP3430_REV_ES2_0 || rev == OMAP3430_REV_ES2_1 ||
+                rev == OMAP3430_REV_ES3_0 || rev == OMAP3630_REV_ES1_0)
+               pwrdm_register_pwrdms(powerdomains_omap3430es2_es3_0);
+       else if (rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2 ||
+                rev == OMAP3517_REV_ES1_0 || rev == OMAP3517_REV_ES1_1 ||
+                rev == OMAP3630_REV_ES1_1 || rev == OMAP3630_REV_ES1_2)
+               pwrdm_register_pwrdms(powerdomains_omap3430es3_1plus);
+       else
+               WARN(1, "OMAP3 powerdomain init: unknown chip type\n");
+
+       pwrdm_complete_init();
 }
index 247e79495115e45e43153163b08aa9e31c054cdb..704664c0e2594ddb82a02fdba2ae9375b58c7257 100644 (file)
@@ -33,9 +33,9 @@
 /* core_44xx_pwrdm: CORE power domain */
 static struct powerdomain core_44xx_pwrdm = {
        .name             = "core_pwrdm",
+       .voltdm           = { .name = "core" },
        .prcm_offs        = OMAP4430_PRM_CORE_INST,
        .prcm_partition   = OMAP4430_PRM_PARTITION,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
        .pwrsts           = PWRSTS_RET_ON,
        .pwrsts_logic_ret = PWRSTS_OFF_RET,
        .banks            = 5,
@@ -59,9 +59,9 @@ static struct powerdomain core_44xx_pwrdm = {
 /* gfx_44xx_pwrdm: 3D accelerator power domain */
 static struct powerdomain gfx_44xx_pwrdm = {
        .name             = "gfx_pwrdm",
+       .voltdm           = { .name = "core" },
        .prcm_offs        = OMAP4430_PRM_GFX_INST,
        .prcm_partition   = OMAP4430_PRM_PARTITION,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
        .pwrsts           = PWRSTS_OFF_ON,
        .banks            = 1,
        .pwrsts_mem_ret = {
@@ -76,9 +76,9 @@ static struct powerdomain gfx_44xx_pwrdm = {
 /* abe_44xx_pwrdm: Audio back end power domain */
 static struct powerdomain abe_44xx_pwrdm = {
        .name             = "abe_pwrdm",
+       .voltdm           = { .name = "iva" },
        .prcm_offs        = OMAP4430_PRM_ABE_INST,
        .prcm_partition   = OMAP4430_PRM_PARTITION,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_OFF,
        .banks            = 2,
@@ -96,9 +96,9 @@ static struct powerdomain abe_44xx_pwrdm = {
 /* dss_44xx_pwrdm: Display subsystem power domain */
 static struct powerdomain dss_44xx_pwrdm = {
        .name             = "dss_pwrdm",
+       .voltdm           = { .name = "core" },
        .prcm_offs        = OMAP4430_PRM_DSS_INST,
        .prcm_partition   = OMAP4430_PRM_PARTITION,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_OFF,
        .banks            = 1,
@@ -114,9 +114,9 @@ static struct powerdomain dss_44xx_pwrdm = {
 /* tesla_44xx_pwrdm: Tesla processor power domain */
 static struct powerdomain tesla_44xx_pwrdm = {
        .name             = "tesla_pwrdm",
+       .voltdm           = { .name = "iva" },
        .prcm_offs        = OMAP4430_PRM_TESLA_INST,
        .prcm_partition   = OMAP4430_PRM_PARTITION,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_OFF_RET,
        .banks            = 3,
@@ -136,9 +136,9 @@ static struct powerdomain tesla_44xx_pwrdm = {
 /* wkup_44xx_pwrdm: Wake-up power domain */
 static struct powerdomain wkup_44xx_pwrdm = {
        .name             = "wkup_pwrdm",
+       .voltdm           = { .name = "wakeup" },
        .prcm_offs        = OMAP4430_PRM_WKUP_INST,
        .prcm_partition   = OMAP4430_PRM_PARTITION,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
        .pwrsts           = PWRSTS_ON,
        .banks            = 1,
        .pwrsts_mem_ret = {
@@ -152,9 +152,9 @@ static struct powerdomain wkup_44xx_pwrdm = {
 /* cpu0_44xx_pwrdm: MPU0 processor and Neon coprocessor power domain */
 static struct powerdomain cpu0_44xx_pwrdm = {
        .name             = "cpu0_pwrdm",
+       .voltdm           = { .name = "mpu" },
        .prcm_offs        = OMAP4430_PRCM_MPU_CPU0_INST,
        .prcm_partition   = OMAP4430_PRCM_MPU_PARTITION,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_OFF_RET,
        .banks            = 1,
@@ -169,9 +169,9 @@ static struct powerdomain cpu0_44xx_pwrdm = {
 /* cpu1_44xx_pwrdm: MPU1 processor and Neon coprocessor power domain */
 static struct powerdomain cpu1_44xx_pwrdm = {
        .name             = "cpu1_pwrdm",
+       .voltdm           = { .name = "mpu" },
        .prcm_offs        = OMAP4430_PRCM_MPU_CPU1_INST,
        .prcm_partition   = OMAP4430_PRCM_MPU_PARTITION,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_OFF_RET,
        .banks            = 1,
@@ -186,9 +186,9 @@ static struct powerdomain cpu1_44xx_pwrdm = {
 /* emu_44xx_pwrdm: Emulation power domain */
 static struct powerdomain emu_44xx_pwrdm = {
        .name             = "emu_pwrdm",
+       .voltdm           = { .name = "wakeup" },
        .prcm_offs        = OMAP4430_PRM_EMU_INST,
        .prcm_partition   = OMAP4430_PRM_PARTITION,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
        .pwrsts           = PWRSTS_OFF_ON,
        .banks            = 1,
        .pwrsts_mem_ret = {
@@ -202,9 +202,9 @@ static struct powerdomain emu_44xx_pwrdm = {
 /* mpu_44xx_pwrdm: Modena processor and the Neon coprocessor power domain */
 static struct powerdomain mpu_44xx_pwrdm = {
        .name             = "mpu_pwrdm",
+       .voltdm           = { .name = "mpu" },
        .prcm_offs        = OMAP4430_PRM_MPU_INST,
        .prcm_partition   = OMAP4430_PRM_PARTITION,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
        .pwrsts           = PWRSTS_RET_ON,
        .pwrsts_logic_ret = PWRSTS_OFF_RET,
        .banks            = 3,
@@ -223,9 +223,9 @@ static struct powerdomain mpu_44xx_pwrdm = {
 /* ivahd_44xx_pwrdm: IVA-HD power domain */
 static struct powerdomain ivahd_44xx_pwrdm = {
        .name             = "ivahd_pwrdm",
+       .voltdm           = { .name = "iva" },
        .prcm_offs        = OMAP4430_PRM_IVAHD_INST,
        .prcm_partition   = OMAP4430_PRM_PARTITION,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
        .pwrsts           = PWRSTS_OFF_RET_ON,
        .pwrsts_logic_ret = PWRSTS_OFF,
        .banks            = 4,
@@ -247,9 +247,9 @@ static struct powerdomain ivahd_44xx_pwrdm = {
 /* cam_44xx_pwrdm: Camera subsystem power domain */
 static struct powerdomain cam_44xx_pwrdm = {
        .name             = "cam_pwrdm",
+       .voltdm           = { .name = "core" },
        .prcm_offs        = OMAP4430_PRM_CAM_INST,
        .prcm_partition   = OMAP4430_PRM_PARTITION,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
        .pwrsts           = PWRSTS_OFF_ON,
        .banks            = 1,
        .pwrsts_mem_ret = {
@@ -264,9 +264,9 @@ static struct powerdomain cam_44xx_pwrdm = {
 /* l3init_44xx_pwrdm: L3 initators pheripherals power domain  */
 static struct powerdomain l3init_44xx_pwrdm = {
        .name             = "l3init_pwrdm",
+       .voltdm           = { .name = "core" },
        .prcm_offs        = OMAP4430_PRM_L3INIT_INST,
        .prcm_partition   = OMAP4430_PRM_PARTITION,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
        .pwrsts           = PWRSTS_RET_ON,
        .pwrsts_logic_ret = PWRSTS_OFF_RET,
        .banks            = 1,
@@ -282,9 +282,9 @@ static struct powerdomain l3init_44xx_pwrdm = {
 /* l4per_44xx_pwrdm: Target peripherals power domain */
 static struct powerdomain l4per_44xx_pwrdm = {
        .name             = "l4per_pwrdm",
+       .voltdm           = { .name = "core" },
        .prcm_offs        = OMAP4430_PRM_L4PER_INST,
        .prcm_partition   = OMAP4430_PRM_PARTITION,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
        .pwrsts           = PWRSTS_RET_ON,
        .pwrsts_logic_ret = PWRSTS_OFF_RET,
        .banks            = 2,
@@ -305,18 +305,18 @@ static struct powerdomain l4per_44xx_pwrdm = {
  */
 static struct powerdomain always_on_core_44xx_pwrdm = {
        .name             = "always_on_core_pwrdm",
+       .voltdm           = { .name = "core" },
        .prcm_offs        = OMAP4430_PRM_ALWAYS_ON_INST,
        .prcm_partition   = OMAP4430_PRM_PARTITION,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
        .pwrsts           = PWRSTS_ON,
 };
 
 /* cefuse_44xx_pwrdm: Customer efuse controller power domain */
 static struct powerdomain cefuse_44xx_pwrdm = {
        .name             = "cefuse_pwrdm",
+       .voltdm           = { .name = "core" },
        .prcm_offs        = OMAP4430_PRM_CEFUSE_INST,
        .prcm_partition   = OMAP4430_PRM_PARTITION,
-       .omap_chip        = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
        .pwrsts           = PWRSTS_OFF_ON,
        .flags            = PWRDM_HAS_LOWPOWERSTATECHANGE,
 };
@@ -352,5 +352,7 @@ static struct powerdomain *powerdomains_omap44xx[] __initdata = {
 
 void __init omap44xx_powerdomains_init(void)
 {
-       pwrdm_init(powerdomains_omap44xx, &omap4_pwrdm_operations);
+       pwrdm_register_platform_funcs(&omap4_pwrdm_operations);
+       pwrdm_register_pwrdms(powerdomains_omap44xx);
+       pwrdm_complete_init();
 }
index 051213fbc346a43cb6c91e65cdb640a5a3e60bc4..f02d87f68e5415ddefa5df4b00f0e88d085b4058 100644 (file)
@@ -20,6 +20,8 @@
 #include <plat/cpu.h>
 #include <plat/prcm.h>
 
+#include "vp.h"
+
 #include "prm2xxx_3xxx.h"
 #include "cm2xxx_3xxx.h"
 #include "prm-regbits-24xx.h"
@@ -156,3 +158,57 @@ 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;
+}
+
+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);
+}
index a1fc62a39dbb19f4cff44ad343bfc2f830b0ef3c..cef533df0861e6740206df9eb142987e8362cf55 100644 (file)
@@ -303,7 +303,19 @@ 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);
 #endif /* CONFIG_ARCH_OMAP4 */
+
 #endif
 
 /*
index 00165558fc4dab9c016bf80d4d69928e78f9aabf..495a31a7e8a7534cd3fdfca70b6a4e99686e4f6b 100644 (file)
 #include <plat/cpu.h>
 #include <plat/prcm.h>
 
+#include "vp.h"
 #include "prm44xx.h"
 #include "prm-regbits-44xx.h"
+#include "prcm44xx.h"
+#include "prminst44xx.h"
 
 /* PRM low-level functions */
 
@@ -50,3 +53,71 @@ u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
 
        return v;
 }
+
+/* PRM VP */
+
+/*
+ * struct omap4_vp - OMAP4 VP register access description.
+ * @irqstatus_mpu: offset to IRQSTATUS_MPU register for VP
+ * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
+ */
+struct omap4_vp {
+       u32 irqstatus_mpu;
+       u32 tranxdone_status;
+};
+
+static struct omap4_vp omap4_vp[] = {
+       [OMAP4_VP_VDD_MPU_ID] = {
+               .irqstatus_mpu = OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET,
+               .tranxdone_status = OMAP4430_VP_MPU_TRANXDONE_ST_MASK,
+       },
+       [OMAP4_VP_VDD_IVA_ID] = {
+               .irqstatus_mpu = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
+               .tranxdone_status = OMAP4430_VP_IVA_TRANXDONE_ST_MASK,
+       },
+       [OMAP4_VP_VDD_CORE_ID] = {
+               .irqstatus_mpu = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
+               .tranxdone_status = OMAP4430_VP_CORE_TRANXDONE_ST_MASK,
+       },
+};
+
+u32 omap4_prm_vp_check_txdone(u8 vp_id)
+{
+       struct omap4_vp *vp = &omap4_vp[vp_id];
+       u32 irqstatus;
+
+       irqstatus = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
+                                               OMAP4430_PRM_OCP_SOCKET_INST,
+                                               vp->irqstatus_mpu);
+       return irqstatus & vp->tranxdone_status;
+}
+
+void omap4_prm_vp_clear_txdone(u8 vp_id)
+{
+       struct omap4_vp *vp = &omap4_vp[vp_id];
+
+       omap4_prminst_write_inst_reg(vp->tranxdone_status,
+                                    OMAP4430_PRM_PARTITION,
+                                    OMAP4430_PRM_OCP_SOCKET_INST,
+                                    vp->irqstatus_mpu);
+};
+
+u32 omap4_prm_vcvp_read(u8 offset)
+{
+       return omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
+                                          OMAP4430_PRM_DEVICE_INST, offset);
+}
+
+void omap4_prm_vcvp_write(u32 val, u8 offset)
+{
+       omap4_prminst_write_inst_reg(val, OMAP4430_PRM_PARTITION,
+                                    OMAP4430_PRM_DEVICE_INST, offset);
+}
+
+u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset)
+{
+       return omap4_prminst_rmw_inst_reg_bits(mask, bits,
+                                              OMAP4430_PRM_PARTITION,
+                                              OMAP4430_PRM_DEVICE_INST,
+                                              offset);
+}
index 7dfa379b625d987820abcb4ad66e510856b07e61..3d66ccd849d2bcf6fb8550bb848cf692ba24adbf 100644 (file)
@@ -751,6 +751,18 @@ extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx);
 extern void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 idx);
 extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
 
+/* OMAP4-specific VP functions */
+u32 omap4_prm_vp_check_txdone(u8 vp_id);
+void omap4_prm_vp_clear_txdone(u8 vp_id);
+
+/*
+ * OMAP4 access functions for voltage controller (VC) and
+ * voltage proccessor (VP) in the PRM.
+ */
+extern u32 omap4_prm_vcvp_read(u8 offset);
+extern void omap4_prm_vcvp_write(u32 val, u8 offset);
+extern u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
+
 # endif
 
 #endif
index 466fc722fa0f39f03b8d93cf84e4dae4f57fd029..9992dbfdfdb31deffcfbb0e01c5ebe19558f753d 100644 (file)
@@ -107,28 +107,6 @@ struct omap_uart_state {
 static LIST_HEAD(uart_list);
 static u8 num_uarts;
 
-static int uart_idle_hwmod(struct omap_device *od)
-{
-       omap_hwmod_idle(od->hwmods[0]);
-
-       return 0;
-}
-
-static int uart_enable_hwmod(struct omap_device *od)
-{
-       omap_hwmod_enable(od->hwmods[0]);
-
-       return 0;
-}
-
-static struct omap_device_pm_latency omap_uart_latency[] = {
-       {
-               .deactivate_func = uart_idle_hwmod,
-               .activate_func   = uart_enable_hwmod,
-               .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-       },
-};
-
 static inline unsigned int __serial_read_reg(struct uart_port *up,
                                             int offset)
 {
@@ -711,7 +689,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
 {
        struct omap_uart_state *uart;
        struct omap_hwmod *oh;
-       struct omap_device *od;
+       struct platform_device *pdev;
        void *pdata = NULL;
        u32 pdata_size = 0;
        char *name;
@@ -799,20 +777,19 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
        if (WARN_ON(!oh))
                return;
 
-       od = omap_device_build(name, uart->num, oh, pdata, pdata_size,
-                              omap_uart_latency,
-                              ARRAY_SIZE(omap_uart_latency), false);
-       WARN(IS_ERR(od), "Could not build omap_device for %s: %s.\n",
+       pdev = omap_device_build(name, uart->num, oh, pdata, pdata_size,
+                                NULL, 0, false);
+       WARN(IS_ERR(pdev), "Could not build omap_device for %s: %s.\n",
             name, oh->name);
 
-       omap_device_disable_idle_on_suspend(od);
+       omap_device_disable_idle_on_suspend(pdev);
        oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt);
 
        uart->irq = oh->mpu_irqs[0].irq;
        uart->regshift = 2;
        uart->mapbase = oh->slaves[0]->addr->pa_start;
        uart->membase = omap_hwmod_get_mpu_rt_va(oh);
-       uart->pdev = &od->pdev;
+       uart->pdev = pdev;
 
        oh->dev_attr = uart;
 
@@ -846,8 +823,8 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
 
        if ((cpu_is_omap34xx() && uart->padconf) ||
            (uart->wk_en && uart->wk_mask)) {
-               device_init_wakeup(&od->pdev.dev, true);
-               DEV_CREATE_FILE(&od->pdev.dev, &dev_attr_sleep_timeout);
+               device_init_wakeup(&pdev->dev, true);
+               DEV_CREATE_FILE(&pdev->dev, &dev_attr_sleep_timeout);
        }
 
        /* Enable the MDR1 errata for OMAP3 */
index f438cf4d847b7f093c70d14619d07d630529b932..53d9d0a5b39d1a66fcb797161a3b24c0beeaf1f4 100644 (file)
@@ -15,7 +15,7 @@
 
 static int sr_class3_enable(struct voltagedomain *voltdm)
 {
-       unsigned long volt = omap_voltage_get_nom_volt(voltdm);
+       unsigned long volt = voltdm_get_voltage(voltdm);
 
        if (!volt) {
                pr_warning("%s: Curr voltage unknown. Cannot enable sr_%s\n",
@@ -32,7 +32,7 @@ static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset)
        omap_vp_disable(voltdm);
        sr_disable(voltdm);
        if (is_volt_reset)
-               omap_voltage_reset(voltdm);
+               voltdm_reset(voltdm);
 
        return 0;
 }
index 34c01a7de81088b6e1657a575e8679125c13f75c..bb606c9709b2611599d1400842a3e424b2b95cb9 100644 (file)
@@ -62,6 +62,7 @@ static LIST_HEAD(sr_list);
 
 static struct omap_sr_class_data *sr_class;
 static struct omap_sr_pmic_data *sr_pmic_data;
+static struct dentry           *sr_dbg_dir;
 
 static inline void sr_write_reg(struct omap_sr *sr, unsigned offset, u32 value)
 {
@@ -826,9 +827,10 @@ static int __init omap_sr_probe(struct platform_device *pdev)
        struct omap_sr *sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL);
        struct omap_sr_data *pdata = pdev->dev.platform_data;
        struct resource *mem, *irq;
-       struct dentry *vdd_dbg_dir, *nvalue_dir;
+       struct dentry *nvalue_dir;
        struct omap_volt_data *volt_data;
        int i, ret = 0;
+       char *name;
 
        if (!sr_info) {
                dev_err(&pdev->dev, "%s: unable to allocate sr_info\n",
@@ -899,18 +901,25 @@ static int __init omap_sr_probe(struct platform_device *pdev)
        }
 
        dev_info(&pdev->dev, "%s: SmartReflex driver initialized\n", __func__);
+       if (!sr_dbg_dir) {
+               sr_dbg_dir = debugfs_create_dir("smartreflex", NULL);
+               if (!sr_dbg_dir) {
+                       ret = PTR_ERR(sr_dbg_dir);
+                       pr_err("%s:sr debugfs dir creation failed(%d)\n",
+                               __func__, ret);
+                       goto err_iounmap;
+               }
+       }
 
-       /*
-        * If the voltage domain debugfs directory is not created, do
-        * not try to create rest of the debugfs entries.
-        */
-       vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm);
-       if (!vdd_dbg_dir) {
-               ret = -EINVAL;
+       name = kasprintf(GFP_KERNEL, "sr_%s", sr_info->voltdm->name);
+       if (!name) {
+               dev_err(&pdev->dev, "%s: Unable to alloc debugfs name\n",
+                       __func__);
+               ret = -ENOMEM;
                goto err_iounmap;
        }
-
-       sr_info->dbg_dir = debugfs_create_dir("smartreflex", vdd_dbg_dir);
+       sr_info->dbg_dir = debugfs_create_dir(name, sr_dbg_dir);
+       kfree(name);
        if (IS_ERR(sr_info->dbg_dir)) {
                dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n",
                        __func__);
index 10d3c5ee80187f42560eb07d9a5f5d2ecab4c6c9..9f43fcc05d3e5825b78e194e1929dd2d85c8799b 100644 (file)
 
 static bool sr_enable_on_init;
 
-static struct omap_device_pm_latency omap_sr_latency[] = {
-       {
-               .deactivate_func = omap_device_idle_hwmods,
-               .activate_func   = omap_device_enable_hwmods,
-               .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST
-       },
-};
-
 /* Read EFUSE values from control registers for OMAP3430 */
 static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
                                struct omap_sr_data *sr_data)
@@ -80,7 +72,7 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
 static int sr_dev_init(struct omap_hwmod *oh, void *user)
 {
        struct omap_sr_data *sr_data;
-       struct omap_device *od;
+       struct platform_device *pdev;
        struct omap_volt_data *volt_data;
        char *name = "smartreflex";
        static int i;
@@ -102,7 +94,7 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
        sr_data->senn_mod = 0x1;
        sr_data->senp_mod = 0x1;
 
-       sr_data->voltdm = omap_voltage_domain_lookup(oh->vdd_name);
+       sr_data->voltdm = voltdm_lookup(oh->vdd_name);
        if (IS_ERR(sr_data->voltdm)) {
                pr_err("%s: Unable to get voltage domain pointer for VDD %s\n",
                        __func__, oh->vdd_name);
@@ -120,10 +112,9 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
 
        sr_data->enable_on_init = sr_enable_on_init;
 
-       od = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data),
-                              omap_sr_latency,
-                              ARRAY_SIZE(omap_sr_latency), 0);
-       if (IS_ERR(od))
+       pdev = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data),
+                                NULL, 0, 0);
+       if (IS_ERR(pdev))
                pr_warning("%s: Could not build omap_device for %s: %s.\n\n",
                        __func__, name, oh->name);
 exit:
index cf1de7d2630d69ebfcefee911670bdd94110f305..e49fc7be2229badcd274038b7a308ce6def8c478 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/irq.h>
 #include <linux/clocksource.h>
 #include <linux/clockchips.h>
+#include <linux/slab.h>
 
 #include <asm/mach/time.h>
 #include <plat/dmtimer.h>
 #include <asm/sched_clock.h>
 #include <plat/common.h>
 #include <plat/omap_hwmod.h>
+#include <plat/omap_device.h>
+#include <plat/omap-pm.h>
+
+#include "powerdomain.h"
 
 /* Parent clocks, eventually these will come from the clock framework */
 
@@ -67,7 +72,7 @@
 /* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
 #define MAX_GPTIMER_ID         12
 
-u32 sys_timer_reserved;
+static u32 sys_timer_reserved;
 
 /* Clockevent code */
 
@@ -78,7 +83,7 @@ static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id)
 {
        struct clock_event_device *evt = &clockevent_gpt;
 
-       __omap_dm_timer_write_status(clkev.io_base, OMAP_TIMER_INT_OVERFLOW);
+       __omap_dm_timer_write_status(&clkev, OMAP_TIMER_INT_OVERFLOW);
 
        evt->event_handler(evt);
        return IRQ_HANDLED;
@@ -93,7 +98,7 @@ static struct irqaction omap2_gp_timer_irq = {
 static int omap2_gp_timer_set_next_event(unsigned long cycles,
                                         struct clock_event_device *evt)
 {
-       __omap_dm_timer_load_start(clkev.io_base, OMAP_TIMER_CTRL_ST,
+       __omap_dm_timer_load_start(&clkev, OMAP_TIMER_CTRL_ST,
                                                0xffffffff - cycles, 1);
 
        return 0;
@@ -104,16 +109,16 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode mode,
 {
        u32 period;
 
-       __omap_dm_timer_stop(clkev.io_base, 1, clkev.rate);
+       __omap_dm_timer_stop(&clkev, 1, clkev.rate);
 
        switch (mode) {
        case CLOCK_EVT_MODE_PERIODIC:
                period = clkev.rate / HZ;
                period -= 1;
                /* Looks like we need to first set the load value separately */
-               __omap_dm_timer_write(clkev.io_base, OMAP_TIMER_LOAD_REG,
+               __omap_dm_timer_write(&clkev, OMAP_TIMER_LOAD_REG,
                                        0xffffffff - period, 1);
-               __omap_dm_timer_load_start(clkev.io_base,
+               __omap_dm_timer_load_start(&clkev,
                                        OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST,
                                                0xffffffff - period, 1);
                break;
@@ -189,7 +194,8 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
                        clk_put(src);
                }
        }
-       __omap_dm_timer_reset(timer->io_base, 1, 1);
+       __omap_dm_timer_init_regs(timer);
+       __omap_dm_timer_reset(timer, 1, 1);
        timer->posted = 1;
 
        timer->rate = clk_get_rate(timer->fclk);
@@ -210,7 +216,7 @@ static void __init omap2_gp_clockevent_init(int gptimer_id,
        omap2_gp_timer_irq.dev_id = (void *)&clkev;
        setup_irq(clkev.irq, &omap2_gp_timer_irq);
 
-       __omap_dm_timer_int_enable(clkev.io_base, OMAP_TIMER_INT_OVERFLOW);
+       __omap_dm_timer_int_enable(&clkev, OMAP_TIMER_INT_OVERFLOW);
 
        clockevent_gpt.mult = div_sc(clkev.rate, NSEC_PER_SEC,
                                     clockevent_gpt.shift);
@@ -251,7 +257,7 @@ static struct omap_dm_timer clksrc;
 static DEFINE_CLOCK_DATA(cd);
 static cycle_t clocksource_read_cycles(struct clocksource *cs)
 {
-       return (cycle_t)__omap_dm_timer_read_counter(clksrc.io_base, 1);
+       return (cycle_t)__omap_dm_timer_read_counter(&clksrc, 1);
 }
 
 static struct clocksource clocksource_gpt = {
@@ -266,7 +272,7 @@ static void notrace dmtimer_update_sched_clock(void)
 {
        u32 cyc;
 
-       cyc = __omap_dm_timer_read_counter(clksrc.io_base, 1);
+       cyc = __omap_dm_timer_read_counter(&clksrc, 1);
 
        update_sched_clock(&cd, cyc, (u32)~0);
 }
@@ -276,7 +282,7 @@ unsigned long long notrace sched_clock(void)
        u32 cyc = 0;
 
        if (clksrc.reserved)
-               cyc = __omap_dm_timer_read_counter(clksrc.io_base, 1);
+               cyc = __omap_dm_timer_read_counter(&clksrc, 1);
 
        return cyc_to_sched_clock(&cd, cyc, (u32)~0);
 }
@@ -293,7 +299,7 @@ static void __init omap2_gp_clocksource_init(int gptimer_id,
        pr_info("OMAP clocksource: GPTIMER%d at %lu Hz\n",
                gptimer_id, clksrc.rate);
 
-       __omap_dm_timer_load_start(clksrc.io_base,
+       __omap_dm_timer_load_start(&clksrc,
                        OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 0, 1);
        init_sched_clock(&cd, dmtimer_update_sched_clock, 32, clksrc.rate);
 
@@ -341,3 +347,167 @@ static void __init omap4_timer_init(void)
 }
 OMAP_SYS_TIMER(4)
 #endif
+
+/**
+ * omap2_dm_timer_set_src - change the timer input clock source
+ * @pdev:      timer platform device pointer
+ * @source:    array index of parent clock source
+ */
+static int omap2_dm_timer_set_src(struct platform_device *pdev, int source)
+{
+       int ret;
+       struct dmtimer_platform_data *pdata = pdev->dev.platform_data;
+       struct clk *fclk, *parent;
+       char *parent_name = NULL;
+
+       fclk = clk_get(&pdev->dev, "fck");
+       if (IS_ERR_OR_NULL(fclk)) {
+               dev_err(&pdev->dev, "%s: %d: clk_get() FAILED\n",
+                               __func__, __LINE__);
+               return -EINVAL;
+       }
+
+       switch (source) {
+       case OMAP_TIMER_SRC_SYS_CLK:
+               parent_name = "sys_ck";
+               break;
+
+       case OMAP_TIMER_SRC_32_KHZ:
+               parent_name = "32k_ck";
+               break;
+
+       case OMAP_TIMER_SRC_EXT_CLK:
+               if (pdata->timer_ip_version == OMAP_TIMER_IP_VERSION_1) {
+                       parent_name = "alt_ck";
+                       break;
+               }
+               dev_err(&pdev->dev, "%s: %d: invalid clk src.\n",
+                       __func__, __LINE__);
+               clk_put(fclk);
+               return -EINVAL;
+       }
+
+       parent = clk_get(&pdev->dev, parent_name);
+       if (IS_ERR_OR_NULL(parent)) {
+               dev_err(&pdev->dev, "%s: %d: clk_get() %s FAILED\n",
+                       __func__, __LINE__, parent_name);
+               clk_put(fclk);
+               return -EINVAL;
+       }
+
+       ret = clk_set_parent(fclk, parent);
+       if (IS_ERR_VALUE(ret)) {
+               dev_err(&pdev->dev, "%s: clk_set_parent() to %s FAILED\n",
+                       __func__, parent_name);
+               ret = -EINVAL;
+       }
+
+       clk_put(parent);
+       clk_put(fclk);
+
+       return ret;
+}
+
+struct omap_device_pm_latency omap2_dmtimer_latency[] = {
+       {
+               .deactivate_func = omap_device_idle_hwmods,
+               .activate_func   = omap_device_enable_hwmods,
+               .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+       },
+};
+
+/**
+ * omap_timer_init - build and register timer device with an
+ * associated timer hwmod
+ * @oh:        timer hwmod pointer to be used to build timer device
+ * @user:      parameter that can be passed from calling hwmod API
+ *
+ * Called by omap_hwmod_for_each_by_class to register each of the timer
+ * devices present in the system. The number of timer devices is known
+ * by parsing through the hwmod database for a given class name. At the
+ * end of function call memory is allocated for timer device and it is
+ * registered to the framework ready to be proved by the driver.
+ */
+static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
+{
+       int id;
+       int ret = 0;
+       char *name = "omap_timer";
+       struct dmtimer_platform_data *pdata;
+       struct platform_device *pdev;
+       struct omap_timer_capability_dev_attr *timer_dev_attr;
+       struct powerdomain *pwrdm;
+
+       pr_debug("%s: %s\n", __func__, oh->name);
+
+       /* on secure device, do not register secure timer */
+       timer_dev_attr = oh->dev_attr;
+       if (omap_type() != OMAP2_DEVICE_TYPE_GP && timer_dev_attr)
+               if (timer_dev_attr->timer_capability == OMAP_TIMER_SECURE)
+                       return ret;
+
+       pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+       if (!pdata) {
+               pr_err("%s: No memory for [%s]\n", __func__, oh->name);
+               return -ENOMEM;
+       }
+
+       /*
+        * Extract the IDs from name field in hwmod database
+        * and use the same for constructing ids' for the
+        * timer devices. In a way, we are avoiding usage of
+        * static variable witin the function to do the same.
+        * CAUTION: We have to be careful and make sure the
+        * name in hwmod database does not change in which case
+        * we might either make corresponding change here or
+        * switch back static variable mechanism.
+        */
+       sscanf(oh->name, "timer%2d", &id);
+
+       pdata->set_timer_src = omap2_dm_timer_set_src;
+       pdata->timer_ip_version = oh->class->rev;
+
+       /* Mark clocksource and clockevent timers as reserved */
+       if ((sys_timer_reserved >> (id - 1)) & 0x1)
+               pdata->reserved = 1;
+
+       pwrdm = omap_hwmod_get_pwrdm(oh);
+       pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm);
+#ifdef CONFIG_PM
+       pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
+#endif
+       pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
+                       omap2_dmtimer_latency,
+                       ARRAY_SIZE(omap2_dmtimer_latency),
+                       0);
+
+       if (IS_ERR(pdev)) {
+               pr_err("%s: Can't build omap_device for %s: %s.\n",
+                       __func__, name, oh->name);
+               ret = -EINVAL;
+       }
+
+       kfree(pdata);
+
+       return ret;
+}
+
+/**
+ * omap2_dm_timer_init - top level regular device initialization
+ *
+ * Uses dedicated hwmod api to parse through hwmod database for
+ * given class name and then build and register the timer device.
+ */
+static int __init omap2_dm_timer_init(void)
+{
+       int ret;
+
+       ret = omap_hwmod_for_each_by_class("timer", omap_timer_init, NULL);
+       if (unlikely(ret)) {
+               pr_err("%s: device registration failed.\n", __func__);
+               return -EINVAL;
+       }
+
+       return 0;
+}
+arch_initcall(omap2_dm_timer_init);
index a65145b02a5583cc7b3564727034e4c7c9fb2809..47fb5d607630678e6ce076ef9e311f3cdbb309b6 100644 (file)
@@ -60,14 +60,6 @@ static struct musb_hdrc_platform_data musb_plat = {
 
 static u64 musb_dmamask = DMA_BIT_MASK(32);
 
-static struct omap_device_pm_latency omap_musb_latency[] = {
-       {
-               .deactivate_func        = omap_device_idle_hwmods,
-               .activate_func          = omap_device_enable_hwmods,
-               .flags                  = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-       },
-};
-
 static void usb_musb_mux_init(struct omap_musb_board_data *board_data)
 {
        switch (board_data->interface_type) {
@@ -115,7 +107,6 @@ static struct omap_musb_board_data musb_default_board_data = {
 void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
 {
        struct omap_hwmod               *oh;
-       struct omap_device              *od;
        struct platform_device          *pdev;
        struct device                   *dev;
        int                             bus_id = -1;
@@ -137,9 +128,6 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
        musb_plat.mode = board_data->mode;
        musb_plat.extvbus = board_data->extvbus;
 
-       if (cpu_is_omap44xx())
-               omap4430_phy_init(dev);
-
        if (cpu_is_omap3517() || cpu_is_omap3505()) {
                oh_name = "am35x_otg_hs";
                name = "musb-am35x";
@@ -148,22 +136,19 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
                name = "musb-omap2430";
        }
 
-       oh = omap_hwmod_lookup(oh_name);
-       if (!oh) {
-               pr_err("Could not look up %s\n", oh_name);
-               return;
-       }
+        oh = omap_hwmod_lookup(oh_name);
+        if (WARN(!oh, "%s: could not find omap_hwmod for %s\n",
+                 __func__, oh_name))
+                return;
 
-       od = omap_device_build(name, bus_id, oh, &musb_plat,
-                              sizeof(musb_plat), omap_musb_latency,
-                              ARRAY_SIZE(omap_musb_latency), false);
-       if (IS_ERR(od)) {
+       pdev = omap_device_build(name, bus_id, oh, &musb_plat,
+                              sizeof(musb_plat), NULL, 0, false);
+       if (IS_ERR(pdev)) {
                pr_err("Could not build omap_device for %s %s\n",
                                                name, oh_name);
                return;
        }
 
-       pdev = &od->pdev;
        dev = &pdev->dev;
        get_device(dev);
        dev->dma_mask = &musb_dmamask;
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
new file mode 100644 (file)
index 0000000..031d116
--- /dev/null
@@ -0,0 +1,367 @@
+/*
+ * OMAP Voltage Controller (VC) interface
+ *
+ * Copyright (C) 2011 Texas Instruments, 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/kernel.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+
+#include <plat/cpu.h>
+
+#include "voltage.h"
+#include "vc.h"
+#include "prm-regbits-34xx.h"
+#include "prm-regbits-44xx.h"
+#include "prm44xx.h"
+
+/**
+ * struct omap_vc_channel_cfg - describe the cfg_channel bitfield
+ * @sa: bit for slave address
+ * @rav: bit for voltage configuration register
+ * @rac: bit for command configuration register
+ * @racen: enable bit for RAC
+ * @cmd: bit for command value set selection
+ *
+ * Channel configuration bits, common for OMAP3+
+ * OMAP3 register: PRM_VC_CH_CONF
+ * OMAP4 register: PRM_VC_CFG_CHANNEL
+ * OMAP5 register: PRM_VC_SMPS_<voltdm>_CONFIG
+ */
+struct omap_vc_channel_cfg {
+       u8 sa;
+       u8 rav;
+       u8 rac;
+       u8 racen;
+       u8 cmd;
+};
+
+static struct omap_vc_channel_cfg vc_default_channel_cfg = {
+       .sa    = BIT(0),
+       .rav   = BIT(1),
+       .rac   = BIT(2),
+       .racen = BIT(3),
+       .cmd   = BIT(4),
+};
+
+/*
+ * On OMAP3+, all VC channels have the above default bitfield
+ * configuration, except the OMAP4 MPU channel.  This appears
+ * to be a freak accident as every other VC channel has the
+ * default configuration, thus creating a mutant channel config.
+ */
+static struct omap_vc_channel_cfg vc_mutant_channel_cfg = {
+       .sa    = BIT(0),
+       .rav   = BIT(2),
+       .rac   = BIT(3),
+       .racen = BIT(4),
+       .cmd   = BIT(1),
+};
+
+static struct omap_vc_channel_cfg *vc_cfg_bits;
+#define CFG_CHANNEL_MASK 0x1f
+
+/**
+ * omap_vc_config_channel - configure VC channel to PMIC mappings
+ * @voltdm: pointer to voltagdomain defining the desired VC channel
+ *
+ * Configures the VC channel to PMIC mappings for the following
+ * PMIC settings
+ * - i2c slave address (SA)
+ * - voltage configuration address (RAV)
+ * - command configuration address (RAC) and enable bit (RACEN)
+ * - command values for ON, ONLP, RET and OFF (CMD)
+ *
+ * This function currently only allows flexible configuration of the
+ * non-default channel.  Starting with OMAP4, there are more than 2
+ * channels, with one defined as the default (on OMAP4, it's MPU.)
+ * Only the non-default channel can be configured.
+ */
+static int omap_vc_config_channel(struct voltagedomain *voltdm)
+{
+       struct omap_vc_channel *vc = voltdm->vc;
+
+       /*
+        * For default channel, the only configurable bit is RACEN.
+        * All others must stay at zero (see function comment above.)
+        */
+       if (vc->flags & OMAP_VC_CHANNEL_DEFAULT)
+               vc->cfg_channel &= vc_cfg_bits->racen;
+
+       voltdm->rmw(CFG_CHANNEL_MASK << vc->cfg_channel_sa_shift,
+                   vc->cfg_channel << vc->cfg_channel_sa_shift,
+                   vc->cfg_channel_reg);
+
+       return 0;
+}
+
+/* Voltage scale and accessory APIs */
+int omap_vc_pre_scale(struct voltagedomain *voltdm,
+                     unsigned long target_volt,
+                     u8 *target_vsel, u8 *current_vsel)
+{
+       struct omap_vc_channel *vc = voltdm->vc;
+       u32 vc_cmdval;
+
+       /* Check if sufficient pmic info is available for this vdd */
+       if (!voltdm->pmic) {
+               pr_err("%s: Insufficient pmic info to scale the vdd_%s\n",
+                       __func__, voltdm->name);
+               return -EINVAL;
+       }
+
+       if (!voltdm->pmic->uv_to_vsel) {
+               pr_err("%s: PMIC function to convert voltage in uV to"
+                       "vsel not registered. Hence unable to scale voltage"
+                       "for vdd_%s\n", __func__, voltdm->name);
+               return -ENODATA;
+       }
+
+       if (!voltdm->read || !voltdm->write) {
+               pr_err("%s: No read/write API for accessing vdd_%s regs\n",
+                       __func__, voltdm->name);
+               return -EINVAL;
+       }
+
+       *target_vsel = voltdm->pmic->uv_to_vsel(target_volt);
+       *current_vsel = voltdm->pmic->uv_to_vsel(voltdm->nominal_volt);
+
+       /* Setting the ON voltage to the new target voltage */
+       vc_cmdval = voltdm->read(vc->cmdval_reg);
+       vc_cmdval &= ~vc->common->cmd_on_mask;
+       vc_cmdval |= (*target_vsel << vc->common->cmd_on_shift);
+       voltdm->write(vc_cmdval, vc->cmdval_reg);
+
+       omap_vp_update_errorgain(voltdm, target_volt);
+
+       return 0;
+}
+
+void omap_vc_post_scale(struct voltagedomain *voltdm,
+                       unsigned long target_volt,
+                       u8 target_vsel, u8 current_vsel)
+{
+       u32 smps_steps = 0, smps_delay = 0;
+
+       smps_steps = abs(target_vsel - current_vsel);
+       /* SMPS slew rate / step size. 2us added as buffer. */
+       smps_delay = ((smps_steps * voltdm->pmic->step_size) /
+                       voltdm->pmic->slew_rate) + 2;
+       udelay(smps_delay);
+}
+
+/* vc_bypass_scale - VC bypass method of voltage scaling */
+int omap_vc_bypass_scale(struct voltagedomain *voltdm,
+                        unsigned long target_volt)
+{
+       struct omap_vc_channel *vc = voltdm->vc;
+       u32 loop_cnt = 0, retries_cnt = 0;
+       u32 vc_valid, vc_bypass_val_reg, vc_bypass_value;
+       u8 target_vsel, current_vsel;
+       int ret;
+
+       ret = omap_vc_pre_scale(voltdm, target_volt, &target_vsel, &current_vsel);
+       if (ret)
+               return ret;
+
+       vc_valid = vc->common->valid;
+       vc_bypass_val_reg = vc->common->bypass_val_reg;
+       vc_bypass_value = (target_vsel << vc->common->data_shift) |
+               (vc->volt_reg_addr << vc->common->regaddr_shift) |
+               (vc->i2c_slave_addr << vc->common->slaveaddr_shift);
+
+       voltdm->write(vc_bypass_value, vc_bypass_val_reg);
+       voltdm->write(vc_bypass_value | vc_valid, vc_bypass_val_reg);
+
+       vc_bypass_value = voltdm->read(vc_bypass_val_reg);
+       /*
+        * Loop till the bypass command is acknowledged from the SMPS.
+        * NOTE: This is legacy code. The loop count and retry count needs
+        * to be revisited.
+        */
+       while (!(vc_bypass_value & vc_valid)) {
+               loop_cnt++;
+
+               if (retries_cnt > 10) {
+                       pr_warning("%s: Retry count exceeded\n", __func__);
+                       return -ETIMEDOUT;
+               }
+
+               if (loop_cnt > 50) {
+                       retries_cnt++;
+                       loop_cnt = 0;
+                       udelay(10);
+               }
+               vc_bypass_value = voltdm->read(vc_bypass_val_reg);
+       }
+
+       omap_vc_post_scale(voltdm, target_volt, target_vsel, current_vsel);
+       return 0;
+}
+
+static void __init omap3_vfsm_init(struct voltagedomain *voltdm)
+{
+       /*
+        * Voltage Manager FSM parameters init
+        * XXX This data should be passed in from the board file
+        */
+       voltdm->write(OMAP3_CLKSETUP, OMAP3_PRM_CLKSETUP_OFFSET);
+       voltdm->write(OMAP3_VOLTOFFSET, OMAP3_PRM_VOLTOFFSET_OFFSET);
+       voltdm->write(OMAP3_VOLTSETUP2, OMAP3_PRM_VOLTSETUP2_OFFSET);
+}
+
+static void __init omap3_vc_init_channel(struct voltagedomain *voltdm)
+{
+       static bool is_initialized;
+
+       if (is_initialized)
+               return;
+
+       omap3_vfsm_init(voltdm);
+
+       is_initialized = true;
+}
+
+
+/* OMAP4 specific voltage init functions */
+static void __init omap4_vc_init_channel(struct voltagedomain *voltdm)
+{
+       static bool is_initialized;
+       u32 vc_val;
+
+       if (is_initialized)
+               return;
+
+       /* XXX These are magic numbers and do not belong! */
+       vc_val = (0x60 << OMAP4430_SCLL_SHIFT | 0x26 << OMAP4430_SCLH_SHIFT);
+       voltdm->write(vc_val, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET);
+
+       is_initialized = true;
+}
+
+/**
+ * omap_vc_i2c_init - initialize I2C interface to PMIC
+ * @voltdm: voltage domain containing VC data
+ *
+ * Use PMIC supplied seetings for I2C high-speed mode and
+ * master code (if set) and program the VC I2C configuration
+ * register.
+ *
+ * The VC I2C configuration is common to all VC channels,
+ * so this function only configures I2C for the first VC
+ * channel registers.  All other VC channels will use the
+ * same configuration.
+ */
+static void __init omap_vc_i2c_init(struct voltagedomain *voltdm)
+{
+       struct omap_vc_channel *vc = voltdm->vc;
+       static bool initialized;
+       static bool i2c_high_speed;
+       u8 mcode;
+
+       if (initialized) {
+               if (voltdm->pmic->i2c_high_speed != i2c_high_speed)
+                       pr_warn("%s: I2C config for all channels must match.",
+                               __func__);
+               return;
+       }
+
+       i2c_high_speed = voltdm->pmic->i2c_high_speed;
+       if (i2c_high_speed)
+               voltdm->rmw(vc->common->i2c_cfg_hsen_mask,
+                           vc->common->i2c_cfg_hsen_mask,
+                           vc->common->i2c_cfg_reg);
+
+       mcode = voltdm->pmic->i2c_mcode;
+       if (mcode)
+               voltdm->rmw(vc->common->i2c_mcode_mask,
+                           mcode << __ffs(vc->common->i2c_mcode_mask),
+                           vc->common->i2c_cfg_reg);
+
+       initialized = true;
+}
+
+void __init omap_vc_init_channel(struct voltagedomain *voltdm)
+{
+       struct omap_vc_channel *vc = voltdm->vc;
+       u8 on_vsel, onlp_vsel, ret_vsel, off_vsel;
+       u32 val;
+
+       if (!voltdm->pmic || !voltdm->pmic->uv_to_vsel) {
+               pr_err("%s: PMIC info requried to configure vc for"
+                       "vdd_%s not populated.Hence cannot initialize vc\n",
+                       __func__, voltdm->name);
+               return;
+       }
+
+       if (!voltdm->read || !voltdm->write) {
+               pr_err("%s: No read/write API for accessing vdd_%s regs\n",
+                       __func__, voltdm->name);
+               return;
+       }
+
+       vc->cfg_channel = 0;
+       if (vc->flags & OMAP_VC_CHANNEL_CFG_MUTANT)
+               vc_cfg_bits = &vc_mutant_channel_cfg;
+       else
+               vc_cfg_bits = &vc_default_channel_cfg;
+
+       /* get PMIC/board specific settings */
+       vc->i2c_slave_addr = voltdm->pmic->i2c_slave_addr;
+       vc->volt_reg_addr = voltdm->pmic->volt_reg_addr;
+       vc->cmd_reg_addr = voltdm->pmic->cmd_reg_addr;
+       vc->setup_time = voltdm->pmic->volt_setup_time;
+
+       /* Configure the i2c slave address for this VC */
+       voltdm->rmw(vc->smps_sa_mask,
+                   vc->i2c_slave_addr << __ffs(vc->smps_sa_mask),
+                   vc->smps_sa_reg);
+       vc->cfg_channel |= vc_cfg_bits->sa;
+
+       /*
+        * Configure the PMIC register addresses.
+        */
+       voltdm->rmw(vc->smps_volra_mask,
+                   vc->volt_reg_addr << __ffs(vc->smps_volra_mask),
+                   vc->smps_volra_reg);
+       vc->cfg_channel |= vc_cfg_bits->rav;
+
+       if (vc->cmd_reg_addr) {
+               voltdm->rmw(vc->smps_cmdra_mask,
+                           vc->cmd_reg_addr << __ffs(vc->smps_cmdra_mask),
+                           vc->smps_cmdra_reg);
+               vc->cfg_channel |= vc_cfg_bits->rac | vc_cfg_bits->racen;
+       }
+
+       /* Set up the on, inactive, retention and off voltage */
+       on_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->on_volt);
+       onlp_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->onlp_volt);
+       ret_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->ret_volt);
+       off_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->off_volt);
+       val = ((on_vsel << vc->common->cmd_on_shift) |
+              (onlp_vsel << vc->common->cmd_onlp_shift) |
+              (ret_vsel << vc->common->cmd_ret_shift) |
+              (off_vsel << vc->common->cmd_off_shift));
+       voltdm->write(val, vc->cmdval_reg);
+       vc->cfg_channel |= vc_cfg_bits->cmd;
+
+       /* Channel configuration */
+       omap_vc_config_channel(voltdm);
+
+       /* Configure the setup times */
+       voltdm->rmw(voltdm->vfsm->voltsetup_mask,
+                   vc->setup_time << __ffs(voltdm->vfsm->voltsetup_mask),
+                   voltdm->vfsm->voltsetup_reg);
+
+       omap_vc_i2c_init(voltdm);
+
+       if (cpu_is_omap34xx())
+               omap3_vc_init_channel(voltdm);
+       else if (cpu_is_omap44xx())
+               omap4_vc_init_channel(voltdm);
+}
+
index e7767771de49d1e4514944904944f9075819f8a5..478bf6b432c42c5c92f5329311e94ac12c5d023b 100644 (file)
 
 #include <linux/kernel.h>
 
+struct voltagedomain;
+
 /**
- * struct omap_vc_common_data - per-VC register/bitfield data
+ * struct omap_vc_common - per-VC register/bitfield data
  * @cmd_on_mask: ON bitmask in PRM_VC_CMD_VAL* register
  * @valid: VALID bitmask in PRM_VC_BYPASS_VAL register
- * @smps_sa_reg: Offset of PRM_VC_SMPS_SA reg from PRM start
- * @smps_volra_reg: Offset of PRM_VC_SMPS_VOL_RA reg from PRM start
  * @bypass_val_reg: Offset of PRM_VC_BYPASS_VAL reg from PRM start
  * @data_shift: DATA field shift in PRM_VC_BYPASS_VAL register
  * @slaveaddr_shift: SLAVEADDR field shift in PRM_VC_BYPASS_VAL register
  * @cmd_onlp_shift: ONLP field shift in PRM_VC_CMD_VAL_* register
  * @cmd_ret_shift: RET field shift in PRM_VC_CMD_VAL_* register
  * @cmd_off_shift: OFF field shift in PRM_VC_CMD_VAL_* register
+ * @i2c_cfg_reg: I2C configuration register offset
+ * @i2c_cfg_hsen_mask: high-speed mode bit field mask in I2C config register
+ * @i2c_mcode_mask: MCODE field mask for I2C config register
  *
  * XXX One of cmd_on_mask and cmd_on_shift are not needed
  * XXX VALID should probably be a shift, not a mask
  */
-struct omap_vc_common_data {
+struct omap_vc_common {
        u32 cmd_on_mask;
        u32 valid;
-       u8 smps_sa_reg;
-       u8 smps_volra_reg;
        u8 bypass_val_reg;
        u8 data_shift;
        u8 slaveaddr_shift;
@@ -50,34 +51,75 @@ struct omap_vc_common_data {
        u8 cmd_onlp_shift;
        u8 cmd_ret_shift;
        u8 cmd_off_shift;
+       u8 i2c_cfg_reg;
+       u8 i2c_cfg_hsen_mask;
+       u8 i2c_mcode_mask;
 };
 
+/* omap_vc_channel.flags values */
+#define OMAP_VC_CHANNEL_DEFAULT BIT(0)
+#define OMAP_VC_CHANNEL_CFG_MUTANT BIT(1)
+
 /**
- * struct omap_vc_instance_data - VC per-instance data
- * @vc_common: pointer to VC common data for this platform
- * @smps_sa_mask: SA* bitmask in the PRM_VC_SMPS_SA register
- * @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register
- * @smps_sa_shift: SA* field shift in the PRM_VC_SMPS_SA register
- * @smps_volra_shift: VOLRA* field shift in the PRM_VC_VOL_RA register
+ * struct omap_vc_channel - VC per-instance data
+ * @i2c_slave_addr: I2C slave address of PMIC for this VC channel
+ * @volt_reg_addr: voltage configuration register address
+ * @cmd_reg_addr: command configuration register address
+ * @setup_time: setup time (in sys_clk cycles) of regulator for this channel
+ * @cfg_channel: current value of VC channel configuration register
+ * @i2c_high_speed: whether or not to use I2C high-speed mode
  *
- * XXX It is not necessary to have both a *_mask and a *_shift -
- *     remove one
+ * @common: pointer to VC common data for this platform
+ * @smps_sa_mask: i2c slave address bitmask in the PRM_VC_SMPS_SA register
+ * @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register
+ * @smps_cmdra_mask: CMDRA* bitmask in the PRM_VC_CMD_RA register
+ * @cmdval_reg: register for on/ret/off voltage level values for this channel
+ * @smps_sa_reg: Offset of PRM_VC_SMPS_SA reg from PRM start
+ * @smps_volra_reg: Offset of PRM_VC_SMPS_VOL_RA reg from PRM start
+ * @smps_cmdra_reg: Offset of PRM_VC_SMPS_CMD_RA reg from PRM start
+ * @cfg_channel_reg: VC channel configuration register
+ * @cfg_channel_sa_shift: bit shift for slave address cfg_channel register
+ * @flags: VC channel-specific flags (optional)
  */
-struct omap_vc_instance_data {
-       const struct omap_vc_common_data *vc_common;
+struct omap_vc_channel {
+       /* channel state */
+       u16 i2c_slave_addr;
+       u16 volt_reg_addr;
+       u16 cmd_reg_addr;
+       u16 setup_time;
+       u8 cfg_channel;
+       bool i2c_high_speed;
+
+       /* register access data */
+       const struct omap_vc_common *common;
        u32 smps_sa_mask;
        u32 smps_volra_mask;
+       u32 smps_cmdra_mask;
        u8 cmdval_reg;
-       u8 smps_sa_shift;
-       u8 smps_volra_shift;
+       u8 smps_sa_reg;
+       u8 smps_volra_reg;
+       u8 smps_cmdra_reg;
+       u8 cfg_channel_reg;
+       u8 cfg_channel_sa_shift;
+       u8 flags;
 };
 
-extern struct omap_vc_instance_data omap3_vc1_data;
-extern struct omap_vc_instance_data omap3_vc2_data;
+extern struct omap_vc_channel omap3_vc_mpu;
+extern struct omap_vc_channel omap3_vc_core;
+
+extern struct omap_vc_channel omap4_vc_mpu;
+extern struct omap_vc_channel omap4_vc_iva;
+extern struct omap_vc_channel omap4_vc_core;
 
-extern struct omap_vc_instance_data omap4_vc_mpu_data;
-extern struct omap_vc_instance_data omap4_vc_iva_data;
-extern struct omap_vc_instance_data omap4_vc_core_data;
+void omap_vc_init_channel(struct voltagedomain *voltdm);
+int omap_vc_pre_scale(struct voltagedomain *voltdm,
+                     unsigned long target_volt,
+                     u8 *target_vsel, u8 *current_vsel);
+void omap_vc_post_scale(struct voltagedomain *voltdm,
+                       unsigned long target_volt,
+                       u8 target_vsel, u8 current_vsel);
+int omap_vc_bypass_scale(struct voltagedomain *voltdm,
+                        unsigned long target_volt);
 
 #endif
 
index f37dc4bc379a54b2cf3e8547d4e1751828be9d93..cfe348e1af0eca9316779adbd684834947015441 100644 (file)
@@ -29,9 +29,7 @@
  * VC data common to 34xx/36xx chips
  * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file.
  */
-static struct omap_vc_common_data omap3_vc_common = {
-       .smps_sa_reg     = OMAP3_PRM_VC_SMPS_SA_OFFSET,
-       .smps_volra_reg  = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET,
+static struct omap_vc_common omap3_vc_common = {
        .bypass_val_reg  = OMAP3_PRM_VC_BYPASS_VAL_OFFSET,
        .data_shift      = OMAP3430_DATA_SHIFT,
        .slaveaddr_shift = OMAP3430_SLAVEADDR_SHIFT,
@@ -42,22 +40,33 @@ static struct omap_vc_common_data omap3_vc_common = {
        .cmd_onlp_shift  = OMAP3430_VC_CMD_ONLP_SHIFT,
        .cmd_ret_shift   = OMAP3430_VC_CMD_RET_SHIFT,
        .cmd_off_shift   = OMAP3430_VC_CMD_OFF_SHIFT,
+       .i2c_cfg_hsen_mask = OMAP3430_HSEN_MASK,
+       .i2c_cfg_reg     = OMAP3_PRM_VC_I2C_CFG_OFFSET,
+       .i2c_mcode_mask  = OMAP3430_MCODE_MASK,
 };
 
-struct omap_vc_instance_data omap3_vc1_data = {
-       .vc_common = &omap3_vc_common,
+struct omap_vc_channel omap3_vc_mpu = {
+       .common = &omap3_vc_common,
+       .smps_sa_reg     = OMAP3_PRM_VC_SMPS_SA_OFFSET,
+       .smps_volra_reg  = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET,
+       .smps_cmdra_reg  = OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET,
+       .cfg_channel_reg = OMAP3_PRM_VC_CH_CONF_OFFSET,
        .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_0_OFFSET,
-       .smps_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA0_SHIFT,
        .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA0_MASK,
-       .smps_volra_shift = OMAP3430_VOLRA0_SHIFT,
        .smps_volra_mask = OMAP3430_VOLRA0_MASK,
+       .smps_cmdra_mask = OMAP3430_CMDRA0_MASK,
+       .cfg_channel_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA0_SHIFT,
 };
 
-struct omap_vc_instance_data omap3_vc2_data = {
-       .vc_common = &omap3_vc_common,
+struct omap_vc_channel omap3_vc_core = {
+       .common = &omap3_vc_common,
+       .smps_sa_reg     = OMAP3_PRM_VC_SMPS_SA_OFFSET,
+       .smps_volra_reg  = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET,
+       .smps_cmdra_reg  = OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET,
+       .cfg_channel_reg = OMAP3_PRM_VC_CH_CONF_OFFSET,
        .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_1_OFFSET,
-       .smps_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT,
        .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA1_MASK,
-       .smps_volra_shift = OMAP3430_VOLRA1_SHIFT,
        .smps_volra_mask = OMAP3430_VOLRA1_MASK,
+       .smps_cmdra_mask = OMAP3430_CMDRA1_MASK,
+       .cfg_channel_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT,
 };
index a98da8ddec52234cfbd5eccc1e4ae91a5dfce703..2740a968145e2bdf2840c8c5298789f80956baf3 100644 (file)
@@ -30,9 +30,7 @@
  * VC data common to 44xx chips
  * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file.
  */
-static const struct omap_vc_common_data omap4_vc_common = {
-       .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET,
-       .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET,
+static const struct omap_vc_common omap4_vc_common = {
        .bypass_val_reg = OMAP4_PRM_VC_VAL_BYPASS_OFFSET,
        .data_shift = OMAP4430_DATA_SHIFT,
        .slaveaddr_shift = OMAP4430_SLAVEADDR_SHIFT,
@@ -43,33 +41,49 @@ static const struct omap_vc_common_data omap4_vc_common = {
        .cmd_onlp_shift = OMAP4430_ONLP_SHIFT,
        .cmd_ret_shift = OMAP4430_RET_SHIFT,
        .cmd_off_shift = OMAP4430_OFF_SHIFT,
+       .i2c_cfg_reg = OMAP4_PRM_VC_CFG_I2C_MODE_OFFSET,
+       .i2c_cfg_hsen_mask = OMAP4430_HSMODEEN_MASK,
+       .i2c_mcode_mask  = OMAP4430_HSMCODE_MASK,
 };
 
 /* VC instance data for each controllable voltage line */
-struct omap_vc_instance_data omap4_vc_mpu_data = {
-       .vc_common = &omap4_vc_common,
+struct omap_vc_channel omap4_vc_mpu = {
+       .flags = OMAP_VC_CHANNEL_DEFAULT | OMAP_VC_CHANNEL_CFG_MUTANT,
+       .common = &omap4_vc_common,
+       .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET,
+       .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET,
+       .smps_cmdra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET,
+       .cfg_channel_reg = OMAP4_PRM_VC_CFG_CHANNEL_OFFSET,
        .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_MPU_L_OFFSET,
-       .smps_sa_shift = OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_SHIFT,
        .smps_sa_mask = OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_MASK,
-       .smps_volra_shift = OMAP4430_VOLRA_VDD_MPU_L_SHIFT,
        .smps_volra_mask = OMAP4430_VOLRA_VDD_MPU_L_MASK,
+       .smps_cmdra_mask = OMAP4430_CMDRA_VDD_MPU_L_MASK,
+       .cfg_channel_sa_shift = OMAP4430_SA_VDD_MPU_L_SHIFT,
 };
 
-struct omap_vc_instance_data omap4_vc_iva_data = {
-       .vc_common = &omap4_vc_common,
+struct omap_vc_channel omap4_vc_iva = {
+       .common = &omap4_vc_common,
+       .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET,
+       .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET,
+       .smps_cmdra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET,
+       .cfg_channel_reg = OMAP4_PRM_VC_CFG_CHANNEL_OFFSET,
        .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_IVA_L_OFFSET,
-       .smps_sa_shift = OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_SHIFT,
        .smps_sa_mask = OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_MASK,
-       .smps_volra_shift = OMAP4430_VOLRA_VDD_IVA_L_SHIFT,
        .smps_volra_mask = OMAP4430_VOLRA_VDD_IVA_L_MASK,
+       .smps_cmdra_mask = OMAP4430_CMDRA_VDD_IVA_L_MASK,
+       .cfg_channel_sa_shift = OMAP4430_SA_VDD_IVA_L_SHIFT,
 };
 
-struct omap_vc_instance_data omap4_vc_core_data = {
-       .vc_common = &omap4_vc_common,
+struct omap_vc_channel omap4_vc_core = {
+       .common = &omap4_vc_common,
+       .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET,
+       .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET,
+       .smps_cmdra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET,
+       .cfg_channel_reg = OMAP4_PRM_VC_CFG_CHANNEL_OFFSET,
        .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_CORE_L_OFFSET,
-       .smps_sa_shift = OMAP4430_SA_VDD_CORE_L_0_6_SHIFT,
        .smps_sa_mask = OMAP4430_SA_VDD_CORE_L_0_6_MASK,
-       .smps_volra_shift = OMAP4430_VOLRA_VDD_CORE_L_SHIFT,
        .smps_volra_mask = OMAP4430_VOLRA_VDD_CORE_L_MASK,
+       .smps_cmdra_mask = OMAP4430_CMDRA_VDD_CORE_L_MASK,
+       .cfg_channel_sa_shift = OMAP4430_SA_VDD_CORE_L_SHIFT,
 };
 
index 9ef3789ded4b0f1c5e48d1782c7004067a03d8cd..64070ac1e761048caf85bf5fb4ebad2e06b85197 100644 (file)
 
 #include <linux/delay.h>
 #include <linux/io.h>
-#include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/debugfs.h>
 #include <linux/slab.h>
+#include <linux/clk.h>
 
 #include <plat/common.h>
 
 #include "control.h"
 
 #include "voltage.h"
+#include "powerdomain.h"
 
 #include "vc.h"
 #include "vp.h"
 
-#define VOLTAGE_DIR_SIZE       16
-
-
-static struct omap_vdd_info **vdd_info;
-
-/*
- * Number of scalable voltage domains.
- */
-static int nr_scalable_vdd;
-
-/* XXX document */
-static s16 prm_mod_offs;
-static s16 prm_irqst_ocp_mod_offs;
-
-static struct dentry *voltage_dir;
-
-/* Init function pointers */
-static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
-                                       unsigned long target_volt);
-
-static u32 omap3_voltage_read_reg(u16 mod, u8 offset)
-{
-       return omap2_prm_read_mod_reg(mod, offset);
-}
-
-static void omap3_voltage_write_reg(u32 val, u16 mod, u8 offset)
-{
-       omap2_prm_write_mod_reg(val, mod, offset);
-}
-
-static u32 omap4_voltage_read_reg(u16 mod, u8 offset)
-{
-       return omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
-                                       mod, offset);
-}
-
-static void omap4_voltage_write_reg(u32 val, u16 mod, u8 offset)
-{
-       omap4_prminst_write_inst_reg(val, OMAP4430_PRM_PARTITION, mod, offset);
-}
-
-static int __init _config_common_vdd_data(struct omap_vdd_info *vdd)
-{
-       char *sys_ck_name;
-       struct clk *sys_ck;
-       u32 sys_clk_speed, timeout_val, waittime;
-
-       /*
-        * XXX Clockfw should handle this, or this should be in a
-        * struct record
-        */
-       if (cpu_is_omap24xx() || cpu_is_omap34xx())
-               sys_ck_name = "sys_ck";
-       else if (cpu_is_omap44xx())
-               sys_ck_name = "sys_clkin_ck";
-       else
-               return -EINVAL;
-
-       /*
-        * Sys clk rate is require to calculate vp timeout value and
-        * smpswaittimemin and smpswaittimemax.
-        */
-       sys_ck = clk_get(NULL, sys_ck_name);
-       if (IS_ERR(sys_ck)) {
-               pr_warning("%s: Could not get the sys clk to calculate"
-                       "various vdd_%s params\n", __func__, vdd->voltdm.name);
-               return -EINVAL;
-       }
-       sys_clk_speed = clk_get_rate(sys_ck);
-       clk_put(sys_ck);
-       /* Divide to avoid overflow */
-       sys_clk_speed /= 1000;
-
-       /* Generic voltage parameters */
-       vdd->volt_scale = vp_forceupdate_scale_voltage;
-       vdd->vp_enabled = false;
-
-       vdd->vp_rt_data.vpconfig_erroroffset =
-               (vdd->pmic_info->vp_erroroffset <<
-                vdd->vp_data->vp_common->vpconfig_erroroffset_shift);
-
-       timeout_val = (sys_clk_speed * vdd->pmic_info->vp_timeout_us) / 1000;
-       vdd->vp_rt_data.vlimitto_timeout = timeout_val;
-       vdd->vp_rt_data.vlimitto_vddmin = vdd->pmic_info->vp_vddmin;
-       vdd->vp_rt_data.vlimitto_vddmax = vdd->pmic_info->vp_vddmax;
-
-       waittime = ((vdd->pmic_info->step_size / vdd->pmic_info->slew_rate) *
-                               sys_clk_speed) / 1000;
-       vdd->vp_rt_data.vstepmin_smpswaittimemin = waittime;
-       vdd->vp_rt_data.vstepmax_smpswaittimemax = waittime;
-       vdd->vp_rt_data.vstepmin_stepmin = vdd->pmic_info->vp_vstepmin;
-       vdd->vp_rt_data.vstepmax_stepmax = vdd->pmic_info->vp_vstepmax;
-
-       return 0;
-}
-
-/* Voltage debugfs support */
-static int vp_volt_debug_get(void *data, u64 *val)
-{
-       struct omap_vdd_info *vdd = (struct omap_vdd_info *) data;
-       u8 vsel;
-
-       if (!vdd) {
-               pr_warning("Wrong paramater passed\n");
-               return -EINVAL;
-       }
-
-       vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage);
-
-       if (!vdd->pmic_info->vsel_to_uv) {
-               pr_warning("PMIC function to convert vsel to voltage"
-                       "in uV not registerd\n");
-               return -EINVAL;
-       }
-
-       *val = vdd->pmic_info->vsel_to_uv(vsel);
-       return 0;
-}
-
-static int nom_volt_debug_get(void *data, u64 *val)
-{
-       struct omap_vdd_info *vdd = (struct omap_vdd_info *) data;
-
-       if (!vdd) {
-               pr_warning("Wrong paramater passed\n");
-               return -EINVAL;
-       }
-
-       *val = omap_voltage_get_nom_volt(&vdd->voltdm);
-
-       return 0;
-}
-
-DEFINE_SIMPLE_ATTRIBUTE(vp_volt_debug_fops, vp_volt_debug_get, NULL, "%llu\n");
-DEFINE_SIMPLE_ATTRIBUTE(nom_volt_debug_fops, nom_volt_debug_get, NULL,
-                                                               "%llu\n");
-static void vp_latch_vsel(struct omap_vdd_info *vdd)
-{
-       u32 vpconfig;
-       unsigned long uvdc;
-       char vsel;
-
-       uvdc = omap_voltage_get_nom_volt(&vdd->voltdm);
-       if (!uvdc) {
-               pr_warning("%s: unable to find current voltage for vdd_%s\n",
-                       __func__, vdd->voltdm.name);
-               return;
-       }
-
-       if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) {
-               pr_warning("%s: PMIC function to convert voltage in uV to"
-                       " vsel not registered\n", __func__);
-               return;
-       }
-
-       vsel = vdd->pmic_info->uv_to_vsel(uvdc);
-
-       vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
-       vpconfig &= ~(vdd->vp_data->vp_common->vpconfig_initvoltage_mask |
-                       vdd->vp_data->vp_common->vpconfig_initvdd);
-       vpconfig |= vsel << vdd->vp_data->vp_common->vpconfig_initvoltage_shift;
-
-       vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
-
-       /* Trigger initVDD value copy to voltage processor */
-       vdd->write_reg((vpconfig | vdd->vp_data->vp_common->vpconfig_initvdd),
-                      prm_mod_offs, vdd->vp_data->vpconfig);
-
-       /* Clear initVDD copy trigger bit */
-       vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
-}
-
-/* Generic voltage init functions */
-static void __init vp_init(struct omap_vdd_info *vdd)
-{
-       u32 vp_val;
-
-       if (!vdd->read_reg || !vdd->write_reg) {
-               pr_err("%s: No read/write API for accessing vdd_%s regs\n",
-                       __func__, vdd->voltdm.name);
-               return;
-       }
-
-       vp_val = vdd->vp_rt_data.vpconfig_erroroffset |
-               (vdd->vp_rt_data.vpconfig_errorgain <<
-               vdd->vp_data->vp_common->vpconfig_errorgain_shift) |
-               vdd->vp_data->vp_common->vpconfig_timeouten;
-       vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vpconfig);
-
-       vp_val = ((vdd->vp_rt_data.vstepmin_smpswaittimemin <<
-               vdd->vp_data->vp_common->vstepmin_smpswaittimemin_shift) |
-               (vdd->vp_rt_data.vstepmin_stepmin <<
-               vdd->vp_data->vp_common->vstepmin_stepmin_shift));
-       vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vstepmin);
-
-       vp_val = ((vdd->vp_rt_data.vstepmax_smpswaittimemax <<
-               vdd->vp_data->vp_common->vstepmax_smpswaittimemax_shift) |
-               (vdd->vp_rt_data.vstepmax_stepmax <<
-               vdd->vp_data->vp_common->vstepmax_stepmax_shift));
-       vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vstepmax);
-
-       vp_val = ((vdd->vp_rt_data.vlimitto_vddmax <<
-               vdd->vp_data->vp_common->vlimitto_vddmax_shift) |
-               (vdd->vp_rt_data.vlimitto_vddmin <<
-               vdd->vp_data->vp_common->vlimitto_vddmin_shift) |
-               (vdd->vp_rt_data.vlimitto_timeout <<
-               vdd->vp_data->vp_common->vlimitto_timeout_shift));
-       vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vlimitto);
-}
-
-static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
-{
-       char *name;
-
-       name = kzalloc(VOLTAGE_DIR_SIZE, GFP_KERNEL);
-       if (!name) {
-               pr_warning("%s: Unable to allocate memory for debugfs"
-                       " directory name for vdd_%s",
-                       __func__, vdd->voltdm.name);
-               return;
-       }
-       strcpy(name, "vdd_");
-       strcat(name, vdd->voltdm.name);
-
-       vdd->debug_dir = debugfs_create_dir(name, voltage_dir);
-       kfree(name);
-       if (IS_ERR(vdd->debug_dir)) {
-               pr_warning("%s: Unable to create debugfs directory for"
-                       " vdd_%s\n", __func__, vdd->voltdm.name);
-               vdd->debug_dir = NULL;
-               return;
-       }
-
-       (void) debugfs_create_x16("vp_errorgain", S_IRUGO, vdd->debug_dir,
-                               &(vdd->vp_rt_data.vpconfig_errorgain));
-       (void) debugfs_create_x16("vp_smpswaittimemin", S_IRUGO,
-                               vdd->debug_dir,
-                               &(vdd->vp_rt_data.vstepmin_smpswaittimemin));
-       (void) debugfs_create_x8("vp_stepmin", S_IRUGO, vdd->debug_dir,
-                               &(vdd->vp_rt_data.vstepmin_stepmin));
-       (void) debugfs_create_x16("vp_smpswaittimemax", S_IRUGO,
-                               vdd->debug_dir,
-                               &(vdd->vp_rt_data.vstepmax_smpswaittimemax));
-       (void) debugfs_create_x8("vp_stepmax", S_IRUGO, vdd->debug_dir,
-                               &(vdd->vp_rt_data.vstepmax_stepmax));
-       (void) debugfs_create_x8("vp_vddmax", S_IRUGO, vdd->debug_dir,
-                               &(vdd->vp_rt_data.vlimitto_vddmax));
-       (void) debugfs_create_x8("vp_vddmin", S_IRUGO, vdd->debug_dir,
-                               &(vdd->vp_rt_data.vlimitto_vddmin));
-       (void) debugfs_create_x16("vp_timeout", S_IRUGO, vdd->debug_dir,
-                               &(vdd->vp_rt_data.vlimitto_timeout));
-       (void) debugfs_create_file("curr_vp_volt", S_IRUGO, vdd->debug_dir,
-                               (void *) vdd, &vp_volt_debug_fops);
-       (void) debugfs_create_file("curr_nominal_volt", S_IRUGO,
-                               vdd->debug_dir, (void *) vdd,
-                               &nom_volt_debug_fops);
-}
-
-/* Voltage scale and accessory APIs */
-static int _pre_volt_scale(struct omap_vdd_info *vdd,
-               unsigned long target_volt, u8 *target_vsel, u8 *current_vsel)
-{
-       struct omap_volt_data *volt_data;
-       const struct omap_vc_common_data *vc_common;
-       const struct omap_vp_common_data *vp_common;
-       u32 vc_cmdval, vp_errgain_val;
-
-       vc_common = vdd->vc_data->vc_common;
-       vp_common = vdd->vp_data->vp_common;
-
-       /* Check if suffiecient pmic info is available for this vdd */
-       if (!vdd->pmic_info) {
-               pr_err("%s: Insufficient pmic info to scale the vdd_%s\n",
-                       __func__, vdd->voltdm.name);
-               return -EINVAL;
-       }
-
-       if (!vdd->pmic_info->uv_to_vsel) {
-               pr_err("%s: PMIC function to convert voltage in uV to"
-                       "vsel not registered. Hence unable to scale voltage"
-                       "for vdd_%s\n", __func__, vdd->voltdm.name);
-               return -ENODATA;
-       }
-
-       if (!vdd->read_reg || !vdd->write_reg) {
-               pr_err("%s: No read/write API for accessing vdd_%s regs\n",
-                       __func__, vdd->voltdm.name);
-               return -EINVAL;
-       }
-
-       /* Get volt_data corresponding to target_volt */
-       volt_data = omap_voltage_get_voltdata(&vdd->voltdm, target_volt);
-       if (IS_ERR(volt_data))
-               volt_data = NULL;
-
-       *target_vsel = vdd->pmic_info->uv_to_vsel(target_volt);
-       *current_vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage);
-
-       /* Setting the ON voltage to the new target voltage */
-       vc_cmdval = vdd->read_reg(prm_mod_offs, vdd->vc_data->cmdval_reg);
-       vc_cmdval &= ~vc_common->cmd_on_mask;
-       vc_cmdval |= (*target_vsel << vc_common->cmd_on_shift);
-       vdd->write_reg(vc_cmdval, prm_mod_offs, vdd->vc_data->cmdval_reg);
-
-       /* Setting vp errorgain based on the voltage */
-       if (volt_data) {
-               vp_errgain_val = vdd->read_reg(prm_mod_offs,
-                                              vdd->vp_data->vpconfig);
-               vdd->vp_rt_data.vpconfig_errorgain = volt_data->vp_errgain;
-               vp_errgain_val &= ~vp_common->vpconfig_errorgain_mask;
-               vp_errgain_val |= vdd->vp_rt_data.vpconfig_errorgain <<
-                       vp_common->vpconfig_errorgain_shift;
-               vdd->write_reg(vp_errgain_val, prm_mod_offs,
-                              vdd->vp_data->vpconfig);
-       }
-
-       return 0;
-}
-
-static void _post_volt_scale(struct omap_vdd_info *vdd,
-               unsigned long target_volt, u8 target_vsel, u8 current_vsel)
-{
-       u32 smps_steps = 0, smps_delay = 0;
-
-       smps_steps = abs(target_vsel - current_vsel);
-       /* SMPS slew rate / step size. 2us added as buffer. */
-       smps_delay = ((smps_steps * vdd->pmic_info->step_size) /
-                       vdd->pmic_info->slew_rate) + 2;
-       udelay(smps_delay);
-
-       vdd->curr_volt = target_volt;
-}
-
-/* vc_bypass_scale_voltage - VC bypass method of voltage scaling */
-static int vc_bypass_scale_voltage(struct omap_vdd_info *vdd,
-               unsigned long target_volt)
-{
-       u32 loop_cnt = 0, retries_cnt = 0;
-       u32 vc_valid, vc_bypass_val_reg, vc_bypass_value;
-       u8 target_vsel, current_vsel;
-       int ret;
-
-       ret = _pre_volt_scale(vdd, target_volt, &target_vsel, &current_vsel);
-       if (ret)
-               return ret;
-
-       vc_valid = vdd->vc_data->vc_common->valid;
-       vc_bypass_val_reg = vdd->vc_data->vc_common->bypass_val_reg;
-       vc_bypass_value = (target_vsel << vdd->vc_data->vc_common->data_shift) |
-                       (vdd->pmic_info->pmic_reg <<
-                       vdd->vc_data->vc_common->regaddr_shift) |
-                       (vdd->pmic_info->i2c_slave_addr <<
-                       vdd->vc_data->vc_common->slaveaddr_shift);
-
-       vdd->write_reg(vc_bypass_value, prm_mod_offs, vc_bypass_val_reg);
-       vdd->write_reg(vc_bypass_value | vc_valid, prm_mod_offs,
-                      vc_bypass_val_reg);
-
-       vc_bypass_value = vdd->read_reg(prm_mod_offs, vc_bypass_val_reg);
-       /*
-        * Loop till the bypass command is acknowledged from the SMPS.
-        * NOTE: This is legacy code. The loop count and retry count needs
-        * to be revisited.
-        */
-       while (!(vc_bypass_value & vc_valid)) {
-               loop_cnt++;
-
-               if (retries_cnt > 10) {
-                       pr_warning("%s: Retry count exceeded\n", __func__);
-                       return -ETIMEDOUT;
-               }
-
-               if (loop_cnt > 50) {
-                       retries_cnt++;
-                       loop_cnt = 0;
-                       udelay(10);
-               }
-               vc_bypass_value = vdd->read_reg(prm_mod_offs,
-                                               vc_bypass_val_reg);
-       }
-
-       _post_volt_scale(vdd, target_volt, target_vsel, current_vsel);
-       return 0;
-}
-
-/* VP force update method of voltage scaling */
-static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
-               unsigned long target_volt)
-{
-       u32 vpconfig;
-       u8 target_vsel, current_vsel, prm_irqst_reg;
-       int ret, timeout = 0;
-
-       ret = _pre_volt_scale(vdd, target_volt, &target_vsel, &current_vsel);
-       if (ret)
-               return ret;
-
-       prm_irqst_reg = vdd->vp_data->prm_irqst_data->prm_irqst_reg;
-
-       /*
-        * Clear all pending TransactionDone interrupt/status. Typical latency
-        * is <3us
-        */
-       while (timeout++ < VP_TRANXDONE_TIMEOUT) {
-               vdd->write_reg(vdd->vp_data->prm_irqst_data->tranxdone_status,
-                              prm_irqst_ocp_mod_offs, prm_irqst_reg);
-               if (!(vdd->read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) &
-                     vdd->vp_data->prm_irqst_data->tranxdone_status))
-                       break;
-               udelay(1);
-       }
-       if (timeout >= VP_TRANXDONE_TIMEOUT) {
-               pr_warning("%s: vdd_%s TRANXDONE timeout exceeded."
-                       "Voltage change aborted", __func__, vdd->voltdm.name);
-               return -ETIMEDOUT;
-       }
-
-       /* Configure for VP-Force Update */
-       vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
-       vpconfig &= ~(vdd->vp_data->vp_common->vpconfig_initvdd |
-                       vdd->vp_data->vp_common->vpconfig_forceupdate |
-                       vdd->vp_data->vp_common->vpconfig_initvoltage_mask);
-       vpconfig |= ((target_vsel <<
-                       vdd->vp_data->vp_common->vpconfig_initvoltage_shift));
-       vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
-
-       /* Trigger initVDD value copy to voltage processor */
-       vpconfig |= vdd->vp_data->vp_common->vpconfig_initvdd;
-       vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
-
-       /* Force update of voltage */
-       vpconfig |= vdd->vp_data->vp_common->vpconfig_forceupdate;
-       vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
-
-       /*
-        * Wait for TransactionDone. Typical latency is <200us.
-        * Depends on SMPSWAITTIMEMIN/MAX and voltage change
-        */
-       timeout = 0;
-       omap_test_timeout((vdd->read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) &
-                          vdd->vp_data->prm_irqst_data->tranxdone_status),
-                         VP_TRANXDONE_TIMEOUT, timeout);
-       if (timeout >= VP_TRANXDONE_TIMEOUT)
-               pr_err("%s: vdd_%s TRANXDONE timeout exceeded."
-                       "TRANXDONE never got set after the voltage update\n",
-                       __func__, vdd->voltdm.name);
-
-       _post_volt_scale(vdd, target_volt, target_vsel, current_vsel);
-
-       /*
-        * Disable TransactionDone interrupt , clear all status, clear
-        * control registers
-        */
-       timeout = 0;
-       while (timeout++ < VP_TRANXDONE_TIMEOUT) {
-               vdd->write_reg(vdd->vp_data->prm_irqst_data->tranxdone_status,
-                              prm_irqst_ocp_mod_offs, prm_irqst_reg);
-               if (!(vdd->read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) &
-                     vdd->vp_data->prm_irqst_data->tranxdone_status))
-                       break;
-               udelay(1);
-       }
-
-       if (timeout >= VP_TRANXDONE_TIMEOUT)
-               pr_warning("%s: vdd_%s TRANXDONE timeout exceeded while trying"
-                       "to clear the TRANXDONE status\n",
-                       __func__, vdd->voltdm.name);
-
-       vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
-       /* Clear initVDD copy trigger bit */
-       vpconfig &= ~vdd->vp_data->vp_common->vpconfig_initvdd;
-       vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
-       /* Clear force bit */
-       vpconfig &= ~vdd->vp_data->vp_common->vpconfig_forceupdate;
-       vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
-
-       return 0;
-}
-
-static void __init omap3_vfsm_init(struct omap_vdd_info *vdd)
-{
-       /*
-        * Voltage Manager FSM parameters init
-        * XXX This data should be passed in from the board file
-        */
-       vdd->write_reg(OMAP3_CLKSETUP, prm_mod_offs, OMAP3_PRM_CLKSETUP_OFFSET);
-       vdd->write_reg(OMAP3_VOLTOFFSET, prm_mod_offs,
-                      OMAP3_PRM_VOLTOFFSET_OFFSET);
-       vdd->write_reg(OMAP3_VOLTSETUP2, prm_mod_offs,
-                      OMAP3_PRM_VOLTSETUP2_OFFSET);
-}
-
-static void __init omap3_vc_init(struct omap_vdd_info *vdd)
-{
-       static bool is_initialized;
-       u8 on_vsel, onlp_vsel, ret_vsel, off_vsel;
-       u32 vc_val;
-
-       if (is_initialized)
-               return;
-
-       /* Set up the on, inactive, retention and off voltage */
-       on_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->on_volt);
-       onlp_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->onlp_volt);
-       ret_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->ret_volt);
-       off_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->off_volt);
-       vc_val  = ((on_vsel << vdd->vc_data->vc_common->cmd_on_shift) |
-               (onlp_vsel << vdd->vc_data->vc_common->cmd_onlp_shift) |
-               (ret_vsel << vdd->vc_data->vc_common->cmd_ret_shift) |
-               (off_vsel << vdd->vc_data->vc_common->cmd_off_shift));
-       vdd->write_reg(vc_val, prm_mod_offs, vdd->vc_data->cmdval_reg);
-
-       /*
-        * Generic VC parameters init
-        * XXX This data should be abstracted out
-        */
-       vdd->write_reg(OMAP3430_CMD1_MASK | OMAP3430_RAV1_MASK, prm_mod_offs,
-                       OMAP3_PRM_VC_CH_CONF_OFFSET);
-       vdd->write_reg(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN_MASK, prm_mod_offs,
-                       OMAP3_PRM_VC_I2C_CFG_OFFSET);
-
-       omap3_vfsm_init(vdd);
-
-       is_initialized = true;
-}
-
-
-/* OMAP4 specific voltage init functions */
-static void __init omap4_vc_init(struct omap_vdd_info *vdd)
-{
-       static bool is_initialized;
-       u32 vc_val;
-
-       if (is_initialized)
-               return;
-
-       /* TODO: Configure setup times and CMD_VAL values*/
-
-       /*
-        * Generic VC parameters init
-        * XXX This data should be abstracted out
-        */
-       vc_val = (OMAP4430_RAV_VDD_MPU_L_MASK | OMAP4430_CMD_VDD_MPU_L_MASK |
-                 OMAP4430_RAV_VDD_IVA_L_MASK | OMAP4430_CMD_VDD_IVA_L_MASK |
-                 OMAP4430_RAV_VDD_CORE_L_MASK | OMAP4430_CMD_VDD_CORE_L_MASK);
-       vdd->write_reg(vc_val, prm_mod_offs, OMAP4_PRM_VC_CFG_CHANNEL_OFFSET);
-
-       /* XXX These are magic numbers and do not belong! */
-       vc_val = (0x60 << OMAP4430_SCLL_SHIFT | 0x26 << OMAP4430_SCLH_SHIFT);
-       vdd->write_reg(vc_val, prm_mod_offs, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET);
-
-       is_initialized = true;
-}
-
-static void __init omap_vc_init(struct omap_vdd_info *vdd)
-{
-       u32 vc_val;
-
-       if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) {
-               pr_err("%s: PMIC info requried to configure vc for"
-                       "vdd_%s not populated.Hence cannot initialize vc\n",
-                       __func__, vdd->voltdm.name);
-               return;
-       }
-
-       if (!vdd->read_reg || !vdd->write_reg) {
-               pr_err("%s: No read/write API for accessing vdd_%s regs\n",
-                       __func__, vdd->voltdm.name);
-               return;
-       }
-
-       /* Set up the SMPS_SA(i2c slave address in VC */
-       vc_val = vdd->read_reg(prm_mod_offs,
-                              vdd->vc_data->vc_common->smps_sa_reg);
-       vc_val &= ~vdd->vc_data->smps_sa_mask;
-       vc_val |= vdd->pmic_info->i2c_slave_addr << vdd->vc_data->smps_sa_shift;
-       vdd->write_reg(vc_val, prm_mod_offs,
-                      vdd->vc_data->vc_common->smps_sa_reg);
-
-       /* Setup the VOLRA(pmic reg addr) in VC */
-       vc_val = vdd->read_reg(prm_mod_offs,
-                              vdd->vc_data->vc_common->smps_volra_reg);
-       vc_val &= ~vdd->vc_data->smps_volra_mask;
-       vc_val |= vdd->pmic_info->pmic_reg << vdd->vc_data->smps_volra_shift;
-       vdd->write_reg(vc_val, prm_mod_offs,
-                      vdd->vc_data->vc_common->smps_volra_reg);
-
-       /* Configure the setup times */
-       vc_val = vdd->read_reg(prm_mod_offs, vdd->vfsm->voltsetup_reg);
-       vc_val &= ~vdd->vfsm->voltsetup_mask;
-       vc_val |= vdd->pmic_info->volt_setup_time <<
-                       vdd->vfsm->voltsetup_shift;
-       vdd->write_reg(vc_val, prm_mod_offs, vdd->vfsm->voltsetup_reg);
-
-       if (cpu_is_omap34xx())
-               omap3_vc_init(vdd);
-       else if (cpu_is_omap44xx())
-               omap4_vc_init(vdd);
-}
-
-static int __init omap_vdd_data_configure(struct omap_vdd_info *vdd)
-{
-       int ret = -EINVAL;
-
-       if (!vdd->pmic_info) {
-               pr_err("%s: PMIC info requried to configure vdd_%s not"
-                       "populated.Hence cannot initialize vdd_%s\n",
-                       __func__, vdd->voltdm.name, vdd->voltdm.name);
-               goto ovdc_out;
-       }
-
-       if (IS_ERR_VALUE(_config_common_vdd_data(vdd)))
-               goto ovdc_out;
-
-       if (cpu_is_omap34xx()) {
-               vdd->read_reg = omap3_voltage_read_reg;
-               vdd->write_reg = omap3_voltage_write_reg;
-               ret = 0;
-       } else if (cpu_is_omap44xx()) {
-               vdd->read_reg = omap4_voltage_read_reg;
-               vdd->write_reg = omap4_voltage_write_reg;
-               ret = 0;
-       }
-
-ovdc_out:
-       return ret;
-}
+static LIST_HEAD(voltdm_list);
 
 /* Public functions */
 /**
- * omap_voltage_get_nom_volt() - Gets the current non-auto-compensated voltage
- * @voltdm:    pointer to the VDD for which current voltage info is needed
+ * voltdm_get_voltage() - Gets the current non-auto-compensated voltage
+ * @voltdm:    pointer to the voltdm for which current voltage info is needed
  *
- * API to get the current non-auto-compensated voltage for a VDD.
- * Returns 0 in case of error else returns the current voltage for the VDD.
+ * API to get the current non-auto-compensated voltage for a voltage domain.
+ * Returns 0 in case of error else returns the current voltage.
  */
-unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm)
+unsigned long voltdm_get_voltage(struct voltagedomain *voltdm)
 {
-       struct omap_vdd_info *vdd;
-
        if (!voltdm || IS_ERR(voltdm)) {
                pr_warning("%s: VDD specified does not exist!\n", __func__);
                return 0;
        }
 
-       vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
-
-       return vdd->curr_volt;
+       return voltdm->nominal_volt;
 }
 
 /**
- * omap_vp_get_curr_volt() - API to get the current vp voltage.
- * @voltdm:    pointer to the VDD.
- *
- * This API returns the current voltage for the specified voltage processor
- */
-unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
-{
-       struct omap_vdd_info *vdd;
-       u8 curr_vsel;
-
-       if (!voltdm || IS_ERR(voltdm)) {
-               pr_warning("%s: VDD specified does not exist!\n", __func__);
-               return 0;
-       }
-
-       vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
-       if (!vdd->read_reg) {
-               pr_err("%s: No read API for reading vdd_%s regs\n",
-                       __func__, voltdm->name);
-               return 0;
-       }
-
-       curr_vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage);
-
-       if (!vdd->pmic_info || !vdd->pmic_info->vsel_to_uv) {
-               pr_warning("%s: PMIC function to convert vsel to voltage"
-                       "in uV not registerd\n", __func__);
-               return 0;
-       }
-
-       return vdd->pmic_info->vsel_to_uv(curr_vsel);
-}
-
-/**
- * omap_vp_enable() - API to enable a particular VP
- * @voltdm:    pointer to the VDD whose VP is to be enabled.
- *
- * This API enables a particular voltage processor. Needed by the smartreflex
- * class drivers.
- */
-void omap_vp_enable(struct voltagedomain *voltdm)
-{
-       struct omap_vdd_info *vdd;
-       u32 vpconfig;
-
-       if (!voltdm || IS_ERR(voltdm)) {
-               pr_warning("%s: VDD specified does not exist!\n", __func__);
-               return;
-       }
-
-       vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
-       if (!vdd->read_reg || !vdd->write_reg) {
-               pr_err("%s: No read/write API for accessing vdd_%s regs\n",
-                       __func__, voltdm->name);
-               return;
-       }
-
-       /* If VP is already enabled, do nothing. Return */
-       if (vdd->vp_enabled)
-               return;
-
-       vp_latch_vsel(vdd);
-
-       /* Enable VP */
-       vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
-       vpconfig |= vdd->vp_data->vp_common->vpconfig_vpenable;
-       vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
-       vdd->vp_enabled = true;
-}
-
-/**
- * omap_vp_disable() - API to disable a particular VP
- * @voltdm:    pointer to the VDD whose VP is to be disabled.
- *
- * This API disables a particular voltage processor. Needed by the smartreflex
- * class drivers.
- */
-void omap_vp_disable(struct voltagedomain *voltdm)
-{
-       struct omap_vdd_info *vdd;
-       u32 vpconfig;
-       int timeout;
-
-       if (!voltdm || IS_ERR(voltdm)) {
-               pr_warning("%s: VDD specified does not exist!\n", __func__);
-               return;
-       }
-
-       vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
-       if (!vdd->read_reg || !vdd->write_reg) {
-               pr_err("%s: No read/write API for accessing vdd_%s regs\n",
-                       __func__, voltdm->name);
-               return;
-       }
-
-       /* If VP is already disabled, do nothing. Return */
-       if (!vdd->vp_enabled) {
-               pr_warning("%s: Trying to disable VP for vdd_%s when"
-                       "it is already disabled\n", __func__, voltdm->name);
-               return;
-       }
-
-       /* Disable VP */
-       vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
-       vpconfig &= ~vdd->vp_data->vp_common->vpconfig_vpenable;
-       vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
-
-       /*
-        * Wait for VP idle Typical latency is <2us. Maximum latency is ~100us
-        */
-       omap_test_timeout((vdd->read_reg(prm_mod_offs, vdd->vp_data->vstatus)),
-                               VP_IDLE_TIMEOUT, timeout);
-
-       if (timeout >= VP_IDLE_TIMEOUT)
-               pr_warning("%s: vdd_%s idle timedout\n",
-                       __func__, voltdm->name);
-
-       vdd->vp_enabled = false;
-
-       return;
-}
-
-/**
- * omap_voltage_scale_vdd() - API to scale voltage of a particular
- *                             voltage domain.
- * @voltdm:    pointer to the VDD which is to be scaled.
- * @target_volt:       The target voltage of the voltage domain
+ * voltdm_scale() - API to scale voltage of a particular voltage domain.
+ * @voltdm: pointer to the voltage domain which is to be scaled.
+ * @target_volt: The target voltage of the voltage domain
  *
  * This API should be called by the kernel to do the voltage scaling
- * for a particular voltage domain during dvfs or any other situation.
+ * for a particular voltage domain during DVFS.
  */
-int omap_voltage_scale_vdd(struct voltagedomain *voltdm,
-               unsigned long target_volt)
+int voltdm_scale(struct voltagedomain *voltdm,
+                unsigned long target_volt)
 {
-       struct omap_vdd_info *vdd;
+       int ret;
 
        if (!voltdm || IS_ERR(voltdm)) {
                pr_warning("%s: VDD specified does not exist!\n", __func__);
                return -EINVAL;
        }
 
-       vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
-
-       if (!vdd->volt_scale) {
+       if (!voltdm->scale) {
                pr_err("%s: No voltage scale API registered for vdd_%s\n",
                        __func__, voltdm->name);
                return -ENODATA;
        }
 
-       return vdd->volt_scale(vdd, target_volt);
+       ret = voltdm->scale(voltdm, target_volt);
+       if (!ret)
+               voltdm->nominal_volt = target_volt;
+
+       return ret;
 }
 
 /**
- * omap_voltage_reset() - Resets the voltage of a particular voltage domain
- *                     to that of the current OPP.
- * @voltdm:    pointer to the VDD whose voltage is to be reset.
+ * voltdm_reset() - Resets the voltage of a particular voltage domain
+ *                 to that of the current OPP.
+ * @voltdm: pointer to the voltage domain whose voltage is to be reset.
  *
  * This API finds out the correct voltage the voltage domain is supposed
  * to be at and resets the voltage to that level. Should be used especially
  * while disabling any voltage compensation modules.
  */
-void omap_voltage_reset(struct voltagedomain *voltdm)
+void voltdm_reset(struct voltagedomain *voltdm)
 {
-       unsigned long target_uvdc;
+       unsigned long target_volt;
 
        if (!voltdm || IS_ERR(voltdm)) {
                pr_warning("%s: VDD specified does not exist!\n", __func__);
                return;
        }
 
-       target_uvdc = omap_voltage_get_nom_volt(voltdm);
-       if (!target_uvdc) {
+       target_volt = voltdm_get_voltage(voltdm);
+       if (!target_volt) {
                pr_err("%s: unable to find current voltage for vdd_%s\n",
                        __func__, voltdm->name);
                return;
        }
 
-       omap_voltage_scale_vdd(voltdm, target_uvdc);
+       voltdm_scale(voltdm, target_volt);
 }
 
 /**
@@ -884,18 +133,14 @@ void omap_voltage_reset(struct voltagedomain *voltdm)
  *
  */
 void omap_voltage_get_volttable(struct voltagedomain *voltdm,
-               struct omap_volt_data **volt_data)
+                               struct omap_volt_data **volt_data)
 {
-       struct omap_vdd_info *vdd;
-
        if (!voltdm || IS_ERR(voltdm)) {
                pr_warning("%s: VDD specified does not exist!\n", __func__);
                return;
        }
 
-       vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
-
-       *volt_data = vdd->volt_data;
+       *volt_data = voltdm->volt_data;
 }
 
 /**
@@ -914,9 +159,8 @@ void omap_voltage_get_volttable(struct voltagedomain *voltdm,
  * domain or if there is no matching entry.
  */
 struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
-               unsigned long volt)
+                                                unsigned long volt)
 {
-       struct omap_vdd_info *vdd;
        int i;
 
        if (!voltdm || IS_ERR(voltdm)) {
@@ -924,17 +168,15 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
                return ERR_PTR(-EINVAL);
        }
 
-       vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
-
-       if (!vdd->volt_data) {
+       if (!voltdm->volt_data) {
                pr_warning("%s: voltage table does not exist for vdd_%s\n",
                        __func__, voltdm->name);
                return ERR_PTR(-ENODATA);
        }
 
-       for (i = 0; vdd->volt_data[i].volt_nominal != 0; i++) {
-               if (vdd->volt_data[i].volt_nominal == volt)
-                       return &vdd->volt_data[i];
+       for (i = 0; voltdm->volt_data[i].volt_nominal != 0; i++) {
+               if (voltdm->volt_data[i].volt_nominal == volt)
+                       return &voltdm->volt_data[i];
        }
 
        pr_notice("%s: Unable to match the current voltage with the voltage"
@@ -947,53 +189,24 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
  * omap_voltage_register_pmic() - API to register PMIC specific data
  * @voltdm:    pointer to the VDD for which the PMIC specific data is
  *             to be registered
- * @pmic_info: the structure containing pmic info
+ * @pmic:      the structure containing pmic info
  *
  * This API is to be called by the SOC/PMIC file to specify the
- * pmic specific info as present in omap_volt_pmic_info structure.
+ * pmic specific info as present in omap_voltdm_pmic structure.
  */
 int omap_voltage_register_pmic(struct voltagedomain *voltdm,
-               struct omap_volt_pmic_info *pmic_info)
+                              struct omap_voltdm_pmic *pmic)
 {
-       struct omap_vdd_info *vdd;
-
        if (!voltdm || IS_ERR(voltdm)) {
                pr_warning("%s: VDD specified does not exist!\n", __func__);
                return -EINVAL;
        }
 
-       vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
-
-       vdd->pmic_info = pmic_info;
+       voltdm->pmic = pmic;
 
        return 0;
 }
 
-/**
- * omap_voltage_get_dbgdir() - API to get pointer to the debugfs directory
- *                             corresponding to a voltage domain.
- *
- * @voltdm:    pointer to the VDD whose debug directory is required.
- *
- * This API returns pointer to the debugfs directory corresponding
- * to the voltage domain. Should be used by drivers requiring to
- * add any debug entry for a particular voltage domain. Returns NULL
- * in case of error.
- */
-struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
-{
-       struct omap_vdd_info *vdd;
-
-       if (!voltdm || IS_ERR(voltdm)) {
-               pr_warning("%s: VDD specified does not exist!\n", __func__);
-               return NULL;
-       }
-
-       vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
-
-       return vdd->debug_dir;
-}
-
 /**
  * omap_change_voltscale_method() - API to change the voltage scaling method.
  * @voltdm:    pointer to the VDD whose voltage scaling method
@@ -1005,23 +218,19 @@ struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
  * defined in voltage.h
  */
 void omap_change_voltscale_method(struct voltagedomain *voltdm,
-               int voltscale_method)
+                                 int voltscale_method)
 {
-       struct omap_vdd_info *vdd;
-
        if (!voltdm || IS_ERR(voltdm)) {
                pr_warning("%s: VDD specified does not exist!\n", __func__);
                return;
        }
 
-       vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
-
        switch (voltscale_method) {
        case VOLTSCALE_VPFORCEUPDATE:
-               vdd->volt_scale = vp_forceupdate_scale_voltage;
+               voltdm->scale = omap_vp_forceupdate_scale;
                return;
        case VOLTSCALE_VCBYPASS:
-               vdd->volt_scale = vc_bypass_scale_voltage;
+               voltdm->scale = omap_vc_bypass_scale;
                return;
        default:
                pr_warning("%s: Trying to change the method of voltage scaling"
@@ -1030,77 +239,192 @@ void omap_change_voltscale_method(struct voltagedomain *voltdm,
 }
 
 /**
- * omap_voltage_domain_lookup() - API to get the voltage domain pointer
- * @name:      Name of the voltage domain
+ * omap_voltage_late_init() - Init the various voltage parameters
  *
- * This API looks up in the global vdd_info struct for the
- * existence of voltage domain <name>. If it exists, the API returns
- * a pointer to the voltage domain structure corresponding to the
- * VDD<name>. Else retuns error pointer.
+ * This API is to be called in the later stages of the
+ * system boot to init the voltage controller and
+ * voltage processors.
  */
-struct voltagedomain *omap_voltage_domain_lookup(char *name)
+int __init omap_voltage_late_init(void)
 {
-       int i;
+       struct voltagedomain *voltdm;
 
-       if (!vdd_info) {
-               pr_err("%s: Voltage driver init not yet happened.Faulting!\n",
+       if (list_empty(&voltdm_list)) {
+               pr_err("%s: Voltage driver support not added\n",
                        __func__);
-               return ERR_PTR(-EINVAL);
+               return -EINVAL;
        }
 
-       if (!name) {
-               pr_err("%s: No name to get the votage domain!\n", __func__);
-               return ERR_PTR(-EINVAL);
+       list_for_each_entry(voltdm, &voltdm_list, node) {
+               struct clk *sys_ck;
+
+               if (!voltdm->scalable)
+                       continue;
+
+               sys_ck = clk_get(NULL, voltdm->sys_clk.name);
+               if (IS_ERR(sys_ck)) {
+                       pr_warning("%s: Could not get sys clk.\n", __func__);
+                       return -EINVAL;
+               }
+               voltdm->sys_clk.rate = clk_get_rate(sys_ck);
+               WARN_ON(!voltdm->sys_clk.rate);
+               clk_put(sys_ck);
+
+               if (voltdm->vc) {
+                       voltdm->scale = omap_vc_bypass_scale;
+                       omap_vc_init_channel(voltdm);
+               }
+
+               if (voltdm->vp) {
+                       voltdm->scale = omap_vp_forceupdate_scale;
+                       omap_vp_init(voltdm);
+               }
        }
 
-       for (i = 0; i < nr_scalable_vdd; i++) {
-               if (!(strcmp(name, vdd_info[i]->voltdm.name)))
-                       return &vdd_info[i]->voltdm;
+       return 0;
+}
+
+static struct voltagedomain *_voltdm_lookup(const char *name)
+{
+       struct voltagedomain *voltdm, *temp_voltdm;
+
+       voltdm = NULL;
+
+       list_for_each_entry(temp_voltdm, &voltdm_list, node) {
+               if (!strcmp(name, temp_voltdm->name)) {
+                       voltdm = temp_voltdm;
+                       break;
+               }
        }
 
-       return ERR_PTR(-EINVAL);
+       return voltdm;
 }
 
 /**
- * omap_voltage_late_init() - Init the various voltage parameters
+ * voltdm_add_pwrdm - add a powerdomain to a voltagedomain
+ * @voltdm: struct voltagedomain * to add the powerdomain to
+ * @pwrdm: struct powerdomain * to associate with a voltagedomain
  *
- * This API is to be called in the later stages of the
- * system boot to init the voltage controller and
- * voltage processors.
+ * Associate the powerdomain @pwrdm with a voltagedomain @voltdm.  This
+ * enables the use of voltdm_for_each_pwrdm().  Returns -EINVAL if
+ * presented with invalid pointers; -ENOMEM if memory could not be allocated;
+ * or 0 upon success.
  */
-int __init omap_voltage_late_init(void)
+int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm)
 {
-       int i;
+       if (!voltdm || !pwrdm)
+               return -EINVAL;
 
-       if (!vdd_info) {
-               pr_err("%s: Voltage driver support not added\n",
-                       __func__);
+       pr_debug("voltagedomain: associating powerdomain %s with voltagedomain "
+                "%s\n", pwrdm->name, voltdm->name);
+
+       list_add(&pwrdm->voltdm_node, &voltdm->pwrdm_list);
+
+       return 0;
+}
+
+/**
+ * voltdm_for_each_pwrdm - call function for each pwrdm in a voltdm
+ * @voltdm: struct voltagedomain * to iterate over
+ * @fn: callback function *
+ *
+ * Call the supplied function @fn for each powerdomain in the
+ * voltagedomain @voltdm.  Returns -EINVAL if presented with invalid
+ * pointers; or passes along the last return value of the callback
+ * function, which should be 0 for success or anything else to
+ * indicate failure.
+ */
+int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
+                         int (*fn)(struct voltagedomain *voltdm,
+                                   struct powerdomain *pwrdm))
+{
+       struct powerdomain *pwrdm;
+       int ret = 0;
+
+       if (!fn)
                return -EINVAL;
-       }
 
-       voltage_dir = debugfs_create_dir("voltage", NULL);
-       if (IS_ERR(voltage_dir))
-               pr_err("%s: Unable to create voltage debugfs main dir\n",
-                       __func__);
-       for (i = 0; i < nr_scalable_vdd; i++) {
-               if (omap_vdd_data_configure(vdd_info[i]))
-                       continue;
-               omap_vc_init(vdd_info[i]);
-               vp_init(vdd_info[i]);
-               vdd_debugfs_init(vdd_info[i]);
+       list_for_each_entry(pwrdm, &voltdm->pwrdm_list, voltdm_node)
+               ret = (*fn)(voltdm, pwrdm);
+
+       return ret;
+}
+
+/**
+ * voltdm_for_each - call function on each registered voltagedomain
+ * @fn: callback function *
+ *
+ * Call the supplied function @fn for each registered voltagedomain.
+ * The callback function @fn can return anything but 0 to bail out
+ * early from the iterator.  Returns the last return value of the
+ * callback function, which should be 0 for success or anything else
+ * to indicate failure; or -EINVAL if the function pointer is null.
+ */
+int voltdm_for_each(int (*fn)(struct voltagedomain *voltdm, void *user),
+                   void *user)
+{
+       struct voltagedomain *temp_voltdm;
+       int ret = 0;
+
+       if (!fn)
+               return -EINVAL;
+
+       list_for_each_entry(temp_voltdm, &voltdm_list, node) {
+               ret = (*fn)(temp_voltdm, user);
+               if (ret)
+                       break;
        }
 
-       return 0;
+       return ret;
 }
 
-/* XXX document */
-int __init omap_voltage_early_init(s16 prm_mod, s16 prm_irqst_ocp_mod,
-                                  struct omap_vdd_info *omap_vdd_array[],
-                                  u8 omap_vdd_count)
+static int _voltdm_register(struct voltagedomain *voltdm)
 {
-       prm_mod_offs = prm_mod;
-       prm_irqst_ocp_mod_offs = prm_irqst_ocp_mod;
-       vdd_info = omap_vdd_array;
-       nr_scalable_vdd = omap_vdd_count;
+       if (!voltdm || !voltdm->name)
+               return -EINVAL;
+
+       INIT_LIST_HEAD(&voltdm->pwrdm_list);
+       list_add(&voltdm->node, &voltdm_list);
+
+       pr_debug("voltagedomain: registered %s\n", voltdm->name);
+
        return 0;
 }
+
+/**
+ * voltdm_lookup - look up a voltagedomain by name, return a pointer
+ * @name: name of voltagedomain
+ *
+ * Find a registered voltagedomain by its name @name.  Returns a pointer
+ * to the struct voltagedomain if found, or NULL otherwise.
+ */
+struct voltagedomain *voltdm_lookup(const char *name)
+{
+       struct voltagedomain *voltdm ;
+
+       if (!name)
+               return NULL;
+
+       voltdm = _voltdm_lookup(name);
+
+       return voltdm;
+}
+
+/**
+ * voltdm_init - set up the voltagedomain layer
+ * @voltdm_list: array of struct voltagedomain pointers to register
+ *
+ * Loop through the array of voltagedomains @voltdm_list, registering all
+ * that are available on the current CPU. If voltdm_list is supplied
+ * and not null, all of the referenced voltagedomains will be
+ * registered.  No return value.
+ */
+void voltdm_init(struct voltagedomain **voltdms)
+{
+       struct voltagedomain **v;
+
+       if (voltdms) {
+               for (v = voltdms; *v; v++)
+                       _voltdm_register(*v);
+       }
+}
index e9f5408244e0bf21d3943282663851cdb69ffb7e..16a1b092cf36902b768010fc899b4defcded7eb3 100644 (file)
@@ -19,6 +19,8 @@
 #include "vc.h"
 #include "vp.h"
 
+struct powerdomain;
+
 /* XXX document */
 #define VOLTSCALE_VPFORCEUPDATE                1
 #define VOLTSCALE_VCBYPASS             2
 #define OMAP3_VOLTSETUP2       0xff
 
 /**
- * struct omap_vfsm_instance_data - per-voltage manager FSM register/bitfield
+ * struct omap_vfsm_instance - per-voltage manager FSM register/bitfield
  * data
  * @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register
  * @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base
- * @voltsetup_shift: SETUP_TIME* field shift in the PRM_VOLTSETUP* register
  *
  * XXX What about VOLTOFFSET/VOLTCTRL?
- * XXX It is not necessary to have both a _mask and a _shift for the same
- *     bitfield - remove one!
  */
-struct omap_vfsm_instance_data {
+struct omap_vfsm_instance {
        u32 voltsetup_mask;
        u8 voltsetup_reg;
-       u8 voltsetup_shift;
 };
 
 /**
  * struct voltagedomain - omap voltage domain global structure.
- * @name:      Name of the voltage domain which can be used as a unique
- *             identifier.
+ * @name: Name of the voltage domain which can be used as a unique identifier.
+ * @scalable: Whether or not this voltage domain is scalable
+ * @node: list_head linking all voltage domains
+ * @pwrdm_list: list_head linking all powerdomains in this voltagedomain
+ * @vc: pointer to VC channel associated with this voltagedomain
+ * @vp: pointer to VP associated with this voltagedomain
+ * @read: read a VC/VP register
+ * @write: write a VC/VP register
+ * @read: read-modify-write a VC/VP register
+ * @sys_clk: system clock name/frequency, used for various timing calculations
+ * @scale: function used to scale the voltage of the voltagedomain
+ * @nominal_volt: current nominal voltage for this voltage domain
+ * @volt_data: voltage table having the distinct voltages supported
+ *             by the domain and other associated per voltage data.
  */
 struct voltagedomain {
        char *name;
+       bool scalable;
+       struct list_head node;
+       struct list_head pwrdm_list;
+       struct omap_vc_channel *vc;
+       const struct omap_vfsm_instance *vfsm;
+       struct omap_vp_instance *vp;
+       struct omap_voltdm_pmic *pmic;
+
+       /* VC/VP register access functions: SoC specific */
+       u32 (*read) (u8 offset);
+       void (*write) (u32 val, u8 offset);
+       u32 (*rmw)(u32 mask, u32 bits, u8 offset);
+
+       union {
+               const char *name;
+               u32 rate;
+       } sys_clk;
+
+       int (*scale) (struct voltagedomain *voltdm,
+                     unsigned long target_volt);
+
+       u32 nominal_volt;
+       struct omap_volt_data *volt_data;
 };
 
 /**
@@ -77,13 +110,18 @@ struct omap_volt_data {
 };
 
 /**
- * struct omap_volt_pmic_info - PMIC specific data required by voltage driver.
+ * struct omap_voltdm_pmic - PMIC specific data required by voltage driver.
  * @slew_rate: PMIC slew rate (in uv/us)
  * @step_size: PMIC voltage step size (in uv)
+ * @i2c_slave_addr: I2C slave address of PMIC
+ * @volt_reg_addr: voltage configuration register address
+ * @cmd_reg_addr: command (on, on-LP, ret, off) configuration register address
+ * @i2c_high_speed: whether VC uses I2C high-speed mode to PMIC
+ * @i2c_mcode: master code value for I2C high-speed preamble transmission
  * @vsel_to_uv:        PMIC API to convert vsel value to actual voltage in uV.
  * @uv_to_vsel:        PMIC API to convert voltage in uV to vsel value.
  */
-struct omap_volt_pmic_info {
+struct omap_voltdm_pmic {
        int slew_rate;
        int step_size;
        u32 on_volt;
@@ -91,94 +129,44 @@ struct omap_volt_pmic_info {
        u32 ret_volt;
        u32 off_volt;
        u16 volt_setup_time;
+       u16 i2c_slave_addr;
+       u16 volt_reg_addr;
+       u16 cmd_reg_addr;
        u8 vp_erroroffset;
        u8 vp_vstepmin;
        u8 vp_vstepmax;
        u8 vp_vddmin;
        u8 vp_vddmax;
        u8 vp_timeout_us;
-       u8 i2c_slave_addr;
-       u8 pmic_reg;
+       bool i2c_high_speed;
+       u8 i2c_mcode;
        unsigned long (*vsel_to_uv) (const u8 vsel);
        u8 (*uv_to_vsel) (unsigned long uV);
 };
 
-/**
- * omap_vdd_info - Per Voltage Domain info
- *
- * @volt_data          : voltage table having the distinct voltages supported
- *                       by the domain and other associated per voltage data.
- * @pmic_info          : pmic specific parameters which should be populted by
- *                       the pmic drivers.
- * @vp_data            : the register values, shifts, masks for various
- *                       vp registers
- * @vp_rt_data          : VP data derived at runtime, not predefined
- * @vc_data            : structure containing various various vc registers,
- *                       shifts, masks etc.
- * @vfsm                : voltage manager FSM data
- * @voltdm             : pointer to the voltage domain structure
- * @debug_dir          : debug directory for this voltage domain.
- * @curr_volt          : current voltage for this vdd.
- * @vp_enabled         : flag to keep track of whether vp is enabled or not
- * @volt_scale         : API to scale the voltage of the vdd.
- */
-struct omap_vdd_info {
-       struct omap_volt_data *volt_data;
-       struct omap_volt_pmic_info *pmic_info;
-       struct omap_vp_instance_data *vp_data;
-       struct omap_vp_runtime_data vp_rt_data;
-       struct omap_vc_instance_data *vc_data;
-       const struct omap_vfsm_instance_data *vfsm;
-       struct voltagedomain voltdm;
-       struct dentry *debug_dir;
-       u32 curr_volt;
-       bool vp_enabled;
-       u32 (*read_reg) (u16 mod, u8 offset);
-       void (*write_reg) (u32 val, u16 mod, u8 offset);
-       int (*volt_scale) (struct omap_vdd_info *vdd,
-               unsigned long target_volt);
-};
-
-unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm);
-void omap_vp_enable(struct voltagedomain *voltdm);
-void omap_vp_disable(struct voltagedomain *voltdm);
-int omap_voltage_scale_vdd(struct voltagedomain *voltdm,
-               unsigned long target_volt);
-void omap_voltage_reset(struct voltagedomain *voltdm);
 void omap_voltage_get_volttable(struct voltagedomain *voltdm,
                struct omap_volt_data **volt_data);
 struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
                unsigned long volt);
-unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm);
-struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm);
-int __init omap_voltage_early_init(s16 prm_mod, s16 prm_irqst_mod,
-                                  struct omap_vdd_info *omap_vdd_array[],
-                                  u8 omap_vdd_count);
-#ifdef CONFIG_PM
 int omap_voltage_register_pmic(struct voltagedomain *voltdm,
-               struct omap_volt_pmic_info *pmic_info);
+                              struct omap_voltdm_pmic *pmic);
 void omap_change_voltscale_method(struct voltagedomain *voltdm,
                int voltscale_method);
-/* API to get the voltagedomain pointer */
-struct voltagedomain *omap_voltage_domain_lookup(char *name);
-
 int omap_voltage_late_init(void);
-#else
-static inline int omap_voltage_register_pmic(struct voltagedomain *voltdm,
-               struct omap_volt_pmic_info *pmic_info)
-{
-       return -EINVAL;
-}
-static inline  void omap_change_voltscale_method(struct voltagedomain *voltdm,
-               int voltscale_method) {}
-static inline int omap_voltage_late_init(void)
-{
-       return -EINVAL;
-}
-static inline struct voltagedomain *omap_voltage_domain_lookup(char *name)
-{
-       return ERR_PTR(-EINVAL);
-}
-#endif
 
+extern void omap2xxx_voltagedomains_init(void);
+extern void omap3xxx_voltagedomains_init(void);
+extern void omap44xx_voltagedomains_init(void);
+
+struct voltagedomain *voltdm_lookup(const char *name);
+void voltdm_init(struct voltagedomain **voltdm_list);
+int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm);
+int voltdm_for_each(int (*fn)(struct voltagedomain *voltdm, void *user),
+                   void *user);
+int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
+                         int (*fn)(struct voltagedomain *voltdm,
+                                   struct powerdomain *pwrdm));
+int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt);
+void voltdm_reset(struct voltagedomain *voltdm);
+unsigned long voltdm_get_voltage(struct voltagedomain *voltdm);
 #endif
diff --git a/arch/arm/mach-omap2/voltagedomains2xxx_data.c b/arch/arm/mach-omap2/voltagedomains2xxx_data.c
new file mode 100644 (file)
index 0000000..7a41349
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * OMAP3 voltage domain data
+ *
+ * Copyright (C) 2011 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#include "voltage.h"
+
+static struct voltagedomain omap2_voltdm_core = {
+       .name = "core",
+};
+
+static struct voltagedomain omap2_voltdm_wkup = {
+       .name = "wakeup",
+};
+
+static struct voltagedomain *voltagedomains_omap2[] __initdata = {
+       &omap2_voltdm_core,
+       &omap2_voltdm_wkup,
+       NULL,
+};
+
+void __init omap2xxx_voltagedomains_init(void)
+{
+       voltdm_init(voltagedomains_omap2);
+}
index def230fd2fded3f23a73ef1323a7acf6f2db1249..071101debbbc1269153a43e1c04336e42a365a0e 100644 (file)
  * VDD data
  */
 
-static const struct omap_vfsm_instance_data omap3_vdd1_vfsm_data = {
+static const struct omap_vfsm_instance omap3_vdd1_vfsm = {
        .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET,
-       .voltsetup_shift = OMAP3430_SETUP_TIME1_SHIFT,
        .voltsetup_mask = OMAP3430_SETUP_TIME1_MASK,
 };
 
-static struct omap_vdd_info omap3_vdd1_info = {
-       .vp_data = &omap3_vp1_data,
-       .vc_data = &omap3_vc1_data,
-       .vfsm = &omap3_vdd1_vfsm_data,
-       .voltdm = {
-               .name = "mpu",
-       },
-};
-
-static const struct omap_vfsm_instance_data omap3_vdd2_vfsm_data = {
+static const struct omap_vfsm_instance omap3_vdd2_vfsm = {
        .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET,
-       .voltsetup_shift = OMAP3430_SETUP_TIME2_SHIFT,
        .voltsetup_mask = OMAP3430_SETUP_TIME2_MASK,
 };
 
-static struct omap_vdd_info omap3_vdd2_info = {
-       .vp_data = &omap3_vp2_data,
-       .vc_data = &omap3_vc2_data,
-       .vfsm = &omap3_vdd2_vfsm_data,
-       .voltdm = {
-               .name = "core",
-       },
+static struct voltagedomain omap3_voltdm_mpu = {
+       .name = "mpu_iva",
+       .scalable = true,
+       .read = omap3_prm_vcvp_read,
+       .write = omap3_prm_vcvp_write,
+       .rmw = omap3_prm_vcvp_rmw,
+       .vc = &omap3_vc_mpu,
+       .vfsm = &omap3_vdd1_vfsm,
+       .vp = &omap3_vp_mpu,
 };
 
-/* OMAP3 VDD structures */
-static struct omap_vdd_info *omap3_vdd_info[] = {
-       &omap3_vdd1_info,
-       &omap3_vdd2_info,
+static struct voltagedomain omap3_voltdm_core = {
+       .name = "core",
+       .scalable = true,
+       .read = omap3_prm_vcvp_read,
+       .write = omap3_prm_vcvp_write,
+       .rmw = omap3_prm_vcvp_rmw,
+       .vc = &omap3_vc_core,
+       .vfsm = &omap3_vdd2_vfsm,
+       .vp = &omap3_vp_core,
 };
 
-/* OMAP3 specific voltage init functions */
-static int __init omap3xxx_voltage_early_init(void)
-{
-       s16 prm_mod = OMAP3430_GR_MOD;
-       s16 prm_irqst_ocp_mod = OCP_MOD;
+static struct voltagedomain omap3_voltdm_wkup = {
+       .name = "wakeup",
+};
 
-       if (!cpu_is_omap34xx())
-               return 0;
+static struct voltagedomain *voltagedomains_omap3[] __initdata = {
+       &omap3_voltdm_mpu,
+       &omap3_voltdm_core,
+       &omap3_voltdm_wkup,
+       NULL,
+};
+
+static const char *sys_clk_name __initdata = "sys_ck";
+
+void __init omap3xxx_voltagedomains_init(void)
+{
+       struct voltagedomain *voltdm;
+       int i;
 
        /*
         * XXX Will depend on the process, validation, and binning
         * for the currently-running IC
         */
        if (cpu_is_omap3630()) {
-               omap3_vdd1_info.volt_data = omap36xx_vddmpu_volt_data;
-               omap3_vdd2_info.volt_data = omap36xx_vddcore_volt_data;
+               omap3_voltdm_mpu.volt_data = omap36xx_vddmpu_volt_data;
+               omap3_voltdm_core.volt_data = omap36xx_vddcore_volt_data;
        } else {
-               omap3_vdd1_info.volt_data = omap34xx_vddmpu_volt_data;
-               omap3_vdd2_info.volt_data = omap34xx_vddcore_volt_data;
+               omap3_voltdm_mpu.volt_data = omap34xx_vddmpu_volt_data;
+               omap3_voltdm_core.volt_data = omap34xx_vddcore_volt_data;
        }
 
-       return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod,
-                                      omap3_vdd_info,
-                                      ARRAY_SIZE(omap3_vdd_info));
+       for (i = 0; voltdm = voltagedomains_omap3[i], voltdm; i++)
+               voltdm->sys_clk.name = sys_clk_name;
+
+       voltdm_init(voltagedomains_omap3);
 };
-core_initcall(omap3xxx_voltage_early_init);
index cb64996de0e1a6e6521abfe13eafd4fa293eafc6..c4584e9ac717993c6b709b0335438c7efc4442a9 100644 (file)
 #include "vc.h"
 #include "vp.h"
 
-static const struct omap_vfsm_instance_data omap4_vdd_mpu_vfsm_data = {
+static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = {
        .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET,
 };
 
-static struct omap_vdd_info omap4_vdd_mpu_info = {
-       .vp_data = &omap4_vp_mpu_data,
-       .vc_data = &omap4_vc_mpu_data,
-       .vfsm = &omap4_vdd_mpu_vfsm_data,
-       .voltdm = {
-               .name = "mpu",
-       },
+static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = {
+       .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET,
 };
 
-static const struct omap_vfsm_instance_data omap4_vdd_iva_vfsm_data = {
-       .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET,
+static const struct omap_vfsm_instance omap4_vdd_core_vfsm = {
+       .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET,
 };
 
-static struct omap_vdd_info omap4_vdd_iva_info = {
-       .vp_data = &omap4_vp_iva_data,
-       .vc_data = &omap4_vc_iva_data,
-       .vfsm = &omap4_vdd_iva_vfsm_data,
-       .voltdm = {
-               .name = "iva",
-       },
+static struct voltagedomain omap4_voltdm_mpu = {
+       .name = "mpu",
+       .scalable = true,
+       .read = omap4_prm_vcvp_read,
+       .write = omap4_prm_vcvp_write,
+       .rmw = omap4_prm_vcvp_rmw,
+       .vc = &omap4_vc_mpu,
+       .vfsm = &omap4_vdd_mpu_vfsm,
+       .vp = &omap4_vp_mpu,
 };
 
-static const struct omap_vfsm_instance_data omap4_vdd_core_vfsm_data = {
-       .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET,
+static struct voltagedomain omap4_voltdm_iva = {
+       .name = "iva",
+       .scalable = true,
+       .read = omap4_prm_vcvp_read,
+       .write = omap4_prm_vcvp_write,
+       .rmw = omap4_prm_vcvp_rmw,
+       .vc = &omap4_vc_iva,
+       .vfsm = &omap4_vdd_iva_vfsm,
+       .vp = &omap4_vp_iva,
 };
 
-static struct omap_vdd_info omap4_vdd_core_info = {
-       .vp_data = &omap4_vp_core_data,
-       .vc_data = &omap4_vc_core_data,
-       .vfsm = &omap4_vdd_core_vfsm_data,
-       .voltdm = {
-               .name = "core",
-       },
+static struct voltagedomain omap4_voltdm_core = {
+       .name = "core",
+       .scalable = true,
+       .read = omap4_prm_vcvp_read,
+       .write = omap4_prm_vcvp_write,
+       .rmw = omap4_prm_vcvp_rmw,
+       .vc = &omap4_vc_core,
+       .vfsm = &omap4_vdd_core_vfsm,
+       .vp = &omap4_vp_core,
 };
 
-/* OMAP4 VDD structures */
-static struct omap_vdd_info *omap4_vdd_info[] = {
-       &omap4_vdd_mpu_info,
-       &omap4_vdd_iva_info,
-       &omap4_vdd_core_info,
+static struct voltagedomain omap4_voltdm_wkup = {
+       .name = "wakeup",
 };
 
-/* OMAP4 specific voltage init functions */
-static int __init omap44xx_voltage_early_init(void)
-{
-       s16 prm_mod = OMAP4430_PRM_DEVICE_INST;
-       s16 prm_irqst_ocp_mod = OMAP4430_PRM_OCP_SOCKET_INST;
+static struct voltagedomain *voltagedomains_omap4[] __initdata = {
+       &omap4_voltdm_mpu,
+       &omap4_voltdm_iva,
+       &omap4_voltdm_core,
+       &omap4_voltdm_wkup,
+       NULL,
+};
+
+static const char *sys_clk_name __initdata = "sys_clkin_ck";
 
-       if (!cpu_is_omap44xx())
-               return 0;
+void __init omap44xx_voltagedomains_init(void)
+{
+       struct voltagedomain *voltdm;
+       int i;
 
        /*
         * XXX Will depend on the process, validation, and binning
         * for the currently-running IC
         */
-       omap4_vdd_mpu_info.volt_data = omap44xx_vdd_mpu_volt_data;
-       omap4_vdd_iva_info.volt_data = omap44xx_vdd_iva_volt_data;
-       omap4_vdd_core_info.volt_data = omap44xx_vdd_core_volt_data;
+       omap4_voltdm_mpu.volt_data = omap44xx_vdd_mpu_volt_data;
+       omap4_voltdm_iva.volt_data = omap44xx_vdd_iva_volt_data;
+       omap4_voltdm_core.volt_data = omap44xx_vdd_core_volt_data;
+
+       for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++)
+               voltdm->sys_clk.name = sys_clk_name;
 
-       return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod,
-                                      omap4_vdd_info,
-                                      ARRAY_SIZE(omap4_vdd_info));
+       voltdm_init(voltagedomains_omap4);
 };
-core_initcall(omap44xx_voltage_early_init);
diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
new file mode 100644 (file)
index 0000000..66bd700
--- /dev/null
@@ -0,0 +1,278 @@
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#include <plat/common.h>
+
+#include "voltage.h"
+#include "vp.h"
+#include "prm-regbits-34xx.h"
+#include "prm-regbits-44xx.h"
+#include "prm44xx.h"
+
+static u32 _vp_set_init_voltage(struct voltagedomain *voltdm, u32 volt)
+{
+       struct omap_vp_instance *vp = voltdm->vp;
+       u32 vpconfig;
+       char vsel;
+
+       vsel = voltdm->pmic->uv_to_vsel(volt);
+
+       vpconfig = voltdm->read(vp->vpconfig);
+       vpconfig &= ~(vp->common->vpconfig_initvoltage_mask |
+                     vp->common->vpconfig_forceupdate |
+                     vp->common->vpconfig_initvdd);
+       vpconfig |= vsel << __ffs(vp->common->vpconfig_initvoltage_mask);
+       voltdm->write(vpconfig, vp->vpconfig);
+
+       /* Trigger initVDD value copy to voltage processor */
+       voltdm->write((vpconfig | vp->common->vpconfig_initvdd),
+                      vp->vpconfig);
+
+       /* Clear initVDD copy trigger bit */
+       voltdm->write(vpconfig, vp->vpconfig);
+
+       return vpconfig;
+}
+
+/* Generic voltage init functions */
+void __init omap_vp_init(struct voltagedomain *voltdm)
+{
+       struct omap_vp_instance *vp = voltdm->vp;
+       u32 val, sys_clk_rate, timeout, waittime;
+       u32 vddmin, vddmax, vstepmin, vstepmax;
+
+       if (!voltdm->read || !voltdm->write) {
+               pr_err("%s: No read/write API for accessing vdd_%s regs\n",
+                       __func__, voltdm->name);
+               return;
+       }
+
+       vp->enabled = false;
+
+       /* Divide to avoid overflow */
+       sys_clk_rate = voltdm->sys_clk.rate / 1000;
+
+       timeout = (sys_clk_rate * voltdm->pmic->vp_timeout_us) / 1000;
+       vddmin = voltdm->pmic->vp_vddmin;
+       vddmax = voltdm->pmic->vp_vddmax;
+
+       waittime = ((voltdm->pmic->step_size / voltdm->pmic->slew_rate) *
+                   sys_clk_rate) / 1000;
+       vstepmin = voltdm->pmic->vp_vstepmin;
+       vstepmax = voltdm->pmic->vp_vstepmax;
+
+       /*
+        * VP_CONFIG: error gain is not set here, it will be updated
+        * on each scale, based on OPP.
+        */
+       val = (voltdm->pmic->vp_erroroffset <<
+              __ffs(voltdm->vp->common->vpconfig_erroroffset_mask)) |
+               vp->common->vpconfig_timeouten;
+       voltdm->write(val, vp->vpconfig);
+
+       /* VSTEPMIN */
+       val = (waittime << vp->common->vstepmin_smpswaittimemin_shift) |
+               (vstepmin <<  vp->common->vstepmin_stepmin_shift);
+       voltdm->write(val, vp->vstepmin);
+
+       /* VSTEPMAX */
+       val = (vstepmax << vp->common->vstepmax_stepmax_shift) |
+               (waittime << vp->common->vstepmax_smpswaittimemax_shift);
+       voltdm->write(val, vp->vstepmax);
+
+       /* VLIMITTO */
+       val = (vddmax << vp->common->vlimitto_vddmax_shift) |
+               (vddmin << vp->common->vlimitto_vddmin_shift) |
+               (timeout <<  vp->common->vlimitto_timeout_shift);
+       voltdm->write(val, vp->vlimitto);
+}
+
+int omap_vp_update_errorgain(struct voltagedomain *voltdm,
+                            unsigned long target_volt)
+{
+       struct omap_volt_data *volt_data;
+
+       if (!voltdm->vp)
+               return -EINVAL;
+
+       /* Get volt_data corresponding to target_volt */
+       volt_data = omap_voltage_get_voltdata(voltdm, target_volt);
+       if (IS_ERR(volt_data))
+               return -EINVAL;
+
+       /* Setting vp errorgain based on the voltage */
+       voltdm->rmw(voltdm->vp->common->vpconfig_errorgain_mask,
+                   volt_data->vp_errgain <<
+                   __ffs(voltdm->vp->common->vpconfig_errorgain_mask),
+                   voltdm->vp->vpconfig);
+
+       return 0;
+}
+
+/* VP force update method of voltage scaling */
+int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
+                             unsigned long target_volt)
+{
+       struct omap_vp_instance *vp = voltdm->vp;
+       u32 vpconfig;
+       u8 target_vsel, current_vsel;
+       int ret, timeout = 0;
+
+       ret = omap_vc_pre_scale(voltdm, target_volt, &target_vsel, &current_vsel);
+       if (ret)
+               return ret;
+
+       /*
+        * Clear all pending TransactionDone interrupt/status. Typical latency
+        * is <3us
+        */
+       while (timeout++ < VP_TRANXDONE_TIMEOUT) {
+               vp->common->ops->clear_txdone(vp->id);
+               if (!vp->common->ops->check_txdone(vp->id))
+                       break;
+               udelay(1);
+       }
+       if (timeout >= VP_TRANXDONE_TIMEOUT) {
+               pr_warning("%s: vdd_%s TRANXDONE timeout exceeded."
+                       "Voltage change aborted", __func__, voltdm->name);
+               return -ETIMEDOUT;
+       }
+
+       vpconfig = _vp_set_init_voltage(voltdm, target_volt);
+
+       /* Force update of voltage */
+       voltdm->write(vpconfig | vp->common->vpconfig_forceupdate,
+                     voltdm->vp->vpconfig);
+
+       /*
+        * Wait for TransactionDone. Typical latency is <200us.
+        * Depends on SMPSWAITTIMEMIN/MAX and voltage change
+        */
+       timeout = 0;
+       omap_test_timeout(vp->common->ops->check_txdone(vp->id),
+                         VP_TRANXDONE_TIMEOUT, timeout);
+       if (timeout >= VP_TRANXDONE_TIMEOUT)
+               pr_err("%s: vdd_%s TRANXDONE timeout exceeded."
+                       "TRANXDONE never got set after the voltage update\n",
+                       __func__, voltdm->name);
+
+       omap_vc_post_scale(voltdm, target_volt, target_vsel, current_vsel);
+
+       /*
+        * Disable TransactionDone interrupt , clear all status, clear
+        * control registers
+        */
+       timeout = 0;
+       while (timeout++ < VP_TRANXDONE_TIMEOUT) {
+               vp->common->ops->clear_txdone(vp->id);
+               if (!vp->common->ops->check_txdone(vp->id))
+                       break;
+               udelay(1);
+       }
+
+       if (timeout >= VP_TRANXDONE_TIMEOUT)
+               pr_warning("%s: vdd_%s TRANXDONE timeout exceeded while trying"
+                       "to clear the TRANXDONE status\n",
+                       __func__, voltdm->name);
+
+       /* Clear force bit */
+       voltdm->write(vpconfig, vp->vpconfig);
+
+       return 0;
+}
+
+/**
+ * omap_vp_enable() - API to enable a particular VP
+ * @voltdm:    pointer to the VDD whose VP is to be enabled.
+ *
+ * This API enables a particular voltage processor. Needed by the smartreflex
+ * class drivers.
+ */
+void omap_vp_enable(struct voltagedomain *voltdm)
+{
+       struct omap_vp_instance *vp;
+       u32 vpconfig, volt;
+
+       if (!voltdm || IS_ERR(voltdm)) {
+               pr_warning("%s: VDD specified does not exist!\n", __func__);
+               return;
+       }
+
+       vp = voltdm->vp;
+       if (!voltdm->read || !voltdm->write) {
+               pr_err("%s: No read/write API for accessing vdd_%s regs\n",
+                       __func__, voltdm->name);
+               return;
+       }
+
+       /* If VP is already enabled, do nothing. Return */
+       if (vp->enabled)
+               return;
+
+       volt = voltdm_get_voltage(voltdm);
+       if (!volt) {
+               pr_warning("%s: unable to find current voltage for %s\n",
+                          __func__, voltdm->name);
+               return;
+       }
+
+       vpconfig = _vp_set_init_voltage(voltdm, volt);
+
+       /* Enable VP */
+       vpconfig |= vp->common->vpconfig_vpenable;
+       voltdm->write(vpconfig, vp->vpconfig);
+
+       vp->enabled = true;
+}
+
+/**
+ * omap_vp_disable() - API to disable a particular VP
+ * @voltdm:    pointer to the VDD whose VP is to be disabled.
+ *
+ * This API disables a particular voltage processor. Needed by the smartreflex
+ * class drivers.
+ */
+void omap_vp_disable(struct voltagedomain *voltdm)
+{
+       struct omap_vp_instance *vp;
+       u32 vpconfig;
+       int timeout;
+
+       if (!voltdm || IS_ERR(voltdm)) {
+               pr_warning("%s: VDD specified does not exist!\n", __func__);
+               return;
+       }
+
+       vp = voltdm->vp;
+       if (!voltdm->read || !voltdm->write) {
+               pr_err("%s: No read/write API for accessing vdd_%s regs\n",
+                       __func__, voltdm->name);
+               return;
+       }
+
+       /* If VP is already disabled, do nothing. Return */
+       if (!vp->enabled) {
+               pr_warning("%s: Trying to disable VP for vdd_%s when"
+                       "it is already disabled\n", __func__, voltdm->name);
+               return;
+       }
+
+       /* Disable VP */
+       vpconfig = voltdm->read(vp->vpconfig);
+       vpconfig &= ~vp->common->vpconfig_vpenable;
+       voltdm->write(vpconfig, vp->vpconfig);
+
+       /*
+        * Wait for VP idle Typical latency is <2us. Maximum latency is ~100us
+        */
+       omap_test_timeout((voltdm->read(vp->vstatus)),
+                         VP_IDLE_TIMEOUT, timeout);
+
+       if (timeout >= VP_IDLE_TIMEOUT)
+               pr_warning("%s: vdd_%s idle timedout\n",
+                       __func__, voltdm->name);
+
+       vp->enabled = false;
+
+       return;
+}
index 7ce134f7de79031a6af9f245906ca0965ceb5e92..7c155d248aa3b5b1dc62f8e1bb8fcc8adf98c221 100644 (file)
 
 #include <linux/kernel.h>
 
+struct voltagedomain;
+
+/*
+ * Voltage Processor (VP) identifiers
+ */
+#define OMAP3_VP_VDD_MPU_ID 0
+#define OMAP3_VP_VDD_CORE_ID 1
+#define OMAP4_VP_VDD_CORE_ID 0
+#define OMAP4_VP_VDD_IVA_ID 1
+#define OMAP4_VP_VDD_MPU_ID 2
+
 /* XXX document */
 #define VP_IDLE_TIMEOUT                200
 #define VP_TRANXDONE_TIMEOUT   300
 
+/**
+ * struct omap_vp_ops - per-VP operations
+ * @check_txdone: check for VP transaction done
+ * @clear_txdone: clear VP transaction done status
+ */
+struct omap_vp_ops {
+       u32 (*check_txdone)(u8 vp_id);
+       void (*clear_txdone)(u8 vp_id);
+};
 
 /**
- * struct omap_vp_common_data - register data common to all VDDs
+ * struct omap_vp_common - register data common to all VDDs
+ * @vpconfig_erroroffset_mask: ERROROFFSET bitmask in the PRM_VP*_CONFIG reg
  * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg
  * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg
- * @vpconfig_timeouten_mask: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
+ * @vpconfig_timeouten: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
  * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg
  * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg
  * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg
  * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg
  * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg
  * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg
- * @vpconfig_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
- * @vpconfig_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
- * @vpconfig_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
- * @vpconfig_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
- * @vpconfig_vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
- * @vpconfig_vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
- * @vpconfig_vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
- *
- * XXX It it not necessary to have both a mask and a shift for the same
- *     bitfield - remove one
- * XXX Many of these fields are wrongly named -- e.g., vpconfig_smps* -- fix!
+ * @vstepmin_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
+ * @vstepmin_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
+ * @vstepmax_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
+ * @vstepmax_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
+ * @vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
+ * @vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
+ * @vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
+ * @vpvoltage_mask: VPVOLTAGE field mask in PRM_VP*_VOLTAGE reg
  */
-struct omap_vp_common_data {
+struct omap_vp_common {
+       u32 vpconfig_erroroffset_mask;
        u32 vpconfig_errorgain_mask;
        u32 vpconfig_initvoltage_mask;
-       u32 vpconfig_timeouten;
-       u32 vpconfig_initvdd;
-       u32 vpconfig_forceupdate;
-       u32 vpconfig_vpenable;
-       u8 vpconfig_erroroffset_shift;
-       u8 vpconfig_errorgain_shift;
-       u8 vpconfig_initvoltage_shift;
+       u8 vpconfig_timeouten;
+       u8 vpconfig_initvdd;
+       u8 vpconfig_forceupdate;
+       u8 vpconfig_vpenable;
        u8 vstepmin_stepmin_shift;
        u8 vstepmin_smpswaittimemin_shift;
        u8 vstepmax_stepmax_shift;
@@ -64,80 +80,49 @@ struct omap_vp_common_data {
        u8 vlimitto_vddmin_shift;
        u8 vlimitto_vddmax_shift;
        u8 vlimitto_timeout_shift;
-};
+       u8 vpvoltage_mask;
 
-/**
- * struct omap_vp_prm_irqst_data - PRM_IRQSTATUS_MPU.VP_TRANXDONE_ST data
- * @prm_irqst_reg: reg offset for PRM_IRQSTATUS_MPU from top of PRM
- * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
- *
- * XXX prm_irqst_reg does not belong here
- * XXX Note that on OMAP3, VP_TRANXDONE interrupt may not work due to a
- *     hardware bug
- * XXX This structure is probably not needed
- */
-struct omap_vp_prm_irqst_data {
-       u8 prm_irqst_reg;
-       u32 tranxdone_status;
+       const struct omap_vp_ops *ops;
 };
 
 /**
- * struct omap_vp_instance_data - VP register offsets (per-VDD)
- * @vp_common: pointer to struct omap_vp_common_data * for this SoC
- * @prm_irqst_data: pointer to struct omap_vp_prm_irqst_data for this VDD
+ * struct omap_vp_instance - VP register offsets (per-VDD)
+ * @common: pointer to struct omap_vp_common * for this SoC
  * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
  * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
  * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
  * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
  * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
+ * @id: Unique identifier for VP instance.
+ * @enabled: flag to keep track of whether vp is enabled or not
  *
  * XXX vp_common is probably not needed since it is per-SoC
  */
-struct omap_vp_instance_data {
-       const struct omap_vp_common_data *vp_common;
-       const struct omap_vp_prm_irqst_data *prm_irqst_data;
+struct omap_vp_instance {
+       const struct omap_vp_common *common;
        u8 vpconfig;
        u8 vstepmin;
        u8 vstepmax;
        u8 vlimitto;
        u8 vstatus;
        u8 voltage;
+       u8 id;
+       bool enabled;
 };
 
-/**
- * struct omap_vp_runtime_data - VP data populated at runtime by code
- * @vpconfig_erroroffset: value of ERROROFFSET bitfield in PRM_VP*_CONFIG
- * @vpconfig_errorgain: value of ERRORGAIN bitfield in PRM_VP*_CONFIG
- * @vstepmin_smpswaittimemin: value of SMPSWAITTIMEMIN bitfield in PRM_VP*_VSTEPMIN
- * @vstepmax_smpswaittimemax: value of SMPSWAITTIMEMAX bitfield in PRM_VP*_VSTEPMAX
- * @vlimitto_timeout: value of TIMEOUT bitfield in PRM_VP*_VLIMITTO
- * @vstepmin_stepmin: value of VSTEPMIN bitfield in PRM_VP*_VSTEPMIN
- * @vstepmax_stepmax: value of VSTEPMAX bitfield in PRM_VP*_VSTEPMAX
- * @vlimitto_vddmin: value of VDDMIN bitfield in PRM_VP*_VLIMITTO
- * @vlimitto_vddmax: value of VDDMAX bitfield in PRM_VP*_VLIMITTO
- *
- * XXX Is this structure really needed?  Why not just program the
- * device directly?  They are in PRM space, therefore in the WKUP
- * powerdomain, so register contents should not be lost in off-mode.
- * XXX Some of these fields are incorrectly named, e.g., vstep*
- */
-struct omap_vp_runtime_data {
-       u32 vpconfig_erroroffset;
-       u16 vpconfig_errorgain;
-       u16 vstepmin_smpswaittimemin;
-       u16 vstepmax_smpswaittimemax;
-       u16 vlimitto_timeout;
-       u8 vstepmin_stepmin;
-       u8 vstepmax_stepmax;
-       u8 vlimitto_vddmin;
-       u8 vlimitto_vddmax;
-};
+extern struct omap_vp_instance omap3_vp_mpu;
+extern struct omap_vp_instance omap3_vp_core;
 
-extern struct omap_vp_instance_data omap3_vp1_data;
-extern struct omap_vp_instance_data omap3_vp2_data;
+extern struct omap_vp_instance omap4_vp_mpu;
+extern struct omap_vp_instance omap4_vp_iva;
+extern struct omap_vp_instance omap4_vp_core;
 
-extern struct omap_vp_instance_data omap4_vp_mpu_data;
-extern struct omap_vp_instance_data omap4_vp_iva_data;
-extern struct omap_vp_instance_data omap4_vp_core_data;
+void omap_vp_init(struct voltagedomain *voltdm);
+void omap_vp_enable(struct voltagedomain *voltdm);
+void omap_vp_disable(struct voltagedomain *voltdm);
+int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
+                             unsigned long target_volt);
+int omap_vp_update_errorgain(struct voltagedomain *voltdm,
+                            unsigned long target_volt);
 
 #endif
index 645217094e510ceb8fc8f3b76d8ffb5da68222ab..260c554b15472ba30e67002a011c1d38fe130bf3 100644 (file)
 #include "voltage.h"
 
 #include "vp.h"
+#include "prm2xxx_3xxx.h"
+
+static const struct omap_vp_ops omap3_vp_ops = {
+       .check_txdone = omap3_prm_vp_check_txdone,
+       .clear_txdone = omap3_prm_vp_clear_txdone,
+};
 
 /*
  * VP data common to 34xx/36xx chips
  * XXX This stuff presumably belongs in the vp3xxx.c or vp.c file.
  */
-static const struct omap_vp_common_data omap3_vp_common = {
-       .vpconfig_erroroffset_shift = OMAP3430_ERROROFFSET_SHIFT,
+static const struct omap_vp_common omap3_vp_common = {
+       .vpconfig_erroroffset_mask = OMAP3430_ERROROFFSET_MASK,
        .vpconfig_errorgain_mask = OMAP3430_ERRORGAIN_MASK,
-       .vpconfig_errorgain_shift = OMAP3430_ERRORGAIN_SHIFT,
-       .vpconfig_initvoltage_shift = OMAP3430_INITVOLTAGE_SHIFT,
        .vpconfig_initvoltage_mask = OMAP3430_INITVOLTAGE_MASK,
        .vpconfig_timeouten = OMAP3430_TIMEOUTEN_MASK,
        .vpconfig_initvdd = OMAP3430_INITVDD_MASK,
@@ -47,36 +51,29 @@ static const struct omap_vp_common_data omap3_vp_common = {
        .vlimitto_vddmin_shift = OMAP3430_VDDMIN_SHIFT,
        .vlimitto_vddmax_shift = OMAP3430_VDDMAX_SHIFT,
        .vlimitto_timeout_shift = OMAP3430_TIMEOUT_SHIFT,
-};
+       .vpvoltage_mask = OMAP3430_VPVOLTAGE_MASK,
 
-static const struct omap_vp_prm_irqst_data omap3_vp1_prm_irqst_data = {
-       .prm_irqst_reg = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
-       .tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK,
+       .ops = &omap3_vp_ops,
 };
 
-struct omap_vp_instance_data omap3_vp1_data = {
-       .vp_common = &omap3_vp_common,
+struct omap_vp_instance omap3_vp_mpu = {
+       .id = OMAP3_VP_VDD_MPU_ID,
+       .common = &omap3_vp_common,
        .vpconfig = OMAP3_PRM_VP1_CONFIG_OFFSET,
        .vstepmin = OMAP3_PRM_VP1_VSTEPMIN_OFFSET,
        .vstepmax = OMAP3_PRM_VP1_VSTEPMAX_OFFSET,
        .vlimitto = OMAP3_PRM_VP1_VLIMITTO_OFFSET,
        .vstatus = OMAP3_PRM_VP1_STATUS_OFFSET,
        .voltage = OMAP3_PRM_VP1_VOLTAGE_OFFSET,
-       .prm_irqst_data = &omap3_vp1_prm_irqst_data,
-};
-
-static const struct omap_vp_prm_irqst_data omap3_vp2_prm_irqst_data = {
-       .prm_irqst_reg = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
-       .tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK,
 };
 
-struct omap_vp_instance_data omap3_vp2_data = {
-       .vp_common = &omap3_vp_common,
+struct omap_vp_instance omap3_vp_core = {
+       .id = OMAP3_VP_VDD_CORE_ID,
+       .common = &omap3_vp_common,
        .vpconfig = OMAP3_PRM_VP2_CONFIG_OFFSET,
        .vstepmin = OMAP3_PRM_VP2_VSTEPMIN_OFFSET,
        .vstepmax = OMAP3_PRM_VP2_VSTEPMAX_OFFSET,
        .vlimitto = OMAP3_PRM_VP2_VLIMITTO_OFFSET,
        .vstatus = OMAP3_PRM_VP2_STATUS_OFFSET,
        .voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET,
-       .prm_irqst_data = &omap3_vp2_prm_irqst_data,
 };
index 65d1ad63800a5ee3c944a3224b29607d81b6858b..b4e77044891e4ce476c620e2e7878852d047c6b9 100644 (file)
 
 #include "vp.h"
 
+static const struct omap_vp_ops omap4_vp_ops = {
+       .check_txdone = omap4_prm_vp_check_txdone,
+       .clear_txdone = omap4_prm_vp_clear_txdone,
+};
+
 /*
  * VP data common to 44xx chips
  * XXX This stuff presumably belongs in the vp44xx.c or vp.c file.
  */
-static const struct omap_vp_common_data omap4_vp_common = {
-       .vpconfig_erroroffset_shift = OMAP4430_ERROROFFSET_SHIFT,
+static const struct omap_vp_common omap4_vp_common = {
+       .vpconfig_erroroffset_mask = OMAP4430_ERROROFFSET_MASK,
        .vpconfig_errorgain_mask = OMAP4430_ERRORGAIN_MASK,
-       .vpconfig_errorgain_shift = OMAP4430_ERRORGAIN_SHIFT,
-       .vpconfig_initvoltage_shift = OMAP4430_INITVOLTAGE_SHIFT,
        .vpconfig_initvoltage_mask = OMAP4430_INITVOLTAGE_MASK,
        .vpconfig_timeouten = OMAP4430_TIMEOUTEN_MASK,
        .vpconfig_initvdd = OMAP4430_INITVDD_MASK,
@@ -48,53 +51,39 @@ static const struct omap_vp_common_data omap4_vp_common = {
        .vlimitto_vddmin_shift = OMAP4430_VDDMIN_SHIFT,
        .vlimitto_vddmax_shift = OMAP4430_VDDMAX_SHIFT,
        .vlimitto_timeout_shift = OMAP4430_TIMEOUT_SHIFT,
+       .vpvoltage_mask = OMAP4430_VPVOLTAGE_MASK,
+       .ops = &omap4_vp_ops,
 };
 
-static const struct omap_vp_prm_irqst_data omap4_vp_mpu_prm_irqst_data = {
-       .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET,
-       .tranxdone_status = OMAP4430_VP_MPU_TRANXDONE_ST_MASK,
-};
-
-struct omap_vp_instance_data omap4_vp_mpu_data = {
-       .vp_common = &omap4_vp_common,
+struct omap_vp_instance omap4_vp_mpu = {
+       .id = OMAP4_VP_VDD_MPU_ID,
+       .common = &omap4_vp_common,
        .vpconfig = OMAP4_PRM_VP_MPU_CONFIG_OFFSET,
        .vstepmin = OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET,
        .vstepmax = OMAP4_PRM_VP_MPU_VSTEPMAX_OFFSET,
        .vlimitto = OMAP4_PRM_VP_MPU_VLIMITTO_OFFSET,
        .vstatus = OMAP4_PRM_VP_MPU_STATUS_OFFSET,
        .voltage = OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET,
-       .prm_irqst_data = &omap4_vp_mpu_prm_irqst_data,
 };
 
-static const struct omap_vp_prm_irqst_data omap4_vp_iva_prm_irqst_data = {
-       .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
-       .tranxdone_status = OMAP4430_VP_IVA_TRANXDONE_ST_MASK,
-};
-
-struct omap_vp_instance_data omap4_vp_iva_data = {
-       .vp_common = &omap4_vp_common,
+struct omap_vp_instance omap4_vp_iva = {
+       .id = OMAP4_VP_VDD_IVA_ID,
+       .common = &omap4_vp_common,
        .vpconfig = OMAP4_PRM_VP_IVA_CONFIG_OFFSET,
        .vstepmin = OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET,
        .vstepmax = OMAP4_PRM_VP_IVA_VSTEPMAX_OFFSET,
        .vlimitto = OMAP4_PRM_VP_IVA_VLIMITTO_OFFSET,
        .vstatus = OMAP4_PRM_VP_IVA_STATUS_OFFSET,
        .voltage = OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET,
-       .prm_irqst_data = &omap4_vp_iva_prm_irqst_data,
-};
-
-static const struct omap_vp_prm_irqst_data omap4_vp_core_prm_irqst_data = {
-       .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
-       .tranxdone_status = OMAP4430_VP_CORE_TRANXDONE_ST_MASK,
 };
 
-struct omap_vp_instance_data omap4_vp_core_data = {
-       .vp_common = &omap4_vp_common,
+struct omap_vp_instance omap4_vp_core = {
+       .id = OMAP4_VP_VDD_CORE_ID,
+       .common = &omap4_vp_common,
        .vpconfig = OMAP4_PRM_VP_CORE_CONFIG_OFFSET,
        .vstepmin = OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET,
        .vstepmax = OMAP4_PRM_VP_CORE_VSTEPMAX_OFFSET,
        .vlimitto = OMAP4_PRM_VP_CORE_VLIMITTO_OFFSET,
        .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET,
        .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET,
-       .prm_irqst_data = &omap4_vp_core_prm_irqst_data,
 };
-
index 88432aba972c7d8bc374bddf3dfdaba5fe0fae76..4b79a80d5e1f67154adc0544e484726e0d5f3686 100644 (file)
@@ -9,7 +9,7 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -21,7 +21,6 @@
 #include <linux/mv643xx_eth.h>
 #include <linux/i2c.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
index 9e5c1663fc4f0b003df76a21db800d01be892a99..343f60e9639fe54a9f3cf59978ceb17730d6fcb6 100644 (file)
@@ -13,7 +13,7 @@
  * License, or (at your option) any later version.
  *
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/delay.h>
@@ -30,7 +30,6 @@
 #include <linux/phy.h>
 #include <linux/marvell_phy.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
index 43cf8bc9767bbe8cb5fab72f06b11da74c804d8d..b1b45fff776e614f68ed1058e1313361e03b487b 100644 (file)
@@ -9,12 +9,11 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <linux/io.h>
-#include <asm/gpio.h>
 #include <mach/bridge-regs.h>
 #include <plat/irq.h>
 #include "common.h"
index 9115511dc035c4acd1f0c0b1f5ad158505b0d644..d3cd3f63258a63dbd2e7354a239f188ee8f3de37 100644 (file)
@@ -7,7 +7,7 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -21,7 +21,6 @@
 #include <linux/serial_reg.h>
 #include <linux/ata_platform.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
index b3356ada64b9163fdb944e205204802bb9855d1d..201ae3676289f53fed5acbdaedba1a9b6f08ca5a 100644 (file)
@@ -7,7 +7,7 @@
  * published by the Free Software Foundation; either version 2 of the
  * License, or (at your option) any later version.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -20,7 +20,6 @@
 #include <linux/i2c.h>
 #include <linux/ata_platform.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <mach/orion5x.h>
 #include "common.h"
index 8c876664f494fff8cec53acc7cef762ac56cd1a5..ebd6767d8e88d5e3d467198b599756776f282335 100644 (file)
@@ -7,7 +7,7 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -18,7 +18,6 @@
 #include <linux/ethtool.h>
 #include <net/dsa.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/leds.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
index 994644f59d8d560168e16db51bdcc08f7041aa81..05db2d336b0891655a04e5e430a8fd8c3dc25130 100644 (file)
@@ -7,7 +7,7 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -19,7 +19,6 @@
 #include <linux/i2c.h>
 #include <net/dsa.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/leds.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
index 1903d25ecae9bf4f0ebc47219a106a1a5112b53b..e47fa0578ae3f8e4f25782cd07ff067835481adf 100644 (file)
@@ -9,7 +9,7 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -20,7 +20,6 @@
 #include <linux/ata_platform.h>
 #include <linux/i2c.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/leds.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
index e06fdae77f0a9ca3c999fc712f52b4ed1f6fb39d..64317251ec008c93d2890ec3c38e2a3c33a66a3e 100644 (file)
@@ -7,7 +7,7 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -21,7 +21,6 @@
 #include <linux/ethtool.h>
 #include <net/dsa.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/leds.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
index 306183273eb9ea1df4c4df4176566215cb235bf1..29f1526f7b70671129cebe330ab8c8b7656cb764 100644 (file)
@@ -8,7 +8,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -20,7 +20,6 @@
 #include <linux/i2c.h>
 #include <linux/serial_reg.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
index 3dbcd5ed77ef46a02e6a63f6e6975862a2fbfdf8..31e51f9b4b6402b3c5131168719cd0aed6c9d4ac 100644 (file)
@@ -8,7 +8,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -23,7 +23,6 @@
 #include <linux/serial_reg.h>
 #include <linux/ata_platform.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
index 23c9e2e5e55043347a0a4465c823960fbcfad44b..0fbcc14e09d7d7c55bb397721c4c84d9eff90d70 100644 (file)
@@ -11,7 +11,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -25,7 +25,6 @@
 #include <linux/i2c.h>
 #include <linux/serial_reg.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
index 1c63a76f3ca3af66b767d10b4d33c0bfa8852ba0..b8be7d8d0cf406a6690412b45074fc2fedd4c84f 100644 (file)
@@ -5,7 +5,7 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -17,7 +17,6 @@
 #include <linux/ethtool.h>
 #include <net/dsa.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
index 4fd9f18c9d5d67c16d66176c9296732394b9762f..faf81a0393600a7742ac645edd29570ec0c06600 100644 (file)
@@ -5,7 +5,7 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -20,7 +20,6 @@
 #include <linux/input.h>
 #include <net/dsa.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
diff --git a/arch/arm/mach-picoxcell/Makefile b/arch/arm/mach-picoxcell/Makefile
new file mode 100644 (file)
index 0000000..c550b63
--- /dev/null
@@ -0,0 +1,3 @@
+obj-y  := common.o
+obj-y  += time.o
+obj-y  += io.o
diff --git a/arch/arm/mach-picoxcell/Makefile.boot b/arch/arm/mach-picoxcell/Makefile.boot
new file mode 100644 (file)
index 0000000..b327175
--- /dev/null
@@ -0,0 +1 @@
+zreladdr-y := 0x00008000
diff --git a/arch/arm/mach-picoxcell/common.c b/arch/arm/mach-picoxcell/common.c
new file mode 100644 (file)
index 0000000..34d0834
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2011 Picochip Ltd., Jamie Iles
+ *
+ * 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.
+ *
+ * All enquiries to support@picochip.com
+ */
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_platform.h>
+
+#include <asm/mach/arch.h>
+#include <asm/hardware/vic.h>
+
+#include <mach/map.h>
+#include <mach/picoxcell_soc.h>
+
+#include "common.h"
+
+static void __init picoxcell_init_machine(void)
+{
+       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char *picoxcell_dt_match[] = {
+       "picochip,pc3x2",
+       "picochip,pc3x3",
+       NULL
+};
+
+static const struct of_device_id vic_of_match[] __initconst = {
+       { .compatible = "arm,pl192-vic" },
+       { /* Sentinel */ }
+};
+
+static void __init picoxcell_init_irq(void)
+{
+       vic_init(IO_ADDRESS(PICOXCELL_VIC0_BASE), 0, ~0, 0);
+       vic_init(IO_ADDRESS(PICOXCELL_VIC1_BASE), 32, ~0, 0);
+       irq_domain_generate_simple(vic_of_match, PICOXCELL_VIC0_BASE, 0);
+       irq_domain_generate_simple(vic_of_match, PICOXCELL_VIC1_BASE, 32);
+}
+
+DT_MACHINE_START(PICOXCELL, "Picochip picoXcell")
+       .map_io         = picoxcell_map_io,
+       .nr_irqs        = ARCH_NR_IRQS,
+       .init_irq       = picoxcell_init_irq,
+       .timer          = &picoxcell_timer,
+       .init_machine   = picoxcell_init_machine,
+       .dt_compat      = picoxcell_dt_match,
+MACHINE_END
diff --git a/arch/arm/mach-picoxcell/common.h b/arch/arm/mach-picoxcell/common.h
new file mode 100644 (file)
index 0000000..5263f0f
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2011 Picochip Ltd., Jamie Iles
+ *
+ * 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.
+ *
+ * All enquiries to support@picochip.com
+ */
+#ifndef __PICOXCELL_COMMON_H__
+#define __PICOXCELL_COMMON_H__
+
+#include <asm/mach/time.h>
+
+extern struct sys_timer picoxcell_timer;
+extern void picoxcell_map_io(void);
+
+#endif /* __PICOXCELL_COMMON_H__ */
diff --git a/arch/arm/mach-picoxcell/include/mach/debug-macro.S b/arch/arm/mach-picoxcell/include/mach/debug-macro.S
new file mode 100644 (file)
index 0000000..8f2c234
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2011 Picochip Ltd., Jamie Iles
+ *
+ * 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.
+ *
+ * Derived from arch/arm/mach-davinci/include/mach/debug-macro.S to use 32-bit
+ * accesses to the 8250.
+ */
+#include <linux/serial_reg.h>
+#include <mach/hardware.h>
+#include <mach/map.h>
+
+#define UART_SHIFT 2
+
+               .macro  addruart, rp, rv
+               ldr     \rv, =PHYS_TO_IO(PICOXCELL_UART1_BASE)
+               ldr     \rp, =PICOXCELL_UART1_BASE
+               .endm
+
+               .macro  senduart,rd,rx
+               str     \rd, [\rx, #UART_TX << UART_SHIFT]
+               .endm
+
+               .macro  busyuart,rd,rx
+1002:          ldr     \rd, [\rx, #UART_LSR << UART_SHIFT]
+               and     \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
+               teq     \rd, #UART_LSR_TEMT | UART_LSR_THRE
+               bne     1002b
+               .endm
+
+               /* The UART's don't have any flow control IO's wired up. */
+               .macro  waituart,rd,rx
+               .endm
diff --git a/arch/arm/mach-picoxcell/include/mach/entry-macro.S b/arch/arm/mach-picoxcell/include/mach/entry-macro.S
new file mode 100644 (file)
index 0000000..a6b09f7
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * entry-macro.S
+ *
+ * Copyright (c) 2011 Picochip Ltd., Jamie Iles
+ *
+ * Low-level IRQ helper macros for picoXcell platforms
+ *
+ * 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 <mach/hardware.h>
+#include <mach/irqs.h>
+#include <mach/map.h>
+
+#define VA_VIC0                IO_ADDRESS(PICOXCELL_VIC0_BASE)
+#define VA_VIC1                IO_ADDRESS(PICOXCELL_VIC1_BASE)
+
+#include <asm/entry-macro-vic2.S>
diff --git a/arch/arm/mach-picoxcell/include/mach/gpio.h b/arch/arm/mach-picoxcell/include/mach/gpio.h
new file mode 100644 (file)
index 0000000..40a8c17
--- /dev/null
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/arm/mach-picoxcell/include/mach/hardware.h b/arch/arm/mach-picoxcell/include/mach/hardware.h
new file mode 100644 (file)
index 0000000..70ff581
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2011 Picochip Ltd., Jamie Iles
+ *
+ * This file contains the hardware definitions of the picoXcell SoC devices.
+ *
+ * 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_HARDWARE_H
+#define __ASM_ARCH_HARDWARE_H
+
+#include <mach/picoxcell_soc.h>
+
+#endif
diff --git a/arch/arm/mach-picoxcell/include/mach/io.h b/arch/arm/mach-picoxcell/include/mach/io.h
new file mode 100644 (file)
index 0000000..7573ec7
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2011 Picochip Ltd., Jamie Iles
+ *
+ * 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_ARM_ARCH_IO_H
+#define __ASM_ARM_ARCH_IO_H
+
+/* No ioports, but needed for driver compatibility. */
+#define __io(a)                        __typesafe_io(a)
+/* No PCI possible on picoxcell. */
+#define __mem_pci(a)           (a)
+
+#endif /* __ASM_ARM_ARCH_IO_H */
diff --git a/arch/arm/mach-picoxcell/include/mach/irqs.h b/arch/arm/mach-picoxcell/include/mach/irqs.h
new file mode 100644 (file)
index 0000000..4d13ed9
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2011 Picochip Ltd., Jamie Iles
+ *
+ * This file contains the hardware definitions of the picoXcell SoC devices.
+ *
+ * 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 __MACH_IRQS_H
+#define __MACH_IRQS_H
+
+#define ARCH_NR_IRQS                   64
+#define NR_IRQS                                (128 + ARCH_NR_IRQS)
+
+#define IRQ_VIC0_BASE                  0
+#define IRQ_VIC1_BASE                  32
+
+#endif /* __MACH_IRQS_H */
diff --git a/arch/arm/mach-picoxcell/include/mach/map.h b/arch/arm/mach-picoxcell/include/mach/map.h
new file mode 100644 (file)
index 0000000..c06afad
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2011 Picochip Ltd., Jamie Iles
+ *
+ * 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 __PICOXCELL_MAP_H__
+#define __PICOXCELL_MAP_H__
+
+#define PHYS_TO_IO(x)          (((x) & 0x00ffffff) | 0xfe000000)
+
+#ifdef __ASSEMBLY__
+#define IO_ADDRESS(x)          PHYS_TO_IO((x))
+#else
+#define IO_ADDRESS(x)          (void __iomem __force *)(PHYS_TO_IO((x)))
+#endif
+
+#endif /* __PICOXCELL_MAP_H__ */
diff --git a/arch/arm/mach-picoxcell/include/mach/memory.h b/arch/arm/mach-picoxcell/include/mach/memory.h
new file mode 100644 (file)
index 0000000..40a8c17
--- /dev/null
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/arm/mach-picoxcell/include/mach/picoxcell_soc.h b/arch/arm/mach-picoxcell/include/mach/picoxcell_soc.h
new file mode 100644 (file)
index 0000000..5566fc8
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2011 Picochip Ltd., Jamie Iles
+ *
+ * This file contains the hardware definitions of the picoXcell SoC devices.
+ *
+ * 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 __PICOXCELL_SOC_H__
+#define __PICOXCELL_SOC_H__
+
+#define PICOXCELL_UART1_BASE           0x80230000
+#define PICOXCELL_PERIPH_BASE          0x80000000
+#define PICOXCELL_PERIPH_LENGTH                SZ_4M
+#define PICOXCELL_VIC0_BASE            0x80060000
+#define PICOXCELL_VIC1_BASE            0x80064000
+
+#endif /* __PICOXCELL_SOC_H__ */
diff --git a/arch/arm/mach-picoxcell/include/mach/system.h b/arch/arm/mach-picoxcell/include/mach/system.h
new file mode 100644 (file)
index 0000000..67c589b
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2011 Picochip Ltd., Jamie Iles
+ *
+ * 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_SYSTEM_H
+#define __ASM_ARCH_SYSTEM_H
+
+static inline void arch_idle(void)
+{
+       /*
+        * This should do all the clock switching and wait for interrupt
+        * tricks.
+        */
+       cpu_do_idle();
+}
+
+static inline void arch_reset(int mode, const char *cmd)
+{
+       /* Watchdog reset to go here. */
+}
+
+#endif /* __ASM_ARCH_SYSTEM_H */
diff --git a/arch/arm/mach-picoxcell/include/mach/timex.h b/arch/arm/mach-picoxcell/include/mach/timex.h
new file mode 100644 (file)
index 0000000..6c540a6
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2011 Picochip Ltd., Jamie Iles
+ *
+ * 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 __TIMEX_H__
+#define __TIMEX_H__
+
+/* Bogus value to allow the kernel to compile. */
+#define CLOCK_TICK_RATE                1000000
+
+#endif /* __TIMEX_H__ */
+
diff --git a/arch/arm/mach-picoxcell/include/mach/uncompress.h b/arch/arm/mach-picoxcell/include/mach/uncompress.h
new file mode 100644 (file)
index 0000000..b60b19d
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2011 Picochip Ltd., Jamie Iles
+ *
+ * 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
+ */
+#define putc(c)
+#define flush()
+#define arch_decomp_setup()
+#define arch_decomp_wdog()
diff --git a/arch/arm/mach-picoxcell/include/mach/vmalloc.h b/arch/arm/mach-picoxcell/include/mach/vmalloc.h
new file mode 100644 (file)
index 0000000..0216cc4
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2011 Picochip Ltd., Jamie Iles
+ *
+ * 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.
+ */
+#define VMALLOC_END    0xfe000000UL
diff --git a/arch/arm/mach-picoxcell/io.c b/arch/arm/mach-picoxcell/io.c
new file mode 100644 (file)
index 0000000..39e9b9e
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2011 Picochip Ltd., Jamie Iles
+ *
+ * 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.
+ *
+ * All enquiries to support@picochip.com
+ */
+#include <linux/io.h>
+#include <linux/mm.h>
+#include <linux/module.h>
+#include <linux/of.h>
+
+#include <asm/mach/map.h>
+
+#include <mach/map.h>
+#include <mach/picoxcell_soc.h>
+
+#include "common.h"
+
+void __init picoxcell_map_io(void)
+{
+       struct map_desc io_map = {
+               .virtual        = PHYS_TO_IO(PICOXCELL_PERIPH_BASE),
+               .pfn            = __phys_to_pfn(PICOXCELL_PERIPH_BASE),
+               .length         = PICOXCELL_PERIPH_LENGTH,
+               .type           = MT_DEVICE,
+       };
+
+       iotable_init(&io_map, 1);
+}
diff --git a/arch/arm/mach-picoxcell/time.c b/arch/arm/mach-picoxcell/time.c
new file mode 100644 (file)
index 0000000..90a554f
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2011 Picochip Ltd., Jamie Iles
+ *
+ * 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.
+ *
+ * All enquiries to support@picochip.com
+ */
+#include <linux/dw_apb_timer.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/sched.h>
+
+#include <asm/mach/time.h>
+#include <asm/sched_clock.h>
+
+#include "common.h"
+
+static void timer_get_base_and_rate(struct device_node *np,
+                                   void __iomem **base, u32 *rate)
+{
+       *base = of_iomap(np, 0);
+
+       if (!*base)
+               panic("Unable to map regs for %s", np->name);
+
+       if (of_property_read_u32(np, "clock-freq", rate))
+               panic("No clock-freq property for %s", np->name);
+}
+
+static void picoxcell_add_clockevent(struct device_node *event_timer)
+{
+       void __iomem *iobase;
+       struct dw_apb_clock_event_device *ced;
+       u32 irq, rate;
+
+       irq = irq_of_parse_and_map(event_timer, 0);
+       if (irq == NO_IRQ)
+               panic("No IRQ for clock event timer");
+
+       timer_get_base_and_rate(event_timer, &iobase, &rate);
+
+       ced = dw_apb_clockevent_init(0, event_timer->name, 300, iobase, irq,
+                                    rate);
+       if (!ced)
+               panic("Unable to initialise clockevent device");
+
+       dw_apb_clockevent_register(ced);
+}
+
+static void picoxcell_add_clocksource(struct device_node *source_timer)
+{
+       void __iomem *iobase;
+       struct dw_apb_clocksource *cs;
+       u32 rate;
+
+       timer_get_base_and_rate(source_timer, &iobase, &rate);
+
+       cs = dw_apb_clocksource_init(300, source_timer->name, iobase, rate);
+       if (!cs)
+               panic("Unable to initialise clocksource device");
+
+       dw_apb_clocksource_start(cs);
+       dw_apb_clocksource_register(cs);
+}
+
+static DEFINE_CLOCK_DATA(cd);
+static void __iomem *sched_io_base;
+
+unsigned long long notrace sched_clock(void)
+{
+       cycle_t cyc = sched_io_base ? __raw_readl(sched_io_base) : 0;
+
+       return cyc_to_sched_clock(&cd, cyc, (u32)~0);
+}
+
+static void notrace picoxcell_update_sched_clock(void)
+{
+       cycle_t cyc = sched_io_base ? __raw_readl(sched_io_base) : 0;
+
+       update_sched_clock(&cd, cyc, (u32)~0);
+}
+
+static const struct of_device_id picoxcell_rtc_ids[] __initconst = {
+       { .compatible = "picochip,pc3x2-rtc" },
+       { /* Sentinel */ },
+};
+
+static void picoxcell_init_sched_clock(void)
+{
+       struct device_node *sched_timer;
+       u32 rate;
+
+       sched_timer = of_find_matching_node(NULL, picoxcell_rtc_ids);
+       if (!sched_timer)
+               panic("No RTC for sched clock to use");
+
+       timer_get_base_and_rate(sched_timer, &sched_io_base, &rate);
+       of_node_put(sched_timer);
+
+       init_sched_clock(&cd, picoxcell_update_sched_clock, 32, rate);
+}
+
+static const struct of_device_id picoxcell_timer_ids[] __initconst = {
+       { .compatible = "picochip,pc3x2-timer" },
+       {},
+};
+
+static void __init picoxcell_timer_init(void)
+{
+       struct device_node *event_timer, *source_timer;
+
+       event_timer = of_find_matching_node(NULL, picoxcell_timer_ids);
+       if (!event_timer)
+               panic("No timer for clockevent");
+       picoxcell_add_clockevent(event_timer);
+
+       source_timer = of_find_matching_node(event_timer, picoxcell_timer_ids);
+       if (!source_timer)
+               panic("No timer for clocksource");
+       picoxcell_add_clocksource(source_timer);
+
+       of_node_put(source_timer);
+
+       picoxcell_init_sched_clock();
+}
+
+struct sys_timer picoxcell_timer = {
+       .init = picoxcell_timer_init,
+};
index f219914f5b291efdb9fdbe9391a26ac6c7307932..d3e71d3847b41fee6e4ef5dd2ff42b5ab259b1ab 100644 (file)
  * is licensed "as is" without any warranty of any kind, whether express
  * or implied.
  */
-
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/io.h>
 #include <mach/hardware.h>
 #include <mach/platform.h>
-#include <mach/gpio.h>
+#include <mach/gpio-pnx4008.h>
 
 /* register definitions */
 #define PIO_VA_BASE    IO_ADDRESS(PNX4008_PIO_BASE)
similarity index 99%
rename from arch/arm/mach-pnx4008/include/mach/gpio.h
rename to arch/arm/mach-pnx4008/include/mach/gpio-pnx4008.h
index 9591467eb9ec709b9bc1b895367e10b976553f28..41027dd7cf7423641c996909a7c328f28d9f406a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * arch/arm/mach-pnx4008/include/mach/gpio.h
+ * arch/arm/mach-pnx4008/include/mach/gpio-pnx4008.h
  *
  * PNX4008 GPIO driver - header file
  *
index f40961e519146d88ea39f92ca352dd9799a97211..374c138ac1ac2efe8ec6a099cab37e2f4d85be0c 100644 (file)
@@ -9,7 +9,6 @@
  *  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/io.h>
@@ -19,8 +18,8 @@
 
 #include <linux/serial_core.h>
 #include <linux/serial_reg.h>
-#include <mach/gpio.h>
 
+#include <mach/gpio-pnx4008.h>
 #include <mach/clock.h>
 
 #define UART_3         0
index 93f59f877fc602887435fca577780a8420bedba8..be751470d37b01dc1ec1800ec9eda365edb80bfa 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <linux/platform_device.h>
 #include <linux/irq.h>
-#include <linux/gpio.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/physmap.h>
 #include <linux/mtd/nand-gpio.h>
index f5d91efc2965a81053ad87573b4fe49a8c423bb9..5432ecb15defb2c0acd61068636aa78b24ccc949 100644 (file)
@@ -16,6 +16,7 @@
  * initialization stuff for PXA machines which can be overridden later if
  * need be.
  */
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -26,7 +27,6 @@
 #include <asm/mach-types.h>
 
 #include <mach/reset.h>
-#include <mach/gpio.h>
 #include <mach/smemc.h>
 #include <mach/pxa3xx-regs.h>
 
diff --git a/arch/arm/mach-pxa/include/mach/gpio-pxa.h b/arch/arm/mach-pxa/include/mach/gpio-pxa.h
new file mode 100644 (file)
index 0000000..41b4c93
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * Written by Philipp Zabel <philipp.zabel@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+#ifndef __MACH_PXA_GPIO_PXA_H
+#define __MACH_PXA_GPIO_PXA_H
+
+#include <mach/irqs.h>
+#include <mach/hardware.h>
+
+#define GPIO_REGS_VIRT io_p2v(0x40E00000)
+
+#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
+#define GPIO_REG(x)    (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
+
+/* GPIO Pin Level Registers */
+#define GPLR0          GPIO_REG(BANK_OFF(0) + 0x00)
+#define GPLR1          GPIO_REG(BANK_OFF(1) + 0x00)
+#define GPLR2          GPIO_REG(BANK_OFF(2) + 0x00)
+#define GPLR3          GPIO_REG(BANK_OFF(3) + 0x00)
+
+/* GPIO Pin Direction Registers */
+#define GPDR0          GPIO_REG(BANK_OFF(0) + 0x0c)
+#define GPDR1          GPIO_REG(BANK_OFF(1) + 0x0c)
+#define GPDR2          GPIO_REG(BANK_OFF(2) + 0x0c)
+#define GPDR3          GPIO_REG(BANK_OFF(3) + 0x0c)
+
+/* GPIO Pin Output Set Registers */
+#define GPSR0          GPIO_REG(BANK_OFF(0) + 0x18)
+#define GPSR1          GPIO_REG(BANK_OFF(1) + 0x18)
+#define GPSR2          GPIO_REG(BANK_OFF(2) + 0x18)
+#define GPSR3          GPIO_REG(BANK_OFF(3) + 0x18)
+
+/* GPIO Pin Output Clear Registers */
+#define GPCR0          GPIO_REG(BANK_OFF(0) + 0x24)
+#define GPCR1          GPIO_REG(BANK_OFF(1) + 0x24)
+#define GPCR2          GPIO_REG(BANK_OFF(2) + 0x24)
+#define GPCR3          GPIO_REG(BANK_OFF(3) + 0x24)
+
+/* GPIO Rising Edge Detect Registers */
+#define GRER0          GPIO_REG(BANK_OFF(0) + 0x30)
+#define GRER1          GPIO_REG(BANK_OFF(1) + 0x30)
+#define GRER2          GPIO_REG(BANK_OFF(2) + 0x30)
+#define GRER3          GPIO_REG(BANK_OFF(3) + 0x30)
+
+/* GPIO Falling Edge Detect Registers */
+#define GFER0          GPIO_REG(BANK_OFF(0) + 0x3c)
+#define GFER1          GPIO_REG(BANK_OFF(1) + 0x3c)
+#define GFER2          GPIO_REG(BANK_OFF(2) + 0x3c)
+#define GFER3          GPIO_REG(BANK_OFF(3) + 0x3c)
+
+/* GPIO Edge Detect Status Registers */
+#define GEDR0          GPIO_REG(BANK_OFF(0) + 0x48)
+#define GEDR1          GPIO_REG(BANK_OFF(1) + 0x48)
+#define GEDR2          GPIO_REG(BANK_OFF(2) + 0x48)
+#define GEDR3          GPIO_REG(BANK_OFF(3) + 0x48)
+
+/* GPIO Alternate Function Select Registers */
+#define GAFR0_L                GPIO_REG(0x0054)
+#define GAFR0_U                GPIO_REG(0x0058)
+#define GAFR1_L                GPIO_REG(0x005C)
+#define GAFR1_U                GPIO_REG(0x0060)
+#define GAFR2_L                GPIO_REG(0x0064)
+#define GAFR2_U                GPIO_REG(0x0068)
+#define GAFR3_L                GPIO_REG(0x006C)
+#define GAFR3_U                GPIO_REG(0x0070)
+
+/* More handy macros.  The argument is a literal GPIO number. */
+
+#define GPIO_bit(x)    (1 << ((x) & 0x1f))
+
+#define GPLR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x00)
+#define GPDR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x0c)
+#define GPSR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x18)
+#define GPCR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x24)
+#define GRER(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x30)
+#define GFER(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x3c)
+#define GEDR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x48)
+#define GAFR(x)                GPIO_REG(0x54 + (((x) & 0x70) >> 2))
+
+
+#define NR_BUILTIN_GPIO                PXA_GPIO_IRQ_NUM
+
+#define gpio_to_bank(gpio)     ((gpio) >> 5)
+
+#ifdef CONFIG_CPU_PXA26x
+/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
+ * as well as their Alternate Function value being '1' for GPIO in GAFRx.
+ */
+static inline int __gpio_is_inverted(unsigned gpio)
+{
+       return cpu_is_pxa25x() && gpio > 85;
+}
+#else
+static inline int __gpio_is_inverted(unsigned gpio) { return 0; }
+#endif
+
+/*
+ * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
+ * function of a GPIO, and GPDRx cannot be altered once configured. It
+ * is attributed as "occupied" here (I know this terminology isn't
+ * accurate, you are welcome to propose a better one :-)
+ */
+static inline int __gpio_is_occupied(unsigned gpio)
+{
+       if (cpu_is_pxa27x() || cpu_is_pxa25x()) {
+               int af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3;
+               int dir = GPDR(gpio) & GPIO_bit(gpio);
+
+               if (__gpio_is_inverted(gpio))
+                       return af != 1 || dir == 0;
+               else
+                       return af != 0 || dir != 0;
+       } else
+               return GPDR(gpio) & GPIO_bit(gpio);
+}
+
+#include <plat/gpio-pxa.h>
+#endif /* __MACH_PXA_GPIO_PXA_H */
index c4639502efcac4d236f5752172bfe2f29f7af27f..004cade7bb13b4c24ad642272f75388ebc101ef1 100644 (file)
 #ifndef __ASM_ARCH_PXA_GPIO_H
 #define __ASM_ARCH_PXA_GPIO_H
 
-#include <mach/irqs.h>
-#include <mach/hardware.h>
 #include <asm-generic/gpio.h>
+/* The defines for the driver are needed for the accelerated accessors */
+#include "gpio-pxa.h"
 
-#define GPIO_REGS_VIRT io_p2v(0x40E00000)
-
-#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
-#define GPIO_REG(x)    (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
-
-/* GPIO Pin Level Registers */
-#define GPLR0          GPIO_REG(BANK_OFF(0) + 0x00)
-#define GPLR1          GPIO_REG(BANK_OFF(1) + 0x00)
-#define GPLR2          GPIO_REG(BANK_OFF(2) + 0x00)
-#define GPLR3          GPIO_REG(BANK_OFF(3) + 0x00)
-
-/* GPIO Pin Direction Registers */
-#define GPDR0          GPIO_REG(BANK_OFF(0) + 0x0c)
-#define GPDR1          GPIO_REG(BANK_OFF(1) + 0x0c)
-#define GPDR2          GPIO_REG(BANK_OFF(2) + 0x0c)
-#define GPDR3          GPIO_REG(BANK_OFF(3) + 0x0c)
-
-/* GPIO Pin Output Set Registers */
-#define GPSR0          GPIO_REG(BANK_OFF(0) + 0x18)
-#define GPSR1          GPIO_REG(BANK_OFF(1) + 0x18)
-#define GPSR2          GPIO_REG(BANK_OFF(2) + 0x18)
-#define GPSR3          GPIO_REG(BANK_OFF(3) + 0x18)
-
-/* GPIO Pin Output Clear Registers */
-#define GPCR0          GPIO_REG(BANK_OFF(0) + 0x24)
-#define GPCR1          GPIO_REG(BANK_OFF(1) + 0x24)
-#define GPCR2          GPIO_REG(BANK_OFF(2) + 0x24)
-#define GPCR3          GPIO_REG(BANK_OFF(3) + 0x24)
-
-/* GPIO Rising Edge Detect Registers */
-#define GRER0          GPIO_REG(BANK_OFF(0) + 0x30)
-#define GRER1          GPIO_REG(BANK_OFF(1) + 0x30)
-#define GRER2          GPIO_REG(BANK_OFF(2) + 0x30)
-#define GRER3          GPIO_REG(BANK_OFF(3) + 0x30)
-
-/* GPIO Falling Edge Detect Registers */
-#define GFER0          GPIO_REG(BANK_OFF(0) + 0x3c)
-#define GFER1          GPIO_REG(BANK_OFF(1) + 0x3c)
-#define GFER2          GPIO_REG(BANK_OFF(2) + 0x3c)
-#define GFER3          GPIO_REG(BANK_OFF(3) + 0x3c)
-
-/* GPIO Edge Detect Status Registers */
-#define GEDR0          GPIO_REG(BANK_OFF(0) + 0x48)
-#define GEDR1          GPIO_REG(BANK_OFF(1) + 0x48)
-#define GEDR2          GPIO_REG(BANK_OFF(2) + 0x48)
-#define GEDR3          GPIO_REG(BANK_OFF(3) + 0x48)
-
-/* GPIO Alternate Function Select Registers */
-#define GAFR0_L                GPIO_REG(0x0054)
-#define GAFR0_U                GPIO_REG(0x0058)
-#define GAFR1_L                GPIO_REG(0x005C)
-#define GAFR1_U                GPIO_REG(0x0060)
-#define GAFR2_L                GPIO_REG(0x0064)
-#define GAFR2_U                GPIO_REG(0x0068)
-#define GAFR3_L                GPIO_REG(0x006C)
-#define GAFR3_U                GPIO_REG(0x0070)
-
-/* More handy macros.  The argument is a literal GPIO number. */
-
-#define GPIO_bit(x)    (1 << ((x) & 0x1f))
-
-#define GPLR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x00)
-#define GPDR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x0c)
-#define GPSR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x18)
-#define GPCR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x24)
-#define GRER(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x30)
-#define GFER(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x3c)
-#define GEDR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x48)
-#define GAFR(x)                GPIO_REG(0x54 + (((x) & 0x70) >> 2))
-
-
-#define NR_BUILTIN_GPIO                PXA_GPIO_IRQ_NUM
-
-#define gpio_to_bank(gpio)     ((gpio) >> 5)
 #define gpio_to_irq(gpio)      IRQ_GPIO(gpio)
 
 static inline int irq_to_gpio(unsigned int irq)
@@ -118,37 +44,5 @@ static inline int irq_to_gpio(unsigned int irq)
        return -1;
 }
 
-#ifdef CONFIG_CPU_PXA26x
-/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
- * as well as their Alternate Function value being '1' for GPIO in GAFRx.
- */
-static inline int __gpio_is_inverted(unsigned gpio)
-{
-       return cpu_is_pxa25x() && gpio > 85;
-}
-#else
-static inline int __gpio_is_inverted(unsigned gpio) { return 0; }
-#endif
-
-/*
- * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
- * function of a GPIO, and GPDRx cannot be altered once configured. It
- * is attributed as "occupied" here (I know this terminology isn't
- * accurate, you are welcome to propose a better one :-)
- */
-static inline int __gpio_is_occupied(unsigned gpio)
-{
-       if (cpu_is_pxa27x() || cpu_is_pxa25x()) {
-               int af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3;
-               int dir = GPDR(gpio) & GPIO_bit(gpio);
-
-               if (__gpio_is_inverted(gpio))
-                       return af != 1 || dir == 0;
-               else
-                       return af != 0 || dir != 0;
-       } else
-               return GPDR(gpio) & GPIO_bit(gpio);
-}
-
 #include <plat/gpio.h>
 #endif
index 2a5726c15e0e446f855f857d4e773a6785ba8486..b6238cbd8aeab1da22f6da03655a93e8bfb8b8e6 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __ASM_ARCH_LITTLETON_H
 #define __ASM_ARCH_LITTLETON_H
 
-#include <mach/gpio.h>
+#include <mach/gpio-pxa.h>
 
 #define LITTLETON_ETH_PHYS     0x30000000
 
index ca607571782426bd05ecc087b8644563c196ec64..8d9200f922680d9c84d491d78fe39d1f28618cc5 100644 (file)
@@ -11,7 +11,6 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */
-
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
@@ -23,7 +22,7 @@
 
 #include <mach/hardware.h>
 #include <mach/irqs.h>
-#include <mach/gpio.h>
+#include <mach/gpio-pxa.h>
 
 #include "generic.h"
 
index 16df0fc0879a07ad5391cb16d227bbc33ecb0244..64540d9089586befe91e9c4d4cce65d250fc4aec 100644 (file)
@@ -12,7 +12,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/syscore_ops.h>
@@ -39,7 +39,6 @@
 #include <asm/mach/flash.h>
 
 #include <mach/pxa27x.h>
-#include <mach/gpio.h>
 #include <mach/lpd270.h>
 #include <mach/audio.h>
 #include <mach/pxafb.h>
index a8c696bfc132929bb6256851b6790ec7e11a4afa..c48ce6da9184f6d338e15ef729f8f043d66b8e77 100644 (file)
@@ -11,6 +11,7 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -42,7 +43,6 @@
 #include <asm/hardware/sa1111.h>
 
 #include <mach/pxa25x.h>
-#include <mach/gpio.h>
 #include <mach/audio.h>
 #include <mach/lubbock.h>
 #include <mach/udc.h>
index cc6e14f6d114c7ae0c64d6a4ee5d71b588864c43..0567d3965fda4dffb422125a7cf4351272f2daa8 100644 (file)
@@ -12,7 +12,7 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/syscore_ops.h>
@@ -43,7 +43,6 @@
 #include <asm/mach/flash.h>
 
 #include <mach/pxa27x.h>
-#include <mach/gpio.h>
 #include <mach/mainstone.h>
 #include <mach/audio.h>
 #include <mach/pxafb.h>
index b27544bcafcb5c68b384d850ea522da8f8712afe..43a5f6861ca3f8209c79bd311cac9e0d87781e11 100644 (file)
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/syscore_ops.h>
 
-#include <mach/gpio.h>
 #include <mach/pxa2xx-regs.h>
 #include <mach/mfp-pxa2xx.h>
+#include <mach/gpio-pxa.h>
 
 #include "generic.h"
 
index 6d5b7e0621248d50dcb4dd90c0f876c6ec7471f5..9a9c539f6c015b51b2c6eb45a5c483786b12338e 100644 (file)
@@ -19,7 +19,7 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/irq.h>
 #include <linux/platform_device.h>
 #include <linux/i2c.h>
@@ -28,7 +28,6 @@
 
 #include <media/soc_camera.h>
 
-#include <asm/gpio.h>
 #include <mach/camera.h>
 #include <asm/mach/map.h>
 #include <mach/pxa27x.h>
index 9c434d21a271a9d5e49cf1e0776ac84cd27c72c2..8746e1090b6e4c524d695408702cd2b3bba154ff 100644 (file)
@@ -16,6 +16,7 @@
  * initialization stuff for PXA machines which can be overridden later if
  * need be.
  */
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/suspend.h>
 #include <linux/syscore_ops.h>
 #include <linux/irq.h>
+#include <linux/gpio.h>
 
 #include <asm/mach/map.h>
 #include <asm/suspend.h>
 #include <mach/hardware.h>
 #include <mach/irqs.h>
-#include <mach/gpio.h>
 #include <mach/pxa25x.h>
 #include <mach/reset.h>
 #include <mach/pm.h>
index 9d2400b5f503f617ff29e849cc49f1a7f2a33dc6..2bb5cf8ba6ec69621519d421e7f38653639d6881 100644 (file)
@@ -11,6 +11,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/i2c/pxa-i2c.h>
+#include <linux/gpio.h>
 
 #include <asm/mach/map.h>
 #include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/suspend.h>
 #include <mach/irqs.h>
-#include <mach/gpio.h>
 #include <mach/pxa27x.h>
 #include <mach/reset.h>
 #include <mach/ohci.h>
index b5cd9e5aba31bcf4eaee282879bd5891c93c26cd..f940a13455318467e5626322823c449931d22c5b 100644 (file)
@@ -12,7 +12,6 @@
  * 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>
@@ -26,7 +25,7 @@
 #include <asm/mach/map.h>
 #include <asm/suspend.h>
 #include <mach/hardware.h>
-#include <mach/gpio.h>
+#include <mach/gpio-pxa.h>
 #include <mach/pxa3xx-regs.h>
 #include <mach/reset.h>
 #include <mach/ohci.h>
index 0ee166b61f81399448d48c119f101829b1a85158..51371b39d2a315b8880a2d2d03ca5a061a00baa8 100644 (file)
@@ -9,7 +9,6 @@
  * 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>
@@ -21,7 +20,7 @@
 #include <linux/syscore_ops.h>
 
 #include <mach/hardware.h>
-#include <mach/gpio.h>
+#include <mach/gpio-pxa.h>
 #include <mach/pxa3xx-regs.h>
 #include <mach/pxa930.h>
 #include <mach/reset.h>
index 5ce340320ab94fd776d7bf86c85f0ed3ac544cfa..3c988b6f718fbbff82743d58cf5e8edb3cb5eece 100644 (file)
@@ -9,12 +9,13 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  publishhed by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/i2c.h>
 #include <linux/i2c/pxa-i2c.h>
 #include <linux/mfd/88pm860x.h>
+#include <linux/gpio.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -23,7 +24,6 @@
 #include <mach/hardware.h>
 #include <mach/mfp.h>
 #include <mach/mfp-pxa930.h>
-#include <mach/gpio.h>
 
 #include "generic.h"
 
index 94ff27678a46ff9492f9e3e172e75e818049bdb2..40a8c178f10d9e85a2873c83247c3f2fe553f408 100644 (file)
@@ -1,6 +1 @@
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
+/* empty */
index dde6b3c0e299c55574ef50f910da7ed1e0c293a6..050d63c74cc10eabf776429875a301c70f17fe81 100644 (file)
@@ -36,7 +36,7 @@
 
 #define EASI_SIZE              0x08000000      /* EASI I/O */
 #define EASI_START             0x08000000
-#define EASI_BASE              0xe5000000
+#define EASI_BASE              IOMEM(0xe5000000)
 
 #define IO_START               0x03000000      /* I/O */
 #define IO_SIZE                        0x01000000
 /*
  * IO Addresses
  */
-#define VIDC_BASE              IOMEM(0xe0400000)
-#define EXPMASK_BASE           0xe0360000
-#define IOMD_BASE              IOMEM(0xe0200000)
-#define IOC_BASE               IOMEM(0xe0200000)
-#define PCIO_BASE              IOMEM(0xe0010000)
-#define FLOPPYDMA_BASE         IOMEM(0xe002a000)
+#define ECARD_EASI_BASE                (EASI_BASE)
+#define VIDC_BASE              (IO_BASE + 0x00400000)
+#define EXPMASK_BASE           (IO_BASE + 0x00360000)
+#define ECARD_IOC4_BASE                (IO_BASE + 0x00270000)
+#define ECARD_IOC_BASE         (IO_BASE + 0x00240000)
+#define IOMD_BASE              (IO_BASE + 0x00200000)
+#define IOC_BASE               (IO_BASE + 0x00200000)
+#define ECARD_MEMC8_BASE       (IO_BASE + 0x0002b000)
+#define FLOPPYDMA_BASE         (IO_BASE + 0x0002a000)
+#define PCIO_BASE              (IO_BASE + 0x00010000)
+#define ECARD_MEMC_BASE                (IO_BASE + 0x00000000)
 
 #define vidc_writel(val)       __raw_writel(val, VIDC_BASE)
 
-#define IO_EC_EASI_BASE                0x81400000
-#define IO_EC_IOC4_BASE                0x8009c000
-#define IO_EC_IOC_BASE         0x80090000
-#define IO_EC_MEMC8_BASE       0x8000ac00
-#define IO_EC_MEMC_BASE                0x80000000
-
 #define NETSLOT_BASE           0x0302b000
 #define NETSLOT_SIZE           0x00001000
 
index 20da7f486e5167627378d3a9442db8fff0a7d370..695f4ed2e11bab87d45ccd8ee2574a2ca8939dcd 100644 (file)
 
 #include <mach/hardware.h>
 
-#define IO_SPACE_LIMIT 0xffffffff
+#define IO_SPACE_LIMIT 0xffff
 
 /*
- * We use two different types of addressing - PC style addresses, and ARM
- * addresses.  PC style accesses the PC hardware with the normal PC IO
- * addresses, eg 0x3f8 for serial#1.  ARM addresses are 0x80000000+
- * and are translated to the start of IO.  Note that all addresses are
- * shifted left!
- */
-#define __PORT_PCIO(x) (!((x) & 0x80000000))
-
-/*
- * Dynamic IO functions.
- */
-static inline void __outb (unsigned int value, unsigned int port)
-{
-       unsigned long temp;
-       __asm__ __volatile__(
-       "tst    %2, #0x80000000\n\t"
-       "mov    %0, %4\n\t"
-       "addeq  %0, %0, %3\n\t"
-       "strb   %1, [%0, %2, lsl #2]    @ outb"
-       : "=&r" (temp)
-       : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
-       : "cc");
-}
-
-static inline void __outw (unsigned int value, unsigned int port)
-{
-       unsigned long temp;
-       __asm__ __volatile__(
-       "tst    %2, #0x80000000\n\t"
-       "mov    %0, %4\n\t"
-       "addeq  %0, %0, %3\n\t"
-       "str    %1, [%0, %2, lsl #2]    @ outw"
-       : "=&r" (temp)
-       : "r" (value|value<<16), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
-       : "cc");
-}
-
-static inline void __outl (unsigned int value, unsigned int port)
-{
-       unsigned long temp;
-       __asm__ __volatile__(
-       "tst    %2, #0x80000000\n\t"
-       "mov    %0, %4\n\t"
-       "addeq  %0, %0, %3\n\t"
-       "str    %1, [%0, %2, lsl #2]    @ outl"
-       : "=&r" (temp)
-       : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
-       : "cc");
-}
-
-#define DECLARE_DYN_IN(sz,fnsuffix,instr)                                      \
-static inline unsigned sz __in##fnsuffix (unsigned int port)           \
-{                                                                              \
-       unsigned long temp, value;                                              \
-       __asm__ __volatile__(                                                   \
-       "tst    %2, #0x80000000\n\t"                                            \
-       "mov    %0, %4\n\t"                                                     \
-       "addeq  %0, %0, %3\n\t"                                                 \
-       "ldr" instr "   %1, [%0, %2, lsl #2]    @ in" #fnsuffix                 \
-       : "=&r" (temp), "=r" (value)                                            \
-       : "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)                \
-       : "cc");                                                                \
-       return (unsigned sz)value;                                              \
-}
-
-static inline void __iomem *__deprecated __ioaddr(unsigned int port)
-{
-       void __iomem *ret;
-       if (__PORT_PCIO(port))
-               ret = PCIO_BASE;
-       else
-               ret = IO_BASE;
-       return ret + (port << 2);
-}
-
-#define DECLARE_IO(sz,fnsuffix,instr)  \
-       DECLARE_DYN_IN(sz,fnsuffix,instr)
-
-DECLARE_IO(char,b,"b")
-DECLARE_IO(short,w,"")
-DECLARE_IO(int,l,"")
-
-#undef DECLARE_IO
-#undef DECLARE_DYN_IN
-
-/*
- * Constant address IO functions
+ * We need PC style IO addressing for:
+ *  - floppy (at 0x3f2,0x3f4,0x3f5,0x3f7)
+ *  - parport (at 0x278-0x27a, 0x27b-0x27f, 0x778-0x77a)
+ *  - 8250 serial (only for compile)
  *
- * These have to be macros for the 'J' constraint to work -
- * +/-4096 immediate operand.
+ * These peripherals are found in an area of MMIO which looks very much
+ * like an ISA bus, but with registers at the low byte of each word.
  */
-#define __outbc(value,port)                                                    \
-({                                                                             \
-       if (__PORT_PCIO((port)))                                                \
-               __asm__ __volatile__(                                           \
-               "strb   %0, [%1, %2]    @ outbc"                                \
-               : : "r" (value), "r" (PCIO_BASE), "Jr" ((port) << 2));          \
-       else                                                                    \
-               __asm__ __volatile__(                                           \
-               "strb   %0, [%1, %2]    @ outbc"                                \
-               : : "r" (value), "r" (IO_BASE), "r" ((port) << 2));             \
-})
-
-#define __inbc(port)                                                           \
-({                                                                             \
-       unsigned char result;                                                   \
-       if (__PORT_PCIO((port)))                                                \
-               __asm__ __volatile__(                                           \
-               "ldrb   %0, [%1, %2]    @ inbc"                                 \
-               : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2));         \
-       else                                                                    \
-               __asm__ __volatile__(                                           \
-               "ldrb   %0, [%1, %2]    @ inbc"                                 \
-               : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2));            \
-       result;                                                                 \
-})
-
-#define __outwc(value,port)                                                    \
-({                                                                             \
-       unsigned long __v = value;                                              \
-       if (__PORT_PCIO((port)))                                                \
-               __asm__ __volatile__(                                           \
-               "str    %0, [%1, %2]    @ outwc"                                \
-               : : "r" (__v|__v<<16), "r" (PCIO_BASE), "Jr" ((port) << 2));    \
-       else                                                                    \
-               __asm__ __volatile__(                                           \
-               "str    %0, [%1, %2]    @ outwc"                                \
-               : : "r" (__v|__v<<16), "r" (IO_BASE), "r" ((port) << 2));               \
-})
-
-#define __inwc(port)                                                           \
-({                                                                             \
-       unsigned short result;                                                  \
-       if (__PORT_PCIO((port)))                                                \
-               __asm__ __volatile__(                                           \
-               "ldr    %0, [%1, %2]    @ inwc"                                 \
-               : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2));         \
-       else                                                                    \
-               __asm__ __volatile__(                                           \
-               "ldr    %0, [%1, %2]    @ inwc"                                 \
-               : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2));            \
-       result & 0xffff;                                                        \
-})
-
-#define __outlc(value,port)                                                    \
-({                                                                             \
-       unsigned long __v = value;                                              \
-       if (__PORT_PCIO((port)))                                                \
-               __asm__ __volatile__(                                           \
-               "str    %0, [%1, %2]    @ outlc"                                \
-               : : "r" (__v), "r" (PCIO_BASE), "Jr" ((port) << 2));            \
-       else                                                                    \
-               __asm__ __volatile__(                                           \
-               "str    %0, [%1, %2]    @ outlc"                                \
-               : : "r" (__v), "r" (IO_BASE), "r" ((port) << 2));               \
-})
-
-#define __inlc(port)                                                           \
-({                                                                             \
-       unsigned long result;                                                   \
-       if (__PORT_PCIO((port)))                                                \
-               __asm__ __volatile__(                                           \
-               "ldr    %0, [%1, %2]    @ inlc"                                 \
-               : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2));         \
-       else                                                                    \
-               __asm__ __volatile__(                                           \
-               "ldr    %0, [%1, %2]    @ inlc"                                 \
-               : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2));            \
-       result;                                                                 \
-})
-
-#define inb(p)         (__builtin_constant_p((p)) ? __inbc(p)    : __inb(p))
-#define inw(p)         (__builtin_constant_p((p)) ? __inwc(p)    : __inw(p))
-#define inl(p)         (__builtin_constant_p((p)) ? __inlc(p)    : __inl(p))
-#define outb(v,p)      (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p))
-#define outw(v,p)      (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
-#define outl(v,p)      (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
-
-/* the following macro is deprecated */
-#define ioaddr(port)   ((unsigned long)__ioaddr((port)))
-
-#define insb(p,d,l)    __raw_readsb(__ioaddr(p),d,l)
-#define insw(p,d,l)    __raw_readsw(__ioaddr(p),d,l)
-
-#define outsb(p,d,l)   __raw_writesb(__ioaddr(p),d,l)
-#define outsw(p,d,l)   __raw_writesw(__ioaddr(p),d,l)
+#define __io(a)                (PCIO_BASE + ((a) << 2))
 
 /*
  * 1:1 mapping for ioremapped regions.
index a9241eb877240cfbf66080d7ee5cd9954f7db035..8559598ab767ea8c1ef872e6f35a3bd0792bb398 100644 (file)
@@ -74,7 +74,7 @@ static struct map_desc rpc_io_desc[] __initdata = {
                .length         =       IO_SIZE  ,
                .type           = MT_DEVICE
        }, {    /* EASI space   */
-               .virtual        = EASI_BASE,
+               .virtual        = (unsigned long)EASI_BASE,
                .pfn            = __phys_to_pfn(EASI_START),
                .length         = EASI_SIZE,
                .type           = MT_DEVICE
index f7f6b07df30eaa956acb0c08da276f44c08f8888..6fac70f3484e5b7f1733eb889916e20c69bda9a9 100644 (file)
  * published by the Free Software Foundation.
 */
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
-
 /* some boards require extra gpio capacity to support external
  * devices that need GPIO.
  */
@@ -28,7 +23,6 @@
 #define ARCH_NR_GPIOS  (256 + CONFIG_S3C24XX_GPIO_EXTRA)
 #endif
 
-#include <asm-generic/gpio.h>
 #include <mach/gpio-nrs.h>
 #include <mach/gpio-fns.h>
 
index 97e42bfce81e4e675ac9d6eb8b90735e54696226..fc897d3a056cfc1d1c52c3f89dc8ed09f378187a 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef __ASM_ARCH_H1940_LATCH_H
 #define __ASM_ARCH_H1940_LATCH_H
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 
 #define H1940_LATCH_GPIO(x)            (S3C_GPIO_END + (x))
 
index 9813dbf2ae4f9c2f74012256422c48fda7eaebe6..118749f37c4cddf2df549218a218bd5dd850ee16 100644 (file)
@@ -199,8 +199,6 @@ DECLARE_IO(int,l,"")
 #define outw(v,p)      (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
 #define outl(v,p)      (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
 #define __ioaddr(p)    (__builtin_constant_p((p)) ? __ioaddr(p)  : __ioaddrc(p))
-/* the following macro is deprecated */
-#define ioaddr(port)   __ioaddr((port))
 
 #define insb(p,d,l)    __raw_readsb(__ioaddr(p),d,l)
 #define insw(p,d,l)    __raw_readsw(__ioaddr(p),d,l)
index f1d3bd8f6f179dfc9c54ab41953cde1ba389ca2b..343a540d86a988d4d55a54b8dea79c87eb876ef7 100644 (file)
@@ -170,7 +170,9 @@ int __init s3c2410_init(void)
 {
        printk("S3C2410: Initialising architecture\n");
 
+#ifdef CONFIG_PM
        register_syscore_ops(&s3c2410_pm_syscore_ops);
+#endif
        register_syscore_ops(&s3c24xx_irq_syscore_ops);
 
        return sysdev_register(&s3c2410_sysdev);
index ef0958d3e5c6e1b6dda7a9586099b1ebc3da739a..57a1e01e4e504df85896d275b244782c7e6644e3 100644 (file)
@@ -245,7 +245,9 @@ int __init s3c2412_init(void)
 {
        printk("S3C2412: Initialising architecture\n");
 
+#ifdef CONFIG_PM
        register_syscore_ops(&s3c2412_pm_syscore_ops);
+#endif
        register_syscore_ops(&s3c24xx_irq_syscore_ops);
 
        return sysdev_register(&s3c2412_sysdev);
index 494ce913dc9571752f81590784de2213bfc46bcb..20b3fdfb3051fb7533ec67cee9b5659b13dfda22 100644 (file)
@@ -97,7 +97,9 @@ int __init s3c2416_init(void)
 
        s3c_fb_setname("s3c2443-fb");
 
+#ifdef CONFIG_PM
        register_syscore_ops(&s3c2416_pm_syscore_ops);
+#endif
        register_syscore_ops(&s3c24xx_irq_syscore_ops);
 
        return sysdev_register(&s3c2416_sysdev);
index ce99ff72838defb31fd4fa37f04a61f2660bbc73..2270d3360216abffa913fcbdfff19384a300e558 100644 (file)
@@ -55,7 +55,9 @@ int __init s3c2440_init(void)
 
        /* register suspend/resume handlers */
 
+#ifdef CONFIG_PM
        register_syscore_ops(&s3c2410_pm_syscore_ops);
+#endif
        register_syscore_ops(&s3c244x_pm_syscore_ops);
        register_syscore_ops(&s3c24xx_irq_syscore_ops);
 
index 9ad99f8016a174b119c3ff46bf51e1191320146f..6f2b65e6e06868ba96bc27df27dfec5643eac254 100644 (file)
@@ -169,7 +169,9 @@ int __init s3c2442_init(void)
 {
        printk("S3C2442: Initialising architecture\n");
 
+#ifdef CONFIG_PM
        register_syscore_ops(&s3c2410_pm_syscore_ops);
+#endif
        register_syscore_ops(&s3c244x_pm_syscore_ops);
        register_syscore_ops(&s3c24xx_irq_syscore_ops);
 
index 0d46e994048a5ed1cb4bd4fba7be64ee864cbd38..6e34c2f6e670394ac6437662af481af2bfaa7e79 100644 (file)
  * published by the Free Software Foundation.
 */
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
-
 /* GPIO bank sizes */
 #define S3C64XX_GPIO_A_NR      (8)
 #define S3C64XX_GPIO_B_NR      (7)
@@ -96,5 +91,3 @@ enum s3c_gpio_number {
 #define BOARD_NR_GPIOS 16
 
 #define ARCH_NR_GPIOS  (GPIO_BOARD_START + BOARD_NR_GPIOS)
-
-#include <asm-generic/gpio.h>
index adb5f298ead895a65db824705c7c8a7f38459ea6..06cd3c9b16ac14708831cffaf516f8d430b0a80b 100644 (file)
 #ifndef __ASM_ARCH_GPIO_H
 #define __ASM_ARCH_GPIO_H __FILE__
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
-
 /* GPIO bank sizes */
 
 #define S5P6440_GPIO_A_NR      (6)
@@ -134,6 +129,4 @@ enum s5p6450_gpio_number {
 
 #define ARCH_NR_GPIOS          (S5P64X0_GPIO_END + CONFIG_SAMSUNG_GPIO_EXTRA)
 
-#include <asm-generic/gpio.h>
-
 #endif /* __ASM_ARCH_GPIO_H */
index 29a8a12d9b4f9046a4cce984917329b74683bf2b..5e1a924b595f4ca5db5c5901c2111f8ba0af3c3d 100644 (file)
 #ifndef __ASM_ARCH_GPIO_H
 #define __ASM_ARCH_GPIO_H __FILE__
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
-
 /* GPIO bank sizes */
 #define S5PC100_GPIO_A0_NR     (8)
 #define S5PC100_GPIO_A1_NR     (5)
@@ -146,6 +141,4 @@ enum s5p_gpio_number {
 /* define the number of gpios we need to the one after the MP04() range */
 #define ARCH_NR_GPIOS          (S5PC100_GPIO_END + 1)
 
-#include <asm-generic/gpio.h>
-
 #endif /* __ASM_ARCH_GPIO_H */
index a5a1e331f8ed2214f27ada9fa702cbab55c50813..6c8b903c02e422f7017a2573c270f413469f2b6f 100644 (file)
 #ifndef __ASM_ARCH_GPIO_H
 #define __ASM_ARCH_GPIO_H __FILE__
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
-
 /* Practically, GPIO banks up to MP03 are the configurable gpio banks */
 
 /* GPIO bank sizes */
@@ -142,6 +137,4 @@ enum s5p_gpio_number {
 #define ARCH_NR_GPIOS          (S5PV210_MP05(S5PV210_GPIO_MP05_NR) +   \
                                 CONFIG_SAMSUNG_GPIO_EXTRA + 1)
 
-#include <asm-generic/gpio.h>
-
 #endif /* __ASM_ARCH_GPIO_H */
index 41252d22e6591d437e274d967126ed86dee0112a..73a5c643179209e3192ffe65dd4a5bcf6c1c21e7 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 # Common support
-obj-y := clock.o generic.o gpio.o irq.o dma.o time.o #nmi-oopser.o
+obj-y := clock.o generic.o irq.o dma.o time.o #nmi-oopser.o
 obj-m :=
 obj-n :=
 obj-  :=
index e21f3470eeceeb0d40a89e856400c40fc3a9b104..5fa5ae1f39e1164f6745704ed23f7825f16c17b6 100644 (file)
@@ -9,6 +9,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -24,7 +25,6 @@
 #include <asm/mach/map.h>
 #include <asm/mach/flash.h>
 #include <asm/irq.h>
-#include <asm/gpio.h>
 
 #include "generic.h"
 
index 7befc104e9a97a2fef34fae884b32a8cb2d54d38..703631887c94ae0de4bb66ada4913ce7e05ea4a4 100644 (file)
@@ -28,6 +28,8 @@
 #include <asm/irq.h>
 #include <asm-generic/gpio.h>
 
+#define __ARM_GPIOLIB_COMPLEX
+
 static inline int gpio_get_value(unsigned gpio)
 {
        if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX))
@@ -51,7 +53,5 @@ static inline void gpio_set_value(unsigned gpio, int value)
 
 #define gpio_to_irq(gpio)      ((gpio < 11) ? (IRQ_GPIO0 + gpio) : \
                                        (IRQ_GPIO11 - 11 + gpio))
-#define irq_to_gpio(irq)       ((irq < IRQ_GPIO11_27) ? (irq - IRQ_GPIO0) : \
-                                       (irq - IRQ_GPIO11 + 11))
 
 #endif
index d8b43f3dcd2d92d6b6e72a59ed05f6d028b12622..dfc27ff083446397f4e6324bd76a419f20a31d37 100644 (file)
 #ifndef __ASM_ARM_ARCH_IO_H
 #define __ASM_ARM_ARCH_IO_H
 
-#define IO_SPACE_LIMIT 0xffffffff
-
 /*
- * We don't actually have real ISA nor PCI buses, but there is so many 
- * drivers out there that might just work if we fake them...
+ * __io() is required to be an equivalent mapping to __mem_pci() for
+ * SOC_COMMON to work.
  */
 #define __io(a)                __typesafe_io(a)
 #define __mem_pci(a)   (a)
index 2b1bb9e43ddadc8b83505b021c5ca7ae4f4704c5..7bf0890e16ba43963171bf5dea4b3345c27e25d8 100644 (file)
 
 #ifdef CONFIG_GPIOLIB
 
-static inline int gpio_get_value(unsigned gpio)
-{
-       return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned gpio, int value)
-{
-       __gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned gpio)
-{
-       return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned gpio)
-{
-       return __gpio_to_irq(gpio);
-}
-
 static inline int irq_to_gpio(unsigned int irq)
 {
        return -ENOSYS;
 }
 
+#else
+
+#define __ARM_GPIOLIB_COMPLEX
+
 #endif /* CONFIG_GPIOLIB */
 
 #endif /* __ASM_ARCH_GPIO_H */
index 9c27b95b8d869f975ae382c2eb076c6671034ba1..6db7d699ef1ca1e83a4a828d073b36ec4b0da790 100644 (file)
 
 #include <mach/pinmux.h>
 #include "board.h"
+#include "board-harmony.h"
 
 #ifdef CONFIG_TEGRA_PCI
 
-/* GPIO 3 of the PMIC */
-#define EN_VDD_1V05_GPIO       (TEGRA_NR_GPIOS + 2)
-
 static int __init harmony_pcie_init(void)
 {
        struct regulator *regulator = NULL;
@@ -38,11 +36,11 @@ static int __init harmony_pcie_init(void)
        if (!machine_is_harmony())
                return 0;
 
-       err = gpio_request(EN_VDD_1V05_GPIO, "EN_VDD_1V05");
+       err = gpio_request(TEGRA_GPIO_EN_VDD_1V05_GPIO, "EN_VDD_1V05");
        if (err)
                return err;
 
-       gpio_direction_output(EN_VDD_1V05_GPIO, 1);
+       gpio_direction_output(TEGRA_GPIO_EN_VDD_1V05_GPIO, 1);
 
        regulator = regulator_get(NULL, "pex_clk");
        if (IS_ERR_OR_NULL(regulator))
@@ -68,7 +66,7 @@ err_pcie:
        regulator_disable(regulator);
        regulator_put(regulator);
 err_reg:
-       gpio_free(EN_VDD_1V05_GPIO);
+       gpio_free(TEGRA_GPIO_EN_VDD_1V05_GPIO);
 
        return err;
 }
index d85142edaf6bc0eebc7d66b385e457d91fc5a100..139d96c93843f6b94ad120789497fb4ecfde18c9 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef _MACH_TEGRA_BOARD_HARMONY_H
 #define _MACH_TEGRA_BOARD_HARMONY_H
 
+#include <mach/gpio-tegra.h>
+
 #define HARMONY_GPIO_TPS6586X(_x_)     (TEGRA_NR_GPIOS + (_x_))
 #define HARMONY_GPIO_WM8903(_x_)       (HARMONY_GPIO_TPS6586X(4) + (_x_))
 
@@ -31,6 +33,7 @@
 #define TEGRA_GPIO_HP_DET              TEGRA_GPIO_PW2
 #define TEGRA_GPIO_INT_MIC_EN          TEGRA_GPIO_PX0
 #define TEGRA_GPIO_EXT_MIC_EN          TEGRA_GPIO_PX1
+#define TEGRA_GPIO_EN_VDD_1V05_GPIO    HARMONY_GPIO_TPS6586X(2)
 
 void harmony_pinmux_init(void);
 int harmony_regulator_init(void);
index d4ff39ddaeb3e4fffbbdf62e2183e68a2013f9de..42ce8639b90cc38ef5a1c79e053d089ed86dcd0b 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef _MACH_TEGRA_BOARD_PAZ00_H
 #define _MACH_TEGRA_BOARD_PAZ00_H
 
+#include <mach/gpio-tegra.h>
+
 #define TEGRA_GPIO_SD1_CD              TEGRA_GPIO_PV5
 #define TEGRA_GPIO_SD1_WP              TEGRA_GPIO_PH1
 #define TEGRA_GPIO_SD1_POWER           TEGRA_GPIO_PT3
index d8415e1a8434f21e61eace90c0585fb00268ee94..15b6c57361bed412bf43e4de17ced72e4c0a5f60 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef _MACH_TEGRA_BOARD_SEABOARD_H
 #define _MACH_TEGRA_BOARD_SEABOARD_H
 
+#include <mach/gpio-tegra.h>
+
 #define TEGRA_GPIO_SD2_CD              TEGRA_GPIO_PI5
 #define TEGRA_GPIO_SD2_WP              TEGRA_GPIO_PH1
 #define TEGRA_GPIO_SD2_POWER           TEGRA_GPIO_PI6
index 47c596cdbf32e4012d003574388cd935099c54a0..bcb1916e68b99d1ffd9167065d4d82fcc662eb7f 100644 (file)
  * GNU General Public License for more details.
  *
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 
 #include <mach/pinmux.h>
-#include <mach/gpio.h>
 
 #include "gpio-names.h"
 #include "board-trimslice.h"
index 7a7dee86b4da717a3ac00982f31674754c50c924..50f128d87779d2ef3888cca009883c036ea09015 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef _MACH_TEGRA_BOARD_TRIMSLICE_H
 #define _MACH_TEGRA_BOARD_TRIMSLICE_H
 
+#include <mach/gpio-tegra.h>
+
 #define TRIMSLICE_GPIO_SD4_CD  TEGRA_GPIO_PP1  /* mmc4 cd */
 #define TRIMSLICE_GPIO_SD4_WP  TEGRA_GPIO_PP2  /* mmc4 wp */
 
index 0e1016a827acbd5fa54512344bc067b057edd2a7..0e0fd4d889bd78830fb4616272414a818ec904cc 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <asm/system.h>
 
-#include <mach/hardware.h>
 #include <mach/clk.h>
 
 /* Frequency table index must be sequential starting at 0 */
diff --git a/arch/arm/mach-tegra/include/mach/gpio-tegra.h b/arch/arm/mach-tegra/include/mach/gpio-tegra.h
new file mode 100644 (file)
index 0000000..87d37fd
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * arch/arm/mach-tegra/include/mach/gpio.h
+ *
+ * Copyright (C) 2010 Google, Inc.
+ *
+ * Author:
+ *     Erik Gilling <konkers@google.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MACH_TEGRA_GPIO_TEGRA_H
+#define __MACH_TEGRA_GPIO_TEGRA_H
+
+#include <linux/types.h>
+#include <mach/irqs.h>
+
+#define TEGRA_NR_GPIOS         INT_GPIO_NR
+
+#define TEGRA_GPIO_TO_IRQ(gpio) (INT_GPIO_BASE + (gpio))
+
+struct tegra_gpio_table {
+       int     gpio;   /* GPIO number */
+       bool    enable; /* Enable for GPIO at init? */
+};
+
+void tegra_gpio_config(struct tegra_gpio_table *table, int num);
+void tegra_gpio_enable(int gpio);
+void tegra_gpio_disable(int gpio);
+
+#endif
index 196f114dc241fa704f9972f478cc42afbc5331c9..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,60 +0,0 @@
-/*
- * arch/arm/mach-tegra/include/mach/gpio.h
- *
- * Copyright (C) 2010 Google, Inc.
- *
- * Author:
- *     Erik Gilling <konkers@google.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __MACH_TEGRA_GPIO_H
-#define __MACH_TEGRA_GPIO_H
-
-#include <linux/init.h>
-#include <mach/irqs.h>
-
-#define TEGRA_NR_GPIOS         INT_GPIO_NR
-
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value         __gpio_get_value
-#define gpio_set_value         __gpio_set_value
-#define gpio_cansleep          __gpio_cansleep
-
-#define TEGRA_GPIO_TO_IRQ(gpio) (INT_GPIO_BASE + (gpio))
-#define TEGRA_IRQ_TO_GPIO(irq) ((irq) - INT_GPIO_BASE)
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-       if (gpio < TEGRA_NR_GPIOS)
-               return INT_GPIO_BASE + gpio;
-       return -EINVAL;
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-       if ((irq >= INT_GPIO_BASE) && (irq < INT_GPIO_BASE + INT_GPIO_NR))
-               return irq - INT_GPIO_BASE;
-       return -EINVAL;
-}
-
-struct tegra_gpio_table {
-       int     gpio;   /* GPIO number */
-       bool    enable; /* Enable for GPIO at init? */
-};
-
-void tegra_gpio_config(struct tegra_gpio_table *table, int num);
-void tegra_gpio_enable(int gpio);
-void tegra_gpio_disable(int gpio);
-
-#endif
index 88081bb3ec52dd807092ea397685126f2a1602f2..37576a721aeb7c6b549b7201a9999901f901956f 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
 #include <asm/mach-types.h>
+#include <mach/gpio-tegra.h>
 #include <mach/usb_phy.h>
 #include <mach/iomap.h>
 
index 32a7b0f7e9f79b4b11aa021b1250bc872879ce7e..7b5c229dc7eaf2f757b3adf5536c835cb7a5d38a 100644 (file)
@@ -6,6 +6,7 @@ comment "ST-Ericsson Mobile Platform Products"
 
 config MACH_U300
        bool "U300"
+       select GPIO_U300
 
 comment "ST-Ericsson U300/U330/U335/U365 Feature Selections"
 
index 376b6dfdfae99ceccac9b92deb813eab3c2940ed..22c5ab79a74c01e9c6b8ee13c0949123fa5b531c 100644 (file)
@@ -38,6 +38,7 @@
 #include <mach/hardware.h>
 #include <mach/syscon.h>
 #include <mach/dma_channels.h>
+#include <mach/gpio-u300.h>
 
 #include "clock.h"
 #include "mmc.h"
@@ -242,7 +243,7 @@ static struct resource gpio_resources[] = {
                .end   = IRQ_U300_GPIO_PORT2,
                .flags = IORESOURCE_IRQ,
        },
-#ifdef U300_COH901571_3
+#if defined(CONFIG_MACH_U300_BS365) || defined(CONFIG_MACH_U300_BS335)
        {
                .name  = "gpio3",
                .start = IRQ_U300_GPIO_PORT3,
@@ -255,6 +256,7 @@ static struct resource gpio_resources[] = {
                .end   = IRQ_U300_GPIO_PORT4,
                .flags = IORESOURCE_IRQ,
        },
+#endif
 #ifdef CONFIG_MACH_U300_BS335
        {
                .name  = "gpio5",
@@ -269,7 +271,6 @@ static struct resource gpio_resources[] = {
                .flags = IORESOURCE_IRQ,
        },
 #endif /* CONFIG_MACH_U300_BS335 */
-#endif /* U300_COH901571_3 */
 };
 
 static struct resource keypad_resources[] = {
@@ -1559,11 +1560,35 @@ static struct platform_device i2c1_device = {
        .resource = i2c1_resources,
 };
 
+/*
+ * The different variants have a few different versions of the
+ * GPIO block, with different number of ports.
+ */
+static struct u300_gpio_platform u300_gpio_plat = {
+#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
+       .variant = U300_GPIO_COH901335,
+       .ports = 3,
+#endif
+#ifdef CONFIG_MACH_U300_BS335
+       .variant = U300_GPIO_COH901571_3_BS335,
+       .ports = 7,
+#endif
+#ifdef CONFIG_MACH_U300_BS365
+       .variant = U300_GPIO_COH901571_3_BS365,
+       .ports = 5,
+#endif
+       .gpio_base = 0,
+       .gpio_irq_base = IRQ_U300_GPIO_BASE,
+};
+
 static struct platform_device gpio_device = {
        .name = "u300-gpio",
        .id = -1,
        .num_resources = ARRAY_SIZE(gpio_resources),
        .resource = gpio_resources,
+       .dev = {
+               .platform_data = &u300_gpio_plat,
+       },
 };
 
 static struct platform_device keypad_device = {
@@ -1669,7 +1694,7 @@ void __init u300_init_irq(void)
        BUG_ON(IS_ERR(clk));
        clk_enable(clk);
 
-       for (i = 0; i < NR_IRQS; i++)
+       for (i = 0; i < U300_VIC_IRQS_END; i++)
                set_bit(i, (unsigned long *) &mask[0]);
        vic_init((void __iomem *) U300_INTCON0_VBASE, 0, mask[0], mask[0]);
        vic_init((void __iomem *) U300_INTCON1_VBASE, 32, mask[1], mask[1]);
diff --git a/arch/arm/mach-u300/include/mach/gpio-u300.h b/arch/arm/mach-u300/include/mach/gpio-u300.h
new file mode 100644 (file)
index 0000000..0c2b202
--- /dev/null
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2007-2011 ST-Ericsson AB
+ * License terms: GNU General Public License (GPL) version 2
+ * GPIO block resgister definitions and inline macros for
+ * U300 GPIO COH 901 335 or COH 901 571/3
+ * Author: Linus Walleij <linus.walleij@stericsson.com>
+ */
+
+#ifndef __MACH_U300_GPIO_U300_H
+#define __MACH_U300_GPIO_U300_H
+
+/*
+ * Individual pin assignments for the B26/S26. Notice that the
+ * actual usage of these pins depends on the PAD MUX settings, that
+ * is why the same number can potentially appear several times.
+ * In the reference design each pin is only used for one purpose.
+ * These were determined by inspecting the B26/S26 schematic:
+ * 2/1911-ROA 128 1603
+ */
+#ifdef CONFIG_MACH_U300_BS2X
+#define U300_GPIO_PIN_UART_RX          0
+#define U300_GPIO_PIN_UART_TX          1
+#define U300_GPIO_PIN_GPIO02           2  /* Unrouted */
+#define U300_GPIO_PIN_GPIO03           3  /* Unrouted */
+#define U300_GPIO_PIN_CAM_SLEEP                4
+#define U300_GPIO_PIN_CAM_REG_EN       5
+#define U300_GPIO_PIN_GPIO06           6  /* Unrouted */
+#define U300_GPIO_PIN_GPIO07           7  /* Unrouted */
+
+#define U300_GPIO_PIN_GPIO08           8  /* Service point SP2321 */
+#define U300_GPIO_PIN_GPIO09           9  /* Service point SP2322 */
+#define U300_GPIO_PIN_PHFSENSE         10 /* Headphone jack sensing */
+#define U300_GPIO_PIN_MMC_CLKRET       11 /* Clock return from MMC/SD card */
+#define U300_GPIO_PIN_MMC_CD           12 /* MMC Card insertion detection */
+#define U300_GPIO_PIN_FLIPSENSE                13 /* Mechanical flip sensing */
+#define U300_GPIO_PIN_GPIO14           14 /* DSP JTAG Port RTCK */
+#define U300_GPIO_PIN_GPIO15           15 /* Unrouted */
+
+#define U300_GPIO_PIN_GPIO16           16 /* Unrouted */
+#define U300_GPIO_PIN_GPIO17           17 /* Unrouted */
+#define U300_GPIO_PIN_GPIO18           18 /* Unrouted */
+#define U300_GPIO_PIN_GPIO19           19 /* Unrouted */
+#define U300_GPIO_PIN_GPIO20           20 /* Unrouted */
+#define U300_GPIO_PIN_GPIO21           21 /* Unrouted */
+#define U300_GPIO_PIN_GPIO22           22 /* Unrouted */
+#define U300_GPIO_PIN_GPIO23           23 /* Unrouted */
+#endif
+
+/*
+ * Individual pin assignments for the B330/S330 and B365/S365.
+ * Notice that the actual usage of these pins depends on the
+ * PAD MUX settings, that is why the same number can potentially
+ * appear several times. In the reference design each pin is only
+ * used for one purpose. These were determined by inspecting the
+ * S365 schematic.
+ */
+#if defined(CONFIG_MACH_U300_BS330) || defined(CONFIG_MACH_U300_BS365) || \
+    defined(CONFIG_MACH_U300_BS335)
+#define U300_GPIO_PIN_UART_RX          0
+#define U300_GPIO_PIN_UART_TX          1
+#define U300_GPIO_PIN_UART_CTS         2
+#define U300_GPIO_PIN_UART_RTS         3
+#define U300_GPIO_PIN_CAM_MAIN_STANDBY 4 /* Camera MAIN standby */
+#define U300_GPIO_PIN_GPIO05           5 /* Unrouted */
+#define U300_GPIO_PIN_MS_CD            6 /* Memory Stick Card insertion */
+#define U300_GPIO_PIN_GPIO07           7 /* Test point TP2430 */
+
+#define U300_GPIO_PIN_GPIO08           8 /* Test point TP2437 */
+#define U300_GPIO_PIN_GPIO09           9 /* Test point TP2431 */
+#define U300_GPIO_PIN_GPIO10           10 /* Test point TP2432 */
+#define U300_GPIO_PIN_MMC_CLKRET       11 /* Clock return from MMC/SD card */
+#define U300_GPIO_PIN_MMC_CD           12 /* MMC Card insertion detection */
+#define U300_GPIO_PIN_CAM_SUB_STANDBY  13 /* Camera SUB standby */
+#define U300_GPIO_PIN_GPIO14           14 /* Test point TP2436 */
+#define U300_GPIO_PIN_GPIO15           15 /* Unrouted */
+
+#define U300_GPIO_PIN_GPIO16           16 /* Test point TP2438 */
+#define U300_GPIO_PIN_PHFSENSE         17 /* Headphone jack sensing */
+#define U300_GPIO_PIN_GPIO18           18 /* Test point TP2439 */
+#define U300_GPIO_PIN_GPIO19           19 /* Routed somewhere */
+#define U300_GPIO_PIN_GPIO20           20 /* Unrouted */
+#define U300_GPIO_PIN_GPIO21           21 /* Unrouted */
+#define U300_GPIO_PIN_GPIO22           22 /* Unrouted */
+#define U300_GPIO_PIN_GPIO23           23 /* Unrouted */
+
+#define U300_GPIO_PIN_GPIO24           24 /* Unrouted */
+#define U300_GPIO_PIN_GPIO25           25 /* Unrouted */
+#define U300_GPIO_PIN_GPIO26           26 /* Unrouted */
+#define U300_GPIO_PIN_GPIO27           27 /* Unrouted */
+#define U300_GPIO_PIN_GPIO28           28 /* Unrouted */
+#define U300_GPIO_PIN_GPIO29           29 /* Unrouted */
+#define U300_GPIO_PIN_GPIO30           30 /* Unrouted */
+#define U300_GPIO_PIN_GPIO31           31 /* Unrouted */
+
+#define U300_GPIO_PIN_GPIO32           32 /* Unrouted */
+#define U300_GPIO_PIN_GPIO33           33 /* Unrouted */
+#define U300_GPIO_PIN_GPIO34           34 /* Unrouted */
+#define U300_GPIO_PIN_GPIO35           35 /* Unrouted */
+#define U300_GPIO_PIN_GPIO36           36 /* Unrouted */
+#define U300_GPIO_PIN_GPIO37           37 /* Unrouted */
+#define U300_GPIO_PIN_GPIO38           38 /* Unrouted */
+#define U300_GPIO_PIN_GPIO39           39 /* Unrouted */
+
+#ifdef CONFIG_MACH_U300_BS335
+
+#define U300_GPIO_PIN_GPIO40           40 /* Unrouted */
+#define U300_GPIO_PIN_GPIO41           41 /* Unrouted */
+#define U300_GPIO_PIN_GPIO42           42 /* Unrouted */
+#define U300_GPIO_PIN_GPIO43           43 /* Unrouted */
+#define U300_GPIO_PIN_GPIO44           44 /* Unrouted */
+#define U300_GPIO_PIN_GPIO45           45 /* Unrouted */
+#define U300_GPIO_PIN_GPIO46           46 /* Unrouted */
+#define U300_GPIO_PIN_GPIO47           47 /* Unrouted */
+
+#define U300_GPIO_PIN_GPIO48           48 /* Unrouted */
+#define U300_GPIO_PIN_GPIO49           49 /* Unrouted */
+#define U300_GPIO_PIN_GPIO50           50 /* Unrouted */
+#define U300_GPIO_PIN_GPIO51           51 /* Unrouted */
+#define U300_GPIO_PIN_GPIO52           52 /* Unrouted */
+#define U300_GPIO_PIN_GPIO53           53 /* Unrouted */
+#define U300_GPIO_PIN_GPIO54           54 /* Unrouted */
+#define U300_GPIO_PIN_GPIO55           55 /* Unrouted */
+#endif
+
+#endif
+
+/**
+ * enum u300_gpio_variant - the type of U300 GPIO employed
+ */
+enum u300_gpio_variant {
+       U300_GPIO_COH901335,
+       U300_GPIO_COH901571_3_BS335,
+       U300_GPIO_COH901571_3_BS365,
+};
+
+/**
+ * struct u300_gpio_platform - U300 GPIO platform data
+ * @variant: IP block variant
+ * @ports: number of GPIO block ports
+ * @gpio_base: first GPIO number for this block (use a free range)
+ * @gpio_irq_base: first GPIO IRQ number for this block (use a free range)
+ */
+struct u300_gpio_platform {
+       enum u300_gpio_variant variant;
+       u8 ports;
+       int gpio_base;
+       int gpio_irq_base;
+};
+
+#endif /* __MACH_U300_GPIO_U300_H */
index d5a71abcbaeaf5a8da0255e50e89f5982fd447d4..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,294 +0,0 @@
-/*
- *
- * arch/arm/mach-u300/include/mach/gpio.h
- *
- *
- * Copyright (C) 2007-2009 ST-Ericsson AB
- * License terms: GNU General Public License (GPL) version 2
- * GPIO block resgister definitions and inline macros for
- * U300 GPIO COH 901 335 or COH 901 571/3
- * Author: Linus Walleij <linus.walleij@stericsson.com>
- */
-
-#ifndef __MACH_U300_GPIO_H
-#define __MACH_U300_GPIO_H
-
-#include <linux/kernel.h>
-#include <linux/io.h>
-#include <mach/hardware.h>
-#include <asm/irq.h>
-
-/* Switch type depending on platform/chip variant */
-#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
-#define U300_COH901335
-#endif
-#if defined(CONFIG_MACH_U300_BS365) || defined(CONFIG_MACH_U300_BS335)
-#define U300_COH901571_3
-#endif
-
-/* Get base address for regs here */
-#include "u300-regs.h"
-/* IRQ numbers */
-#include "irqs.h"
-
-/*
- * This is the GPIO block definitions. GPIO (General Purpose I/O) can be
- * used for anything, and often is. The event/enable etc figures are for
- * the lowermost pin (pin 0 on each port), shift this left to match your
- * pin if you're gonna use these values.
- */
-#ifdef U300_COH901335
-#define U300_GPIO_PORTX_SPACING                                (0x1C)
-/* Port X Pin Data Register 32bit, this is both input and output (R/W) */
-#define U300_GPIO_PXPDIR                               (0x00)
-#define U300_GPIO_PXPDOR                               (0x00)
-/* Port X Pin Config Register 32bit (R/W) */
-#define U300_GPIO_PXPCR                                        (0x04)
-#define U300_GPIO_PXPCR_ALL_PINS_MODE_MASK             (0x0000FFFFUL)
-#define U300_GPIO_PXPCR_PIN_MODE_MASK                  (0x00000003UL)
-#define U300_GPIO_PXPCR_PIN_MODE_SHIFT                 (0x00000002UL)
-#define U300_GPIO_PXPCR_PIN_MODE_INPUT                 (0x00000000UL)
-#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL      (0x00000001UL)
-#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN     (0x00000002UL)
-#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE    (0x00000003UL)
-/* Port X Interrupt Event Register 32bit (R/W) */
-#define U300_GPIO_PXIEV                                        (0x08)
-#define U300_GPIO_PXIEV_ALL_IRQ_EVENT_MASK             (0x000000FFUL)
-#define U300_GPIO_PXIEV_IRQ_EVENT                      (0x00000001UL)
-/* Port X Interrupt Enable Register 32bit (R/W) */
-#define U300_GPIO_PXIEN                                        (0x0C)
-#define U300_GPIO_PXIEN_ALL_IRQ_ENABLE_MASK            (0x000000FFUL)
-#define U300_GPIO_PXIEN_IRQ_ENABLE                     (0x00000001UL)
-/* Port X Interrupt Force Register 32bit (R/W) */
-#define U300_GPIO_PXIFR                                        (0x10)
-#define U300_GPIO_PXIFR_ALL_IRQ_FORCE_MASK             (0x000000FFUL)
-#define U300_GPIO_PXIFR_IRQ_FORCE                      (0x00000001UL)
-/* Port X Interrupt Config Register 32bit (R/W) */
-#define U300_GPIO_PXICR                                        (0x14)
-#define U300_GPIO_PXICR_ALL_IRQ_CONFIG_MASK            (0x000000FFUL)
-#define U300_GPIO_PXICR_IRQ_CONFIG_MASK                        (0x00000001UL)
-#define U300_GPIO_PXICR_IRQ_CONFIG_FALLING_EDGE                (0x00000000UL)
-#define U300_GPIO_PXICR_IRQ_CONFIG_RISING_EDGE         (0x00000001UL)
-/* Port X Pull-up Enable Register 32bit (R/W) */
-#define U300_GPIO_PXPER                                        (0x18)
-#define U300_GPIO_PXPER_ALL_PULL_UP_DISABLE_MASK       (0x000000FFUL)
-#define U300_GPIO_PXPER_PULL_UP_DISABLE                        (0x00000001UL)
-/* Control Register 32bit (R/W) */
-#define U300_GPIO_CR                                   (0x54)
-#define U300_GPIO_CR_BLOCK_CLOCK_ENABLE                        (0x00000001UL)
-/* three ports of 8 bits each = GPIO pins 0..23 */
-#define U300_GPIO_NUM_PORTS 3
-#define U300_GPIO_PINS_PER_PORT 8
-#define U300_GPIO_MAX  (U300_GPIO_PINS_PER_PORT * U300_GPIO_NUM_PORTS - 1)
-#endif
-
-#ifdef U300_COH901571_3
-/*
- * Control Register 32bit (R/W)
- * bit 15-9 (mask 0x0000FE00) contains the number of cores. 8*cores
- * gives the number of GPIO pins.
- * bit 8-2  (mask 0x000001FC) contains the core version ID.
- */
-#define U300_GPIO_CR                                   (0x00)
-#define U300_GPIO_CR_SYNC_SEL_ENABLE                   (0x00000002UL)
-#define U300_GPIO_CR_BLOCK_CLKRQ_ENABLE                        (0x00000001UL)
-#define U300_GPIO_PORTX_SPACING                                (0x30)
-/* Port X Pin Data INPUT Register 32bit (R/W) */
-#define U300_GPIO_PXPDIR                               (0x04)
-/* Port X Pin Data OUTPUT Register 32bit (R/W) */
-#define U300_GPIO_PXPDOR                               (0x08)
-/* Port X Pin Config Register 32bit (R/W) */
-#define U300_GPIO_PXPCR                                        (0x0C)
-#define U300_GPIO_PXPCR_ALL_PINS_MODE_MASK             (0x0000FFFFUL)
-#define U300_GPIO_PXPCR_PIN_MODE_MASK                  (0x00000003UL)
-#define U300_GPIO_PXPCR_PIN_MODE_SHIFT                 (0x00000002UL)
-#define U300_GPIO_PXPCR_PIN_MODE_INPUT                 (0x00000000UL)
-#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL      (0x00000001UL)
-#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN     (0x00000002UL)
-#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE    (0x00000003UL)
-/* Port X Pull-up Enable Register 32bit (R/W) */
-#define U300_GPIO_PXPER                                        (0x10)
-#define U300_GPIO_PXPER_ALL_PULL_UP_DISABLE_MASK       (0x000000FFUL)
-#define U300_GPIO_PXPER_PULL_UP_DISABLE                        (0x00000001UL)
-/* Port X Interrupt Event Register 32bit (R/W) */
-#define U300_GPIO_PXIEV                                        (0x14)
-#define U300_GPIO_PXIEV_ALL_IRQ_EVENT_MASK             (0x000000FFUL)
-#define U300_GPIO_PXIEV_IRQ_EVENT                      (0x00000001UL)
-/* Port X Interrupt Enable Register 32bit (R/W) */
-#define U300_GPIO_PXIEN                                        (0x18)
-#define U300_GPIO_PXIEN_ALL_IRQ_ENABLE_MASK            (0x000000FFUL)
-#define U300_GPIO_PXIEN_IRQ_ENABLE                     (0x00000001UL)
-/* Port X Interrupt Force Register 32bit (R/W) */
-#define U300_GPIO_PXIFR                                        (0x1C)
-#define U300_GPIO_PXIFR_ALL_IRQ_FORCE_MASK             (0x000000FFUL)
-#define U300_GPIO_PXIFR_IRQ_FORCE                      (0x00000001UL)
-/* Port X Interrupt Config Register 32bit (R/W) */
-#define U300_GPIO_PXICR                                        (0x20)
-#define U300_GPIO_PXICR_ALL_IRQ_CONFIG_MASK            (0x000000FFUL)
-#define U300_GPIO_PXICR_IRQ_CONFIG_MASK                        (0x00000001UL)
-#define U300_GPIO_PXICR_IRQ_CONFIG_FALLING_EDGE                (0x00000000UL)
-#define U300_GPIO_PXICR_IRQ_CONFIG_RISING_EDGE         (0x00000001UL)
-#ifdef CONFIG_MACH_U300_BS335
-/* seven ports of 8 bits each = GPIO pins 0..55 */
-#define U300_GPIO_NUM_PORTS 7
-#else
-/* five ports of 8 bits each = GPIO pins 0..39 */
-#define U300_GPIO_NUM_PORTS 5
-#endif
-#define U300_GPIO_PINS_PER_PORT 8
-#define U300_GPIO_MAX (U300_GPIO_PINS_PER_PORT * U300_GPIO_NUM_PORTS - 1)
-#endif
-
-/*
- * Individual pin assignments for the B26/S26. Notice that the
- * actual usage of these pins depends on the PAD MUX settings, that
- * is why the same number can potentially appear several times.
- * In the reference design each pin is only used for one purpose.
- * These were determined by inspecting the B26/S26 schematic:
- * 2/1911-ROA 128 1603
- */
-#ifdef CONFIG_MACH_U300_BS2X
-#define U300_GPIO_PIN_UART_RX          0
-#define U300_GPIO_PIN_UART_TX          1
-#define U300_GPIO_PIN_GPIO02           2  /* Unrouted */
-#define U300_GPIO_PIN_GPIO03           3  /* Unrouted */
-#define U300_GPIO_PIN_CAM_SLEEP                4
-#define U300_GPIO_PIN_CAM_REG_EN       5
-#define U300_GPIO_PIN_GPIO06           6  /* Unrouted */
-#define U300_GPIO_PIN_GPIO07           7  /* Unrouted */
-
-#define U300_GPIO_PIN_GPIO08           8  /* Service point SP2321 */
-#define U300_GPIO_PIN_GPIO09           9  /* Service point SP2322 */
-#define U300_GPIO_PIN_PHFSENSE         10 /* Headphone jack sensing */
-#define U300_GPIO_PIN_MMC_CLKRET       11 /* Clock return from MMC/SD card */
-#define U300_GPIO_PIN_MMC_CD           12 /* MMC Card insertion detection */
-#define U300_GPIO_PIN_FLIPSENSE                13 /* Mechanical flip sensing */
-#define U300_GPIO_PIN_GPIO14           14 /* DSP JTAG Port RTCK */
-#define U300_GPIO_PIN_GPIO15           15 /* Unrouted */
-
-#define U300_GPIO_PIN_GPIO16           16 /* Unrouted */
-#define U300_GPIO_PIN_GPIO17           17 /* Unrouted */
-#define U300_GPIO_PIN_GPIO18           18 /* Unrouted */
-#define U300_GPIO_PIN_GPIO19           19 /* Unrouted */
-#define U300_GPIO_PIN_GPIO20           20 /* Unrouted */
-#define U300_GPIO_PIN_GPIO21           21 /* Unrouted */
-#define U300_GPIO_PIN_GPIO22           22 /* Unrouted */
-#define U300_GPIO_PIN_GPIO23           23 /* Unrouted */
-#endif
-
-/*
- * Individual pin assignments for the B330/S330 and B365/S365.
- * Notice that the actual usage of these pins depends on the
- * PAD MUX settings, that is why the same number can potentially
- * appear several times. In the reference design each pin is only
- * used for one purpose. These were determined by inspecting the
- * S365 schematic.
- */
-#if defined(CONFIG_MACH_U300_BS330) || defined(CONFIG_MACH_U300_BS365) || \
-    defined(CONFIG_MACH_U300_BS335)
-#define U300_GPIO_PIN_UART_RX          0
-#define U300_GPIO_PIN_UART_TX          1
-#define U300_GPIO_PIN_UART_CTS         2
-#define U300_GPIO_PIN_UART_RTS         3
-#define U300_GPIO_PIN_CAM_MAIN_STANDBY 4 /* Camera MAIN standby */
-#define U300_GPIO_PIN_GPIO05           5 /* Unrouted */
-#define U300_GPIO_PIN_MS_CD            6 /* Memory Stick Card insertion */
-#define U300_GPIO_PIN_GPIO07           7 /* Test point TP2430 */
-
-#define U300_GPIO_PIN_GPIO08           8 /* Test point TP2437 */
-#define U300_GPIO_PIN_GPIO09           9 /* Test point TP2431 */
-#define U300_GPIO_PIN_GPIO10           10 /* Test point TP2432 */
-#define U300_GPIO_PIN_MMC_CLKRET       11 /* Clock return from MMC/SD card */
-#define U300_GPIO_PIN_MMC_CD           12 /* MMC Card insertion detection */
-#define U300_GPIO_PIN_CAM_SUB_STANDBY  13 /* Camera SUB standby */
-#define U300_GPIO_PIN_GPIO14           14 /* Test point TP2436 */
-#define U300_GPIO_PIN_GPIO15           15 /* Unrouted */
-
-#define U300_GPIO_PIN_GPIO16           16 /* Test point TP2438 */
-#define U300_GPIO_PIN_PHFSENSE         17 /* Headphone jack sensing */
-#define U300_GPIO_PIN_GPIO18           18 /* Test point TP2439 */
-#define U300_GPIO_PIN_GPIO19           19 /* Routed somewhere */
-#define U300_GPIO_PIN_GPIO20           20 /* Unrouted */
-#define U300_GPIO_PIN_GPIO21           21 /* Unrouted */
-#define U300_GPIO_PIN_GPIO22           22 /* Unrouted */
-#define U300_GPIO_PIN_GPIO23           23 /* Unrouted */
-
-#define U300_GPIO_PIN_GPIO24           24 /* Unrouted */
-#define U300_GPIO_PIN_GPIO25           25 /* Unrouted */
-#define U300_GPIO_PIN_GPIO26           26 /* Unrouted */
-#define U300_GPIO_PIN_GPIO27           27 /* Unrouted */
-#define U300_GPIO_PIN_GPIO28           28 /* Unrouted */
-#define U300_GPIO_PIN_GPIO29           29 /* Unrouted */
-#define U300_GPIO_PIN_GPIO30           30 /* Unrouted */
-#define U300_GPIO_PIN_GPIO31           31 /* Unrouted */
-
-#define U300_GPIO_PIN_GPIO32           32 /* Unrouted */
-#define U300_GPIO_PIN_GPIO33           33 /* Unrouted */
-#define U300_GPIO_PIN_GPIO34           34 /* Unrouted */
-#define U300_GPIO_PIN_GPIO35           35 /* Unrouted */
-#define U300_GPIO_PIN_GPIO36           36 /* Unrouted */
-#define U300_GPIO_PIN_GPIO37           37 /* Unrouted */
-#define U300_GPIO_PIN_GPIO38           38 /* Unrouted */
-#define U300_GPIO_PIN_GPIO39           39 /* Unrouted */
-
-#ifdef CONFIG_MACH_U300_BS335
-
-#define U300_GPIO_PIN_GPIO40           40 /* Unrouted */
-#define U300_GPIO_PIN_GPIO41           41 /* Unrouted */
-#define U300_GPIO_PIN_GPIO42           42 /* Unrouted */
-#define U300_GPIO_PIN_GPIO43           43 /* Unrouted */
-#define U300_GPIO_PIN_GPIO44           44 /* Unrouted */
-#define U300_GPIO_PIN_GPIO45           45 /* Unrouted */
-#define U300_GPIO_PIN_GPIO46           46 /* Unrouted */
-#define U300_GPIO_PIN_GPIO47           47 /* Unrouted */
-
-#define U300_GPIO_PIN_GPIO48           48 /* Unrouted */
-#define U300_GPIO_PIN_GPIO49           49 /* Unrouted */
-#define U300_GPIO_PIN_GPIO50           50 /* Unrouted */
-#define U300_GPIO_PIN_GPIO51           51 /* Unrouted */
-#define U300_GPIO_PIN_GPIO52           52 /* Unrouted */
-#define U300_GPIO_PIN_GPIO53           53 /* Unrouted */
-#define U300_GPIO_PIN_GPIO54           54 /* Unrouted */
-#define U300_GPIO_PIN_GPIO55           55 /* Unrouted */
-#endif
-
-#endif
-
-/* translates a pin number to a port number */
-#define PIN_TO_PORT(val) (val >> 3)
-
-/* These can be found in arch/arm/mach-u300/gpio.c */
-extern int gpio_is_valid(int number);
-extern int gpio_request(unsigned gpio, const char *label);
-extern void gpio_free(unsigned gpio);
-extern int gpio_direction_input(unsigned gpio);
-extern int gpio_direction_output(unsigned gpio, int value);
-extern int gpio_register_callback(unsigned gpio,
-                                 int (*func)(void *arg),
-                                 void *);
-extern int gpio_unregister_callback(unsigned gpio);
-extern void enable_irq_on_gpio_pin(unsigned gpio, int edge);
-extern void disable_irq_on_gpio_pin(unsigned gpio);
-extern void gpio_pullup(unsigned gpio, int value);
-extern int gpio_get_value(unsigned gpio);
-extern void gpio_set_value(unsigned gpio, int value);
-
-#define gpio_get_value_cansleep gpio_get_value
-#define gpio_set_value_cansleep gpio_set_value
-
-/* wrappers to sleep-enable the previous two functions */
-static inline unsigned gpio_to_irq(unsigned gpio)
-{
-       return PIN_TO_PORT(gpio) + IRQ_U300_GPIO_PORT0;
-}
-
-static inline unsigned irq_to_gpio(unsigned irq)
-{
-       /*
-        * FIXME: This is no 1-1 mapping at all, it points to the
-        * whole block of 8 pins.
-        */
-       return (irq - IRQ_U300_GPIO_PORT0) << 3;
-}
-
-#endif
index 09b1b28fa8fd948f611d8dbede95877233ec2045..d270fea32926dcf7687013f4cb0fbe0bb4c70694 100644 (file)
@@ -72,7 +72,7 @@
 
 /* DB3150 and DB3200 have only 45 IRQs */
 #if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
-#define U300_NR_IRQS                   45
+#define U300_VIC_IRQS_END              45
 #endif
 
 /* The DB3350-specific interrupt lines */
@@ -88,7 +88,7 @@
 #define IRQ_U300_GPIO_PORT4            53
 #define IRQ_U300_GPIO_PORT5            54
 #define IRQ_U300_GPIO_PORT6            55
-#define U300_NR_IRQS                   56
+#define U300_VIC_IRQS_END              56
 #endif
 
 /* The DB3210-specific interrupt lines */
 #define IRQ_U300_NFIF                  45
 #define IRQ_U300_NFIF2                 46
 #define IRQ_U300_SYSCON_PLL_LOCK       47
-#define U300_NR_IRQS                   48
+#define U300_VIC_IRQS_END              48
 #endif
 
-#ifdef CONFIG_AB3550_CORE
-#define IRQ_AB3550_BASE                        (U300_NR_IRQS)
-#define IRQ_AB3550_END                 (IRQ_AB3550_BASE + 37)
+/* Maximum 8*7 GPIO lines */
+#ifdef CONFIG_GPIO_U300
+#define IRQ_U300_GPIO_BASE             (U300_VIC_IRQS_END)
+#define IRQ_U300_GPIO_END              (IRQ_U300_GPIO_BASE + 56)
+#else
+#define IRQ_U300_GPIO_END              (U300_VIC_IRQS_END)
+#endif
 
-#define NR_IRQS                                (IRQ_AB3550_END + 1)
+/* Optional AB3550 mixsig chip */
+#ifdef CONFIG_AB3550_CORE
+#define IRQ_AB3550_BASE                        (IRQ_U300_GPIO_END)
+#define IRQ_AB3550_END                 (IRQ_AB3550_BASE + 38)
 #else
-#define NR_IRQS U300_NR_IRQS
+#define IRQ_AB3550_END                 (IRQ_U300_GPIO_END)
 #endif
 
+#define NR_IRQS                                (IRQ_AB3550_END)
+
 #endif
index 677ccef5cd32eddbe1e309d0f169e70af547e041..d9a5c92db74a5cc0aa9a69276bdd17fc464628ff 100644 (file)
 #include <linux/device.h>
 #include <linux/amba/bus.h>
 #include <linux/mmc/host.h>
-#include <linux/gpio.h>
 #include <linux/dmaengine.h>
 #include <linux/amba/mmci.h>
 #include <linux/slab.h>
 #include <mach/coh901318.h>
 #include <mach/dma_channels.h>
+#include <mach/gpio-u300.h>
 
 #include "mmc.h"
 #include "padmux.h"
index 4210cb434dbc6be30badd18e0caf10144f9bfbbb..a3e0c8692f0d1ddabd689f35c86f6e358c5d49ba 100644 (file)
@@ -6,6 +6,7 @@ config UX500_SOC_COMMON
        select ARM_GIC
        select HAS_MTU
        select ARM_ERRATA_753970
+       select ARM_ERRATA_754322
 
 menu "Ux500 SoC"
 
index f26fd76f72b4f26301b2af1226664c4767ae6b86..15b23e4bd48888cd9e5a83b9a89b3de7394ca8be 100644 (file)
@@ -6,10 +6,10 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/gpio.h>
 
 #include <asm/mach-types.h>
 #include <plat/pincfg.h>
+#include <plat/gpio-nomadik.h>
 #include <mach/hardware.h>
 
 #include "pins-db8500.h"
index 8ce46c0fdfd5fc706afa8f710de8cd7f5fe3d463..feb5744d98b7d7658f3d58290b0b1c76ded8f295 100644 (file)
@@ -4,7 +4,7 @@
  * Board data for the U8500 UIB, also known as the New UIB
  * License terms: GNU General Public License (GPL), version 2
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/i2c.h>
@@ -13,7 +13,6 @@
 #include <linux/mfd/tc3589x.h>
 #include <linux/input/matrix_keypad.h>
 
-#include <mach/gpio.h>
 #include <mach/irqs.h>
 
 #include "board-mop500.h"
index 2cc4876db212fabb115f2f409fa1565794e741ca..f67b83dd9010704e52f99851780f64f0afd947d7 100644 (file)
@@ -37,6 +37,7 @@
 #include <plat/i2c.h>
 #include <plat/ste_dma40.h>
 #include <plat/pincfg.h>
+#include <plat/gpio-nomadik.h>
 
 #include <mach/hardware.h>
 #include <mach/setup.h>
index 739fb4c5b1605e2ee19dab40501cb788a9de712f..63c3f8058ffcb370821f3d79a2f94dd7d0e44b88 100644 (file)
@@ -7,9 +7,9 @@
 
 #include <linux/amba/mmci.h>
 #include <linux/mmc/host.h>
-#include <linux/gpio.h>
 
 #include <plat/pincfg.h>
+#include <plat/gpio-nomadik.h>
 #include <mach/db5500-regs.h>
 #include <plat/ste_dma40.h>
 
index 166d47a5f4f3925e005b409ed210113e370f6b37..e014aa749b039e6ef7da7f9d34e7c7f6ea65c9b8 100644 (file)
@@ -8,7 +8,6 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/amba/bus.h>
-#include <linux/gpio.h>
 #include <linux/irq.h>
 #include <linux/i2c.h>
 
@@ -17,6 +16,7 @@
 
 #include <plat/pincfg.h>
 #include <plat/i2c.h>
+#include <plat/gpio-nomadik.h>
 
 #include <mach/hardware.h>
 #include <mach/devices.h>
index 22705d246fc7ee8262858f46e521a1bd86276f27..9de1af0080944cdcd57c3da3dd48634da24fd279 100644 (file)
@@ -13,7 +13,7 @@
 #include <asm/mach/map.h>
 #include <asm/pmu.h>
 
-#include <plat/gpio.h>
+#include <plat/gpio-nomadik.h>
 
 #include <mach/hardware.h>
 #include <mach/devices.h>
index 4598b06c8c554383a711b205f103ebfae29b87e7..13e8890a8b8aae91361998a8ac7c330fd7d9727c 100644 (file)
 #include <linux/amba/bus.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
-#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
 
 #include <asm/mach/map.h>
 #include <asm/pmu.h>
+#include <plat/gpio-nomadik.h>
 #include <mach/hardware.h>
 #include <mach/setup.h>
 #include <mach/devices.h>
index 13a4ce046ae55926961a22c08ba4820df5a54299..c563e5418d80b5af3e99e2a76f776e44c9b94e0a 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/platform_device.h>
 #include <linux/amba/bus.h>
 
-#include <plat/gpio.h>
+#include <plat/gpio-nomadik.h>
 
 #include <mach/hardware.h>
 
index 3c4cd31ad9f734a8b463ad4f2b24b50ef1c3836b..7389df911b1ac8639e6e1dc3c5975d9ed5c112dc 100644 (file)
@@ -7,6 +7,4 @@
  */
 #define ARCH_NR_GPIOS  350
 
-#include <plat/gpio.h>
-
 #endif /* __ASM_ARCH_GPIO_H */
index 94ff27678a46ff9492f9e3e172e75e818049bdb2..40a8c178f10d9e85a2873c83247c3f2fe553f408 100644 (file)
@@ -1,6 +1 @@
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
+/* empty */
index 748bb524ee716ed2e5f0ba5b7105b5e1ab6b25d5..13522d86685e2daa5f77bbe2d37c12d30e8e0ddc 100644 (file)
@@ -20,8 +20,6 @@
 #ifndef __ASM_ARM_ARCH_IO_H
 #define __ASM_ARM_ARCH_IO_H
 
-#define IO_SPACE_LIMIT 0xffffffff
-
 #define __io(a)                __typesafe_io(a)
 #define __mem_pci(a)   (a)
 
index 94ff27678a46ff9492f9e3e172e75e818049bdb2..40a8c178f10d9e85a2873c83247c3f2fe553f408 100644 (file)
@@ -1,6 +1 @@
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
+/* empty */
index 9077239f78c90f6b939f0301d902bdcfa059aea3..46181eecf273978b22a883c44af363585f5ea7ca 100644 (file)
@@ -20,8 +20,6 @@
 #ifndef __ASM_ARM_ARCH_IO_H
 #define __ASM_ARM_ARCH_IO_H
 
-#define IO_SPACE_LIMIT 0xffff
-
 #define __io(a)                __typesafe_io((a) + 0xf0000000)
 #define __mem_pci(a)   (a)
 
index 034da3e390c9b60e82a23ec18c7e778fcb611717..5385a42032779094043069f005b3e0a9cb8435b2 100644 (file)
 
 #include <mach/hardware.h>
 #include <asm/irq.h>
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
 
 static inline int gpio_to_irq(unsigned gpio)
 {
        return gpio;
 }
+#define gpio_to_irq gpio_to_irq
 
 static inline int irq_to_gpio(unsigned irq)
 {
index 9ab5be07061a21dd6f67d7f476c3cec2c314774a..67f75a0b66d640c4ffdd44b74fc2ac37e8b0063d 100644 (file)
@@ -822,7 +822,7 @@ config CACHE_L2X0
                   REALVIEW_EB_A9MP || ARCH_IMX_V6_V7 || MACH_REALVIEW_PBX || \
                   ARCH_NOMADIK || ARCH_OMAP4 || ARCH_EXYNOS4 || ARCH_TEGRA || \
                   ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || ARCH_SHMOBILE || \
-                  ARCH_PRIMA2 || ARCH_ZYNQ || ARCH_CNS3XXX
+                  ARCH_PRIMA2 || ARCH_ZYNQ || ARCH_CNS3XXX || ARCH_HIGHBANK
        default y
        select OUTER_CACHE
        select OUTER_CACHE_SYNC
index 9ecfdb5119513b632154f9812b4cd490de24efc5..3f9b9980478e523550e0929e6f16fb9269d552bd 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
+#include <linux/err.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
 #include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
 
 #include <asm/cacheflush.h>
 #include <asm/hardware/cache-l2x0.h>
@@ -30,11 +33,19 @@ static DEFINE_SPINLOCK(l2x0_lock);
 static uint32_t l2x0_way_mask; /* Bitmask of active ways */
 static uint32_t l2x0_size;
 
+struct l2x0_regs l2x0_saved_regs;
+
+struct l2x0_of_data {
+       void (*setup)(const struct device_node *, __u32 *, __u32 *);
+       void (*save)(void);
+       void (*resume)(void);
+};
+
 static inline void cache_wait_way(void __iomem *reg, unsigned long mask)
 {
        /* wait for cache operation by line or way to complete */
        while (readl_relaxed(reg) & mask)
-               ;
+               cpu_relax();
 }
 
 #ifdef CONFIG_CACHE_PL310
@@ -277,7 +288,7 @@ static void l2x0_disable(void)
        spin_unlock_irqrestore(&l2x0_lock, flags);
 }
 
-static void __init l2x0_unlock(__u32 cache_id)
+static void l2x0_unlock(__u32 cache_id)
 {
        int lockregs;
        int i;
@@ -353,6 +364,8 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
                /* l2x0 controller is disabled */
                writel_relaxed(aux, l2x0_base + L2X0_AUX_CTRL);
 
+               l2x0_saved_regs.aux_ctrl = aux;
+
                l2x0_inv_all();
 
                /* enable L2X0 */
@@ -372,3 +385,202 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
        printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n",
                        ways, cache_id, aux, l2x0_size);
 }
+
+#ifdef CONFIG_OF
+static void __init l2x0_of_setup(const struct device_node *np,
+                                __u32 *aux_val, __u32 *aux_mask)
+{
+       u32 data[2] = { 0, 0 };
+       u32 tag = 0;
+       u32 dirty = 0;
+       u32 val = 0, mask = 0;
+
+       of_property_read_u32(np, "arm,tag-latency", &tag);
+       if (tag) {
+               mask |= L2X0_AUX_CTRL_TAG_LATENCY_MASK;
+               val |= (tag - 1) << L2X0_AUX_CTRL_TAG_LATENCY_SHIFT;
+       }
+
+       of_property_read_u32_array(np, "arm,data-latency",
+                                  data, ARRAY_SIZE(data));
+       if (data[0] && data[1]) {
+               mask |= L2X0_AUX_CTRL_DATA_RD_LATENCY_MASK |
+                       L2X0_AUX_CTRL_DATA_WR_LATENCY_MASK;
+               val |= ((data[0] - 1) << L2X0_AUX_CTRL_DATA_RD_LATENCY_SHIFT) |
+                      ((data[1] - 1) << L2X0_AUX_CTRL_DATA_WR_LATENCY_SHIFT);
+       }
+
+       of_property_read_u32(np, "arm,dirty-latency", &dirty);
+       if (dirty) {
+               mask |= L2X0_AUX_CTRL_DIRTY_LATENCY_MASK;
+               val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT;
+       }
+
+       *aux_val &= ~mask;
+       *aux_val |= val;
+       *aux_mask &= ~mask;
+}
+
+static void __init pl310_of_setup(const struct device_node *np,
+                                 __u32 *aux_val, __u32 *aux_mask)
+{
+       u32 data[3] = { 0, 0, 0 };
+       u32 tag[3] = { 0, 0, 0 };
+       u32 filter[2] = { 0, 0 };
+
+       of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag));
+       if (tag[0] && tag[1] && tag[2])
+               writel_relaxed(
+                       ((tag[0] - 1) << L2X0_LATENCY_CTRL_RD_SHIFT) |
+                       ((tag[1] - 1) << L2X0_LATENCY_CTRL_WR_SHIFT) |
+                       ((tag[2] - 1) << L2X0_LATENCY_CTRL_SETUP_SHIFT),
+                       l2x0_base + L2X0_TAG_LATENCY_CTRL);
+
+       of_property_read_u32_array(np, "arm,data-latency",
+                                  data, ARRAY_SIZE(data));
+       if (data[0] && data[1] && data[2])
+               writel_relaxed(
+                       ((data[0] - 1) << L2X0_LATENCY_CTRL_RD_SHIFT) |
+                       ((data[1] - 1) << L2X0_LATENCY_CTRL_WR_SHIFT) |
+                       ((data[2] - 1) << L2X0_LATENCY_CTRL_SETUP_SHIFT),
+                       l2x0_base + L2X0_DATA_LATENCY_CTRL);
+
+       of_property_read_u32_array(np, "arm,filter-ranges",
+                                  filter, ARRAY_SIZE(filter));
+       if (filter[1]) {
+               writel_relaxed(ALIGN(filter[0] + filter[1], SZ_1M),
+                              l2x0_base + L2X0_ADDR_FILTER_END);
+               writel_relaxed((filter[0] & ~(SZ_1M - 1)) | L2X0_ADDR_FILTER_EN,
+                              l2x0_base + L2X0_ADDR_FILTER_START);
+       }
+}
+
+static void __init pl310_save(void)
+{
+       u32 l2x0_revision = readl_relaxed(l2x0_base + L2X0_CACHE_ID) &
+               L2X0_CACHE_ID_RTL_MASK;
+
+       l2x0_saved_regs.tag_latency = readl_relaxed(l2x0_base +
+               L2X0_TAG_LATENCY_CTRL);
+       l2x0_saved_regs.data_latency = readl_relaxed(l2x0_base +
+               L2X0_DATA_LATENCY_CTRL);
+       l2x0_saved_regs.filter_end = readl_relaxed(l2x0_base +
+               L2X0_ADDR_FILTER_END);
+       l2x0_saved_regs.filter_start = readl_relaxed(l2x0_base +
+               L2X0_ADDR_FILTER_START);
+
+       if (l2x0_revision >= L2X0_CACHE_ID_RTL_R2P0) {
+               /*
+                * From r2p0, there is Prefetch offset/control register
+                */
+               l2x0_saved_regs.prefetch_ctrl = readl_relaxed(l2x0_base +
+                       L2X0_PREFETCH_CTRL);
+               /*
+                * From r3p0, there is Power control register
+                */
+               if (l2x0_revision >= L2X0_CACHE_ID_RTL_R3P0)
+                       l2x0_saved_regs.pwr_ctrl = readl_relaxed(l2x0_base +
+                               L2X0_POWER_CTRL);
+       }
+}
+
+static void l2x0_resume(void)
+{
+       if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) {
+               /* restore aux ctrl and enable l2 */
+               l2x0_unlock(readl_relaxed(l2x0_base + L2X0_CACHE_ID));
+
+               writel_relaxed(l2x0_saved_regs.aux_ctrl, l2x0_base +
+                       L2X0_AUX_CTRL);
+
+               l2x0_inv_all();
+
+               writel_relaxed(1, l2x0_base + L2X0_CTRL);
+       }
+}
+
+static void pl310_resume(void)
+{
+       u32 l2x0_revision;
+
+       if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) {
+               /* restore pl310 setup */
+               writel_relaxed(l2x0_saved_regs.tag_latency,
+                       l2x0_base + L2X0_TAG_LATENCY_CTRL);
+               writel_relaxed(l2x0_saved_regs.data_latency,
+                       l2x0_base + L2X0_DATA_LATENCY_CTRL);
+               writel_relaxed(l2x0_saved_regs.filter_end,
+                       l2x0_base + L2X0_ADDR_FILTER_END);
+               writel_relaxed(l2x0_saved_regs.filter_start,
+                       l2x0_base + L2X0_ADDR_FILTER_START);
+
+               l2x0_revision = readl_relaxed(l2x0_base + L2X0_CACHE_ID) &
+                       L2X0_CACHE_ID_RTL_MASK;
+
+               if (l2x0_revision >= L2X0_CACHE_ID_RTL_R2P0) {
+                       writel_relaxed(l2x0_saved_regs.prefetch_ctrl,
+                               l2x0_base + L2X0_PREFETCH_CTRL);
+                       if (l2x0_revision >= L2X0_CACHE_ID_RTL_R3P0)
+                               writel_relaxed(l2x0_saved_regs.pwr_ctrl,
+                                       l2x0_base + L2X0_POWER_CTRL);
+               }
+       }
+
+       l2x0_resume();
+}
+
+static const struct l2x0_of_data pl310_data = {
+       pl310_of_setup,
+       pl310_save,
+       pl310_resume,
+};
+
+static const struct l2x0_of_data l2x0_data = {
+       l2x0_of_setup,
+       NULL,
+       l2x0_resume,
+};
+
+static const struct of_device_id l2x0_ids[] __initconst = {
+       { .compatible = "arm,pl310-cache", .data = (void *)&pl310_data },
+       { .compatible = "arm,l220-cache", .data = (void *)&l2x0_data },
+       { .compatible = "arm,l210-cache", .data = (void *)&l2x0_data },
+       {}
+};
+
+int __init l2x0_of_init(__u32 aux_val, __u32 aux_mask)
+{
+       struct device_node *np;
+       struct l2x0_of_data *data;
+       struct resource res;
+
+       np = of_find_matching_node(NULL, l2x0_ids);
+       if (!np)
+               return -ENODEV;
+
+       if (of_address_to_resource(np, 0, &res))
+               return -ENODEV;
+
+       l2x0_base = ioremap(res.start, resource_size(&res));
+       if (!l2x0_base)
+               return -ENOMEM;
+
+       l2x0_saved_regs.phy_base = res.start;
+
+       data = of_match_node(l2x0_ids, np)->data;
+
+       /* L2 configuration can only be changed if the cache is disabled */
+       if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) {
+               if (data->setup)
+                       data->setup(np, &aux_val, &aux_mask);
+       }
+
+       if (data->save)
+               data->save();
+
+       l2x0_init(l2x0_base, aux_val, aux_mask);
+
+       outer_cache.resume = data->resume;
+       return 0;
+}
+#endif
index 34409a08ba0d51d4c08e697db390248492a60fd9..04e9a92bb47ad602b866b35f77d90ae65493638d 100644 (file)
@@ -496,6 +496,13 @@ static void __init free_unused_memmap(struct meminfo *mi)
                 */
                bank_start = min(bank_start,
                                 ALIGN(prev_bank_end, PAGES_PER_SECTION));
+#else
+               /*
+                * Align down here since the VM subsystem insists that the
+                * memmap entries are valid from the bank start aligned to
+                * MAX_ORDER_NR_PAGES.
+                */
+               bank_start = round_down(bank_start, MAX_ORDER_NR_PAGES);
 #endif
                /*
                 * If we had a previous bank, and there is a space
index 6a7d993a17a695075862f50ccf9b81179d943173..83b745a5e1b724e92ee87be633dc15b00edab968 100644 (file)
@@ -65,6 +65,8 @@ 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 mx51_clocks_init_dt(void);
+extern int mx53_clocks_init_dt(void);
 extern int mx6q_clocks_init(void);
 extern struct platform_device *mxc_register_gpio(char *name, int id,
        resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
@@ -124,6 +126,11 @@ extern void imx_src_init(void);
 extern void imx_gpc_init(void);
 extern void imx_gpc_pre_suspend(void);
 extern void imx_gpc_post_resume(void);
+extern void imx51_babbage_common_init(void);
+extern void imx53_ard_common_init(void);
+extern void imx53_evk_common_init(void);
+extern void imx53_qsb_common_init(void);
+extern void imx53_smd_common_init(void);
 extern int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode);
 extern void imx6q_pm_init(void);
 #endif
index 44af0064ba1a96485d30bece8ee4d3a3183e0369..40a8c178f10d9e85a2873c83247c3f2fe553f408 100644 (file)
@@ -1,32 +1 @@
-/*
- * Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
- * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-#ifndef __ASM_ARCH_MXC_GPIO_H__
-#define __ASM_ARCH_MXC_GPIO_H__
-
-#include <linux/spinlock.h>
-#include <mach/hardware.h>
-#include <asm-generic/gpio.h>
-
-/* use gpiolib dispatchers */
-#define gpio_get_value         __gpio_get_value
-#define gpio_set_value         __gpio_set_value
-#define gpio_cansleep          __gpio_cansleep
-#define gpio_to_irq            __gpio_to_irq
-
-#endif
+/* empty */
similarity index 82%
rename from arch/arm/plat-nomadik/include/plat/gpio.h
rename to arch/arm/plat-nomadik/include/plat/gpio-nomadik.h
index d5d7e651269c3b434c5f500c5a491b9f7e3437c1..3ba4d8f8073baf10279e3c69122c822c87d8bb1c 100644 (file)
@@ -9,20 +9,9 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#ifndef __ASM_PLAT_GPIO_H
-#define __ASM_PLAT_GPIO_H
 
-#include <asm-generic/gpio.h>
-
-/*
- * These currently cause a function call to happen, they may be optimized
- * if needed by adding cpu-specific defines to identify blocks
- * (see mach-pxa/include/mach/gpio.h as an example using GPLR etc)
- */
-#define gpio_get_value  __gpio_get_value
-#define gpio_set_value  __gpio_set_value
-#define gpio_cansleep   __gpio_cansleep
-#define gpio_to_irq     __gpio_to_irq
+#ifndef __PLAT_NOMADIK_GPIO
+#define __PLAT_NOMADIK_GPIO
 
 /*
  * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving
@@ -93,4 +82,4 @@ struct nmk_gpio_platform_data {
        bool supports_sleepmode;
 };
 
-#endif /* __ASM_PLAT_GPIO_H */
+#endif /* __PLAT_NOMADIK_GPIO */
index 923c9621096b85f63e6e8c6ba2fa9909b3c06311..caa1f7b6cc2145995bedeaa321a77078869c3bf7 100644 (file)
@@ -8,7 +8,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -18,7 +18,6 @@
 #include <mach/hardware.h>
 
 #include <plat/board.h>
-#include <mach/gpio.h>
 
 
 /* Many OMAP development platforms reuse the same "debug board"; these
index fc05b10226026e6b514adaa10199bf270cbba7f2..61a1ec2a6af4273e1c7693fdd4191ba3c92a0616 100644 (file)
@@ -7,7 +7,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/leds.h>
@@ -19,7 +19,6 @@
 #include <asm/mach-types.h>
 
 #include <plat/fpga.h>
-#include <mach/gpio.h>
 
 
 /* Many OMAP development platforms reuse the same "debug board"; these
index ea28f98d5d6a63da2ab5ede0327ec9188f5caf97..acd132c296473b839964e2211a50f368baabd39d 100644 (file)
@@ -8,7 +8,7 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  */
-
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <plat/tc.h>
 #include <plat/board.h>
 #include <plat/mmc.h>
-#include <mach/gpio.h>
 #include <plat/menelaus.h>
-#include <plat/mcbsp.h>
 #include <plat/omap44xx.h>
 
-/*-------------------------------------------------------------------------*/
-
-#if defined(CONFIG_OMAP_MCBSP) || defined(CONFIG_OMAP_MCBSP_MODULE)
-
-static struct platform_device **omap_mcbsp_devices;
-
-void omap_mcbsp_register_board_cfg(struct resource *res, int res_count,
-                       struct omap_mcbsp_platform_data *config, int size)
-{
-       int i;
-
-       omap_mcbsp_devices = kzalloc(size * sizeof(struct platform_device *),
-                                    GFP_KERNEL);
-       if (!omap_mcbsp_devices) {
-               printk(KERN_ERR "Could not register McBSP devices\n");
-               return;
-       }
-
-       for (i = 0; i < size; i++) {
-               struct platform_device *new_mcbsp;
-               int ret;
-
-               new_mcbsp = platform_device_alloc("omap-mcbsp", i + 1);
-               if (!new_mcbsp)
-                       continue;
-               platform_device_add_resources(new_mcbsp, &res[i * res_count],
-                                       res_count);
-               new_mcbsp->dev.platform_data = &config[i];
-               ret = platform_device_add(new_mcbsp);
-               if (ret) {
-                       platform_device_put(new_mcbsp);
-                       continue;
-               }
-               omap_mcbsp_devices[i] = new_mcbsp;
-       }
-}
-
-#else
-void omap_mcbsp_register_board_cfg(struct resource *res, int res_count,
-                       struct omap_mcbsp_platform_data *config, int size)
-{  }
-#endif
-
-/*-------------------------------------------------------------------------*/
-
 #if defined(CONFIG_SND_OMAP_SOC_MCPDM) || \
                defined(CONFIG_SND_OMAP_SOC_MCPDM_MODULE)
 
index 75a847dd776a3d24ccca85c29aab32b90bbbe3e7..de7896fd9b33e541af74537b2d5a6a8d4868bf52 100644 (file)
@@ -3,6 +3,12 @@
  *
  * OMAP Dual-Mode Timers
  *
+ * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Tarun Kanti DebBarma <tarun.kanti@ti.com>
+ * Thara Gopinath <thara@ti.com>
+ *
+ * dmtimer adaptation to platform_driver.
+ *
  * Copyright (C) 2005 Nokia Corporation
  * OMAP2 support by Juha Yrjola
  * API improvements and OMAP2 clock framework support by Timo Teras
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <linux/init.h>
-#include <linux/spinlock.h>
-#include <linux/errno.h>
-#include <linux/list.h>
-#include <linux/clk.h>
-#include <linux/delay.h>
 #include <linux/io.h>
-#include <linux/module.h>
-#include <mach/hardware.h>
-#include <plat/dmtimer.h>
-#include <mach/irqs.h>
-
-static int dm_timer_count;
-
-#ifdef CONFIG_ARCH_OMAP1
-static struct omap_dm_timer omap1_dm_timers[] = {
-       { .phys_base = 0xfffb1400, .irq = INT_1610_GPTIMER1 },
-       { .phys_base = 0xfffb1c00, .irq = INT_1610_GPTIMER2 },
-       { .phys_base = 0xfffb2400, .irq = INT_1610_GPTIMER3 },
-       { .phys_base = 0xfffb2c00, .irq = INT_1610_GPTIMER4 },
-       { .phys_base = 0xfffb3400, .irq = INT_1610_GPTIMER5 },
-       { .phys_base = 0xfffb3c00, .irq = INT_1610_GPTIMER6 },
-       { .phys_base = 0xfffb7400, .irq = INT_1610_GPTIMER7 },
-       { .phys_base = 0xfffbd400, .irq = INT_1610_GPTIMER8 },
-};
-
-static const int omap1_dm_timer_count = ARRAY_SIZE(omap1_dm_timers);
-
-#else
-#define omap1_dm_timers                        NULL
-#define omap1_dm_timer_count           0
-#endif /* CONFIG_ARCH_OMAP1 */
-
-#ifdef CONFIG_ARCH_OMAP2
-static struct omap_dm_timer omap2_dm_timers[] = {
-       { .phys_base = 0x48028000, .irq = INT_24XX_GPTIMER1 },
-       { .phys_base = 0x4802a000, .irq = INT_24XX_GPTIMER2 },
-       { .phys_base = 0x48078000, .irq = INT_24XX_GPTIMER3 },
-       { .phys_base = 0x4807a000, .irq = INT_24XX_GPTIMER4 },
-       { .phys_base = 0x4807c000, .irq = INT_24XX_GPTIMER5 },
-       { .phys_base = 0x4807e000, .irq = INT_24XX_GPTIMER6 },
-       { .phys_base = 0x48080000, .irq = INT_24XX_GPTIMER7 },
-       { .phys_base = 0x48082000, .irq = INT_24XX_GPTIMER8 },
-       { .phys_base = 0x48084000, .irq = INT_24XX_GPTIMER9 },
-       { .phys_base = 0x48086000, .irq = INT_24XX_GPTIMER10 },
-       { .phys_base = 0x48088000, .irq = INT_24XX_GPTIMER11 },
-       { .phys_base = 0x4808a000, .irq = INT_24XX_GPTIMER12 },
-};
-
-static const char *omap2_dm_source_names[] __initdata = {
-       "sys_ck",
-       "func_32k_ck",
-       "alt_ck",
-       NULL
-};
-
-static struct clk *omap2_dm_source_clocks[3];
-static const int omap2_dm_timer_count = ARRAY_SIZE(omap2_dm_timers);
-
-#else
-#define omap2_dm_timers                        NULL
-#define omap2_dm_timer_count           0
-#define omap2_dm_source_names          NULL
-#define omap2_dm_source_clocks         NULL
-#endif /* CONFIG_ARCH_OMAP2 */
-
-#ifdef CONFIG_ARCH_OMAP3
-static struct omap_dm_timer omap3_dm_timers[] = {
-       { .phys_base = 0x48318000, .irq = INT_24XX_GPTIMER1 },
-       { .phys_base = 0x49032000, .irq = INT_24XX_GPTIMER2 },
-       { .phys_base = 0x49034000, .irq = INT_24XX_GPTIMER3 },
-       { .phys_base = 0x49036000, .irq = INT_24XX_GPTIMER4 },
-       { .phys_base = 0x49038000, .irq = INT_24XX_GPTIMER5 },
-       { .phys_base = 0x4903A000, .irq = INT_24XX_GPTIMER6 },
-       { .phys_base = 0x4903C000, .irq = INT_24XX_GPTIMER7 },
-       { .phys_base = 0x4903E000, .irq = INT_24XX_GPTIMER8 },
-       { .phys_base = 0x49040000, .irq = INT_24XX_GPTIMER9 },
-       { .phys_base = 0x48086000, .irq = INT_24XX_GPTIMER10 },
-       { .phys_base = 0x48088000, .irq = INT_24XX_GPTIMER11 },
-       { .phys_base = 0x48304000, .irq = INT_34XX_GPT12_IRQ },
-};
-
-static const char *omap3_dm_source_names[] __initdata = {
-       "sys_ck",
-       "omap_32k_fck",
-       NULL
-};
-
-static struct clk *omap3_dm_source_clocks[2];
-static const int omap3_dm_timer_count = ARRAY_SIZE(omap3_dm_timers);
+#include <linux/slab.h>
+#include <linux/err.h>
+#include <linux/pm_runtime.h>
 
-#else
-#define omap3_dm_timers                        NULL
-#define omap3_dm_timer_count           0
-#define omap3_dm_source_names          NULL
-#define omap3_dm_source_clocks         NULL
-#endif /* CONFIG_ARCH_OMAP3 */
-
-#ifdef CONFIG_ARCH_OMAP4
-static struct omap_dm_timer omap4_dm_timers[] = {
-       { .phys_base = 0x4a318000, .irq = OMAP44XX_IRQ_GPT1 },
-       { .phys_base = 0x48032000, .irq = OMAP44XX_IRQ_GPT2 },
-       { .phys_base = 0x48034000, .irq = OMAP44XX_IRQ_GPT3 },
-       { .phys_base = 0x48036000, .irq = OMAP44XX_IRQ_GPT4 },
-       { .phys_base = 0x40138000, .irq = OMAP44XX_IRQ_GPT5 },
-       { .phys_base = 0x4013a000, .irq = OMAP44XX_IRQ_GPT6 },
-       { .phys_base = 0x4013a000, .irq = OMAP44XX_IRQ_GPT7 },
-       { .phys_base = 0x4013e000, .irq = OMAP44XX_IRQ_GPT8 },
-       { .phys_base = 0x4803e000, .irq = OMAP44XX_IRQ_GPT9 },
-       { .phys_base = 0x48086000, .irq = OMAP44XX_IRQ_GPT10 },
-       { .phys_base = 0x48088000, .irq = OMAP44XX_IRQ_GPT11 },
-       { .phys_base = 0x4a320000, .irq = OMAP44XX_IRQ_GPT12 },
-};
-static const char *omap4_dm_source_names[] __initdata = {
-       "sys_clkin_ck",
-       "sys_32k_ck",
-       NULL
-};
-static struct clk *omap4_dm_source_clocks[2];
-static const int omap4_dm_timer_count = ARRAY_SIZE(omap4_dm_timers);
-
-#else
-#define omap4_dm_timers                        NULL
-#define omap4_dm_timer_count           0
-#define omap4_dm_source_names          NULL
-#define omap4_dm_source_clocks         NULL
-#endif /* CONFIG_ARCH_OMAP4 */
-
-static struct omap_dm_timer *dm_timers;
-static const char **dm_source_names;
-static struct clk **dm_source_clocks;
+#include <plat/dmtimer.h>
 
-static spinlock_t dm_timer_lock;
+static LIST_HEAD(omap_timer_list);
+static DEFINE_SPINLOCK(dm_timer_lock);
 
-/*
- * Reads timer registers in posted and non-posted mode. The posted mode bit
- * is encoded in reg. Note that in posted mode write pending bit must be
- * checked. Otherwise a read of a non completed write will produce an error.
+/**
+ * omap_dm_timer_read_reg - read timer registers in posted and non-posted mode
+ * @timer:      timer pointer over which read operation to perform
+ * @reg:        lowest byte holds the register offset
+ *
+ * The posted mode bit is encoded in reg. Note that in posted mode write
+ * pending bit must be checked. Otherwise a read of a non completed write
+ * will produce an error.
  */
 static inline u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, u32 reg)
 {
-       return __omap_dm_timer_read(timer->io_base, reg, timer->posted);
+       WARN_ON((reg & 0xff) < _OMAP_TIMER_WAKEUP_EN_OFFSET);
+       return __omap_dm_timer_read(timer, reg, timer->posted);
 }
 
-/*
- * Writes timer registers in posted and non-posted mode. The posted mode bit
- * is encoded in reg. Note that in posted mode the write pending bit must be
- * checked. Otherwise a write on a register which has a pending write will be
- * lost.
+/**
+ * omap_dm_timer_write_reg - write timer registers in posted and non-posted mode
+ * @timer:      timer pointer over which write operation is to perform
+ * @reg:        lowest byte holds the register offset
+ * @value:      data to write into the register
+ *
+ * The posted mode bit is encoded in reg. Note that in posted mode the write
+ * pending bit must be checked. Otherwise a write on a register which has a
+ * pending write will be lost.
  */
 static void omap_dm_timer_write_reg(struct omap_dm_timer *timer, u32 reg,
                                                u32 value)
 {
-       __omap_dm_timer_write(timer->io_base, reg, value, timer->posted);
+       WARN_ON((reg & 0xff) < _OMAP_TIMER_WAKEUP_EN_OFFSET);
+       __omap_dm_timer_write(timer, reg, value, timer->posted);
+}
+
+static void omap_timer_restore_context(struct omap_dm_timer *timer)
+{
+       omap_dm_timer_write_reg(timer, OMAP_TIMER_OCP_CFG_OFFSET,
+                               timer->context.tiocp_cfg);
+       if (timer->revision > 1)
+               __raw_writel(timer->context.tistat, timer->sys_stat);
+
+       __raw_writel(timer->context.tisr, timer->irq_stat);
+       omap_dm_timer_write_reg(timer, OMAP_TIMER_WAKEUP_EN_REG,
+                               timer->context.twer);
+       omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG,
+                               timer->context.tcrr);
+       omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG,
+                               timer->context.tldr);
+       omap_dm_timer_write_reg(timer, OMAP_TIMER_MATCH_REG,
+                               timer->context.tmar);
+       omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG,
+                               timer->context.tsicr);
+       __raw_writel(timer->context.tier, timer->irq_ena);
+       omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG,
+                               timer->context.tclr);
 }
 
 static void omap_dm_timer_wait_for_reset(struct omap_dm_timer *timer)
 {
        int c;
 
+       if (!timer->sys_stat)
+               return;
+
        c = 0;
-       while (!(omap_dm_timer_read_reg(timer, OMAP_TIMER_SYS_STAT_REG) & 1)) {
+       while (!(__raw_readl(timer->sys_stat) & 1)) {
                c++;
                if (c > 100000) {
                        printk(KERN_ERR "Timer failed to reset\n");
@@ -201,53 +119,65 @@ static void omap_dm_timer_wait_for_reset(struct omap_dm_timer *timer)
 
 static void omap_dm_timer_reset(struct omap_dm_timer *timer)
 {
-       int autoidle = 0, wakeup = 0;
-
-       if (!cpu_class_is_omap2() || timer != &dm_timers[0]) {
+       omap_dm_timer_enable(timer);
+       if (timer->pdev->id != 1) {
                omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG, 0x06);
                omap_dm_timer_wait_for_reset(timer);
        }
-       omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
-
-       /* Enable autoidle on OMAP2+ */
-       if (cpu_class_is_omap2())
-               autoidle = 1;
-
-       /*
-        * Enable wake-up on OMAP2 CPUs.
-        */
-       if (cpu_class_is_omap2())
-               wakeup = 1;
 
-       __omap_dm_timer_reset(timer->io_base, autoidle, wakeup);
+       __omap_dm_timer_reset(timer, 0, 0);
+       omap_dm_timer_disable(timer);
        timer->posted = 1;
 }
 
-void omap_dm_timer_prepare(struct omap_dm_timer *timer)
+int omap_dm_timer_prepare(struct omap_dm_timer *timer)
 {
-       omap_dm_timer_enable(timer);
-       omap_dm_timer_reset(timer);
+       struct dmtimer_platform_data *pdata = timer->pdev->dev.platform_data;
+       int ret;
+
+       timer->fclk = clk_get(&timer->pdev->dev, "fck");
+       if (WARN_ON_ONCE(IS_ERR_OR_NULL(timer->fclk))) {
+               timer->fclk = NULL;
+               dev_err(&timer->pdev->dev, ": No fclk handle.\n");
+               return -EINVAL;
+       }
+
+       if (pdata->needs_manual_reset)
+               omap_dm_timer_reset(timer);
+
+       ret = omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
+
+       timer->posted = 1;
+       return ret;
 }
 
 struct omap_dm_timer *omap_dm_timer_request(void)
 {
-       struct omap_dm_timer *timer = NULL;
+       struct omap_dm_timer *timer = NULL, *t;
        unsigned long flags;
-       int i;
+       int ret = 0;
 
        spin_lock_irqsave(&dm_timer_lock, flags);
-       for (i = 0; i < dm_timer_count; i++) {
-               if (dm_timers[i].reserved)
+       list_for_each_entry(t, &omap_timer_list, node) {
+               if (t->reserved)
                        continue;
 
-               timer = &dm_timers[i];
+               timer = t;
                timer->reserved = 1;
                break;
        }
+
+       if (timer) {
+               ret = omap_dm_timer_prepare(timer);
+               if (ret) {
+                       timer->reserved = 0;
+                       timer = NULL;
+               }
+       }
        spin_unlock_irqrestore(&dm_timer_lock, flags);
 
-       if (timer != NULL)
-               omap_dm_timer_prepare(timer);
+       if (!timer)
+               pr_debug("%s: timer request failed!\n", __func__);
 
        return timer;
 }
@@ -255,74 +185,65 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_request);
 
 struct omap_dm_timer *omap_dm_timer_request_specific(int id)
 {
-       struct omap_dm_timer *timer;
+       struct omap_dm_timer *timer = NULL, *t;
        unsigned long flags;
+       int ret = 0;
 
        spin_lock_irqsave(&dm_timer_lock, flags);
-       if (id <= 0 || id > dm_timer_count || dm_timers[id-1].reserved) {
-               spin_unlock_irqrestore(&dm_timer_lock, flags);
-               printk("BUG: warning at %s:%d/%s(): unable to get timer %d\n",
-                      __FILE__, __LINE__, __func__, id);
-               dump_stack();
-               return NULL;
+       list_for_each_entry(t, &omap_timer_list, node) {
+               if (t->pdev->id == id && !t->reserved) {
+                       timer = t;
+                       timer->reserved = 1;
+                       break;
+               }
        }
 
-       timer = &dm_timers[id-1];
-       timer->reserved = 1;
+       if (timer) {
+               ret = omap_dm_timer_prepare(timer);
+               if (ret) {
+                       timer->reserved = 0;
+                       timer = NULL;
+               }
+       }
        spin_unlock_irqrestore(&dm_timer_lock, flags);
 
-       omap_dm_timer_prepare(timer);
+       if (!timer)
+               pr_debug("%s: timer%d request failed!\n", __func__, id);
 
        return timer;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_request_specific);
 
-void omap_dm_timer_free(struct omap_dm_timer *timer)
+int omap_dm_timer_free(struct omap_dm_timer *timer)
 {
-       omap_dm_timer_enable(timer);
-       omap_dm_timer_reset(timer);
-       omap_dm_timer_disable(timer);
+       if (unlikely(!timer))
+               return -EINVAL;
+
+       clk_put(timer->fclk);
 
        WARN_ON(!timer->reserved);
        timer->reserved = 0;
+       return 0;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_free);
 
 void omap_dm_timer_enable(struct omap_dm_timer *timer)
 {
-       if (timer->enabled)
-               return;
-
-#ifdef CONFIG_ARCH_OMAP2PLUS
-       if (cpu_class_is_omap2()) {
-               clk_enable(timer->fclk);
-               clk_enable(timer->iclk);
-       }
-#endif
-
-       timer->enabled = 1;
+       pm_runtime_get_sync(&timer->pdev->dev);
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_enable);
 
 void omap_dm_timer_disable(struct omap_dm_timer *timer)
 {
-       if (!timer->enabled)
-               return;
-
-#ifdef CONFIG_ARCH_OMAP2PLUS
-       if (cpu_class_is_omap2()) {
-               clk_disable(timer->iclk);
-               clk_disable(timer->fclk);
-       }
-#endif
-
-       timer->enabled = 0;
+       pm_runtime_put(&timer->pdev->dev);
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_disable);
 
 int omap_dm_timer_get_irq(struct omap_dm_timer *timer)
 {
-       return timer->irq;
+       if (timer)
+               return timer->irq;
+       return -EINVAL;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_get_irq);
 
@@ -334,24 +255,29 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_get_irq);
  */
 __u32 omap_dm_timer_modify_idlect_mask(__u32 inputmask)
 {
-       int i;
+       int i = 0;
+       struct omap_dm_timer *timer = NULL;
+       unsigned long flags;
 
        /* If ARMXOR cannot be idled this function call is unnecessary */
        if (!(inputmask & (1 << 1)))
                return inputmask;
 
        /* If any active timer is using ARMXOR return modified mask */
-       for (i = 0; i < dm_timer_count; i++) {
+       spin_lock_irqsave(&dm_timer_lock, flags);
+       list_for_each_entry(timer, &omap_timer_list, node) {
                u32 l;
 
-               l = omap_dm_timer_read_reg(&dm_timers[i], OMAP_TIMER_CTRL_REG);
+               l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
                if (l & OMAP_TIMER_CTRL_ST) {
                        if (((omap_readl(MOD_CONF_CTRL_1) >> (i * 2)) & 0x03) == 0)
                                inputmask &= ~(1 << 1);
                        else
                                inputmask &= ~(1 << 2);
                }
+               i++;
        }
+       spin_unlock_irqrestore(&dm_timer_lock, flags);
 
        return inputmask;
 }
@@ -361,7 +287,9 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask);
 
 struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
 {
-       return timer->fclk;
+       if (timer)
+               return timer->fclk;
+       return NULL;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_get_fclk);
 
@@ -375,70 +303,91 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask);
 
 #endif
 
-void omap_dm_timer_trigger(struct omap_dm_timer *timer)
+int omap_dm_timer_trigger(struct omap_dm_timer *timer)
 {
+       if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
+               pr_err("%s: timer not available or enabled.\n", __func__);
+               return -EINVAL;
+       }
+
        omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0);
+       return 0;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_trigger);
 
-void omap_dm_timer_start(struct omap_dm_timer *timer)
+int omap_dm_timer_start(struct omap_dm_timer *timer)
 {
        u32 l;
 
+       if (unlikely(!timer))
+               return -EINVAL;
+
+       omap_dm_timer_enable(timer);
+
+       if (timer->loses_context) {
+               u32 ctx_loss_cnt_after =
+                       timer->get_context_loss_count(&timer->pdev->dev);
+               if (ctx_loss_cnt_after != timer->ctx_loss_count)
+                       omap_timer_restore_context(timer);
+       }
+
        l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
        if (!(l & OMAP_TIMER_CTRL_ST)) {
                l |= OMAP_TIMER_CTRL_ST;
                omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
        }
+
+       /* Save the context */
+       timer->context.tclr = l;
+       return 0;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_start);
 
-void omap_dm_timer_stop(struct omap_dm_timer *timer)
+int omap_dm_timer_stop(struct omap_dm_timer *timer)
 {
        unsigned long rate = 0;
+       struct dmtimer_platform_data *pdata = timer->pdev->dev.platform_data;
 
-#ifdef CONFIG_ARCH_OMAP2PLUS
-       rate = clk_get_rate(timer->fclk);
-#endif
+       if (unlikely(!timer))
+               return -EINVAL;
 
-       __omap_dm_timer_stop(timer->io_base, timer->posted, rate);
+       if (!pdata->needs_manual_reset)
+               rate = clk_get_rate(timer->fclk);
+
+       __omap_dm_timer_stop(timer, timer->posted, rate);
+
+       return 0;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_stop);
 
-#ifdef CONFIG_ARCH_OMAP1
-
 int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
 {
-       int n = (timer - dm_timers) << 1;
-       u32 l;
-
-       l = omap_readl(MOD_CONF_CTRL_1) & ~(0x03 << n);
-       l |= source << n;
-       omap_writel(l, MOD_CONF_CTRL_1);
+       int ret;
+       struct dmtimer_platform_data *pdata;
 
-       return 0;
-}
-EXPORT_SYMBOL_GPL(omap_dm_timer_set_source);
+       if (unlikely(!timer))
+               return -EINVAL;
 
-#else
+       pdata = timer->pdev->dev.platform_data;
 
-int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
-{
        if (source < 0 || source >= 3)
                return -EINVAL;
 
-       return __omap_dm_timer_set_source(timer->fclk,
-                                               dm_source_clocks[source]);
+       ret = pdata->set_timer_src(timer->pdev, source);
+
+       return ret;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_set_source);
 
-#endif
-
-void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
+int omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
                            unsigned int load)
 {
        u32 l;
 
+       if (unlikely(!timer))
+               return -EINVAL;
+
+       omap_dm_timer_enable(timer);
        l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
        if (autoreload)
                l |= OMAP_TIMER_CTRL_AR;
@@ -448,15 +397,32 @@ void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
        omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
 
        omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0);
+       /* Save the context */
+       timer->context.tclr = l;
+       timer->context.tldr = load;
+       omap_dm_timer_disable(timer);
+       return 0;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_set_load);
 
 /* Optimized set_load which removes costly spin wait in timer_start */
-void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
+int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
                             unsigned int load)
 {
        u32 l;
 
+       if (unlikely(!timer))
+               return -EINVAL;
+
+       omap_dm_timer_enable(timer);
+
+       if (timer->loses_context) {
+               u32 ctx_loss_cnt_after =
+                       timer->get_context_loss_count(&timer->pdev->dev);
+               if (ctx_loss_cnt_after != timer->ctx_loss_count)
+                       omap_timer_restore_context(timer);
+       }
+
        l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
        if (autoreload) {
                l |= OMAP_TIMER_CTRL_AR;
@@ -466,15 +432,25 @@ void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
        }
        l |= OMAP_TIMER_CTRL_ST;
 
-       __omap_dm_timer_load_start(timer->io_base, l, load, timer->posted);
+       __omap_dm_timer_load_start(timer, l, load, timer->posted);
+
+       /* Save the context */
+       timer->context.tclr = l;
+       timer->context.tldr = load;
+       timer->context.tcrr = load;
+       return 0;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_set_load_start);
 
-void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
+int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
                             unsigned int match)
 {
        u32 l;
 
+       if (unlikely(!timer))
+               return -EINVAL;
+
+       omap_dm_timer_enable(timer);
        l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
        if (enable)
                l |= OMAP_TIMER_CTRL_CE;
@@ -482,14 +458,24 @@ void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
                l &= ~OMAP_TIMER_CTRL_CE;
        omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
        omap_dm_timer_write_reg(timer, OMAP_TIMER_MATCH_REG, match);
+
+       /* Save the context */
+       timer->context.tclr = l;
+       timer->context.tmar = match;
+       omap_dm_timer_disable(timer);
+       return 0;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_set_match);
 
-void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
+int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
                           int toggle, int trigger)
 {
        u32 l;
 
+       if (unlikely(!timer))
+               return -EINVAL;
+
+       omap_dm_timer_enable(timer);
        l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
        l &= ~(OMAP_TIMER_CTRL_GPOCFG | OMAP_TIMER_CTRL_SCPWM |
               OMAP_TIMER_CTRL_PT | (0x03 << 10));
@@ -499,13 +485,22 @@ void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
                l |= OMAP_TIMER_CTRL_PT;
        l |= trigger << 10;
        omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
+
+       /* Save the context */
+       timer->context.tclr = l;
+       omap_dm_timer_disable(timer);
+       return 0;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_set_pwm);
 
-void omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler)
+int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler)
 {
        u32 l;
 
+       if (unlikely(!timer))
+               return -EINVAL;
+
+       omap_dm_timer_enable(timer);
        l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
        l &= ~(OMAP_TIMER_CTRL_PRE | (0x07 << 2));
        if (prescaler >= 0x00 && prescaler <= 0x07) {
@@ -513,13 +508,28 @@ void omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler)
                l |= prescaler << 2;
        }
        omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
+
+       /* Save the context */
+       timer->context.tclr = l;
+       omap_dm_timer_disable(timer);
+       return 0;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_set_prescaler);
 
-void omap_dm_timer_set_int_enable(struct omap_dm_timer *timer,
+int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer,
                                  unsigned int value)
 {
-       __omap_dm_timer_int_enable(timer->io_base, value);
+       if (unlikely(!timer))
+               return -EINVAL;
+
+       omap_dm_timer_enable(timer);
+       __omap_dm_timer_int_enable(timer, value);
+
+       /* Save the context */
+       timer->context.tier = value;
+       timer->context.twer = value;
+       omap_dm_timer_disable(timer);
+       return 0;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_set_int_enable);
 
@@ -527,40 +537,61 @@ unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer)
 {
        unsigned int l;
 
-       l = omap_dm_timer_read_reg(timer, OMAP_TIMER_STAT_REG);
+       if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
+               pr_err("%s: timer not available or enabled.\n", __func__);
+               return 0;
+       }
+
+       l = __raw_readl(timer->irq_stat);
 
        return l;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_read_status);
 
-void omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value)
+int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value)
 {
-       __omap_dm_timer_write_status(timer->io_base, value);
+       if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev)))
+               return -EINVAL;
+
+       __omap_dm_timer_write_status(timer, value);
+       /* Save the context */
+       timer->context.tisr = value;
+       return 0;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_write_status);
 
 unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer)
 {
-       return __omap_dm_timer_read_counter(timer->io_base, timer->posted);
+       if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
+               pr_err("%s: timer not iavailable or enabled.\n", __func__);
+               return 0;
+       }
+
+       return __omap_dm_timer_read_counter(timer, timer->posted);
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_read_counter);
 
-void omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value)
+int omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value)
 {
+       if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
+               pr_err("%s: timer not available or enabled.\n", __func__);
+               return -EINVAL;
+       }
+
        omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, value);
+
+       /* Save the context */
+       timer->context.tcrr = value;
+       return 0;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_write_counter);
 
 int omap_dm_timers_active(void)
 {
-       int i;
-
-       for (i = 0; i < dm_timer_count; i++) {
-               struct omap_dm_timer *timer;
-
-               timer = &dm_timers[i];
+       struct omap_dm_timer *timer;
 
-               if (!timer->enabled)
+       list_for_each_entry(timer, &omap_timer_list, node) {
+               if (!timer->reserved)
                        continue;
 
                if (omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG) &
@@ -572,69 +603,147 @@ int omap_dm_timers_active(void)
 }
 EXPORT_SYMBOL_GPL(omap_dm_timers_active);
 
-static int __init omap_dm_timer_init(void)
+/**
+ * omap_dm_timer_probe - probe function called for every registered device
+ * @pdev:      pointer to current timer platform device
+ *
+ * Called by driver framework at the end of device registration for all
+ * timer devices.
+ */
+static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
 {
+       int ret;
+       unsigned long flags;
        struct omap_dm_timer *timer;
-       int i, map_size = SZ_8K;        /* Module 4KB + L4 4KB except on omap1 */
+       struct resource *mem, *irq, *ioarea;
+       struct dmtimer_platform_data *pdata = pdev->dev.platform_data;
 
-       if (!(cpu_is_omap16xx() || cpu_class_is_omap2()))
+       if (!pdata) {
+               dev_err(&pdev->dev, "%s: no platform data.\n", __func__);
                return -ENODEV;
+       }
 
-       spin_lock_init(&dm_timer_lock);
-
-       if (cpu_class_is_omap1()) {
-               dm_timers = omap1_dm_timers;
-               dm_timer_count = omap1_dm_timer_count;
-               map_size = SZ_2K;
-       } else if (cpu_is_omap24xx()) {
-               dm_timers = omap2_dm_timers;
-               dm_timer_count = omap2_dm_timer_count;
-               dm_source_names = omap2_dm_source_names;
-               dm_source_clocks = omap2_dm_source_clocks;
-       } else if (cpu_is_omap34xx()) {
-               dm_timers = omap3_dm_timers;
-               dm_timer_count = omap3_dm_timer_count;
-               dm_source_names = omap3_dm_source_names;
-               dm_source_clocks = omap3_dm_source_clocks;
-       } else if (cpu_is_omap44xx()) {
-               dm_timers = omap4_dm_timers;
-               dm_timer_count = omap4_dm_timer_count;
-               dm_source_names = omap4_dm_source_names;
-               dm_source_clocks = omap4_dm_source_clocks;
+       irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+       if (unlikely(!irq)) {
+               dev_err(&pdev->dev, "%s: no IRQ resource.\n", __func__);
+               return -ENODEV;
        }
 
-       if (cpu_class_is_omap2())
-               for (i = 0; dm_source_names[i] != NULL; i++)
-                       dm_source_clocks[i] = clk_get(NULL, dm_source_names[i]);
+       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (unlikely(!mem)) {
+               dev_err(&pdev->dev, "%s: no memory resource.\n", __func__);
+               return -ENODEV;
+       }
 
-       if (cpu_is_omap243x())
-               dm_timers[0].phys_base = 0x49018000;
+       ioarea = request_mem_region(mem->start, resource_size(mem),
+                       pdev->name);
+       if (!ioarea) {
+               dev_err(&pdev->dev, "%s: region already claimed.\n", __func__);
+               return -EBUSY;
+       }
 
-       for (i = 0; i < dm_timer_count; i++) {
-               timer = &dm_timers[i];
+       timer = kzalloc(sizeof(struct omap_dm_timer), GFP_KERNEL);
+       if (!timer) {
+               dev_err(&pdev->dev, "%s: no memory for omap_dm_timer.\n",
+                       __func__);
+               ret = -ENOMEM;
+               goto err_free_ioregion;
+       }
 
-               /* Static mapping, never released */
-               timer->io_base = ioremap(timer->phys_base, map_size);
-               BUG_ON(!timer->io_base);
+       timer->io_base = ioremap(mem->start, resource_size(mem));
+       if (!timer->io_base) {
+               dev_err(&pdev->dev, "%s: ioremap failed.\n", __func__);
+               ret = -ENOMEM;
+               goto err_free_mem;
+       }
 
-#ifdef CONFIG_ARCH_OMAP2PLUS
-               if (cpu_class_is_omap2()) {
-                       char clk_name[16];
-                       sprintf(clk_name, "gpt%d_ick", i + 1);
-                       timer->iclk = clk_get(NULL, clk_name);
-                       sprintf(clk_name, "gpt%d_fck", i + 1);
-                       timer->fclk = clk_get(NULL, clk_name);
-               }
+       timer->id = pdev->id;
+       timer->irq = irq->start;
+       timer->reserved = pdata->reserved;
+       timer->pdev = pdev;
+       timer->loses_context = pdata->loses_context;
+       timer->get_context_loss_count = pdata->get_context_loss_count;
+
+       /* Skip pm_runtime_enable for OMAP1 */
+       if (!pdata->needs_manual_reset) {
+               pm_runtime_enable(&pdev->dev);
+               pm_runtime_irq_safe(&pdev->dev);
+       }
 
-               /* One or two timers may be set up early for sys_timer */
-               if (sys_timer_reserved & (1  << i)) {
-                       timer->reserved = 1;
-                       timer->posted = 1;
-               }
-#endif
+       if (!timer->reserved) {
+               pm_runtime_get_sync(&pdev->dev);
+               __omap_dm_timer_init_regs(timer);
+               pm_runtime_put(&pdev->dev);
        }
 
+       /* add the timer element to the list */
+       spin_lock_irqsave(&dm_timer_lock, flags);
+       list_add_tail(&timer->node, &omap_timer_list);
+       spin_unlock_irqrestore(&dm_timer_lock, flags);
+
+       dev_dbg(&pdev->dev, "Device Probed.\n");
+
        return 0;
+
+err_free_mem:
+       kfree(timer);
+
+err_free_ioregion:
+       release_mem_region(mem->start, resource_size(mem));
+
+       return ret;
 }
 
-arch_initcall(omap_dm_timer_init);
+/**
+ * omap_dm_timer_remove - cleanup a registered timer device
+ * @pdev:      pointer to current timer platform device
+ *
+ * Called by driver framework whenever a timer device is unregistered.
+ * In addition to freeing platform resources it also deletes the timer
+ * entry from the local list.
+ */
+static int __devexit omap_dm_timer_remove(struct platform_device *pdev)
+{
+       struct omap_dm_timer *timer;
+       unsigned long flags;
+       int ret = -EINVAL;
+
+       spin_lock_irqsave(&dm_timer_lock, flags);
+       list_for_each_entry(timer, &omap_timer_list, node)
+               if (timer->pdev->id == pdev->id) {
+                       list_del(&timer->node);
+                       kfree(timer);
+                       ret = 0;
+                       break;
+               }
+       spin_unlock_irqrestore(&dm_timer_lock, flags);
+
+       return ret;
+}
+
+static struct platform_driver omap_dm_timer_driver = {
+       .probe  = omap_dm_timer_probe,
+       .remove = omap_dm_timer_remove,
+       .driver = {
+               .name   = "omap_timer",
+       },
+};
+
+static int __init omap_dm_timer_driver_init(void)
+{
+       return platform_driver_register(&omap_dm_timer_driver);
+}
+
+static void __exit omap_dm_timer_driver_exit(void)
+{
+       platform_driver_unregister(&omap_dm_timer_driver);
+}
+
+early_platform_init("earlytimer", &omap_dm_timer_driver);
+module_init(omap_dm_timer_driver_init);
+module_exit(omap_dm_timer_driver_exit);
+
+MODULE_DESCRIPTION("OMAP Dual-Mode Timer Driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:" DRIVER_NAME);
+MODULE_AUTHOR("Texas Instruments Inc");
index 3341ca4703e9c29f1cffadc6d431df8f6fef5ca6..c20beb8ed38b7230dfd3183b21db34b7e8eda190 100644 (file)
@@ -123,19 +123,11 @@ static void omap_pm_set_max_mpu_wakeup_lat_compat(struct device *dev, long t)
        omap_pm_set_max_mpu_wakeup_lat(dev, t);
 }
 
-static struct omap_device_pm_latency omap_i2c_latency[] = {
-       [0] = {
-               .deactivate_func        = omap_device_idle_hwmods,
-               .activate_func          = omap_device_enable_hwmods,
-               .flags                  = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-       },
-};
-
 static inline int omap2_i2c_add_bus(int bus_id)
 {
        int l;
        struct omap_hwmod *oh;
-       struct omap_device *od;
+       struct platform_device *pdev;
        char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN];
        struct omap_i2c_bus_platform_data *pdata;
 
@@ -160,12 +152,12 @@ static inline int omap2_i2c_add_bus(int bus_id)
         */
        if (cpu_is_omap34xx())
                pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat;
-       od = omap_device_build(name, bus_id, oh, pdata,
+       pdev = omap_device_build(name, bus_id, oh, pdata,
                        sizeof(struct omap_i2c_bus_platform_data),
-                       omap_i2c_latency, ARRAY_SIZE(omap_i2c_latency), 0);
-       WARN(IS_ERR(od), "Could not build omap_device for %s\n", name);
+                       NULL, 0, 0);
+       WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
 
-       return PTR_ERR(od);
+       return PTR_ERR(pdev);
 }
 #else
 static inline int omap2_i2c_add_bus(int bus_id)
index df4b9683f17f5d6e1c4f70cc6693ed511da4ef3d..197ca03c3f7d8490a109a9b576b2e2f9c9c420e6 100644 (file)
@@ -80,8 +80,6 @@ struct clkops {
  *
  * @div is the divisor that should be applied to the parent clock's rate
  * to produce the current clock's rate.
- *
- * XXX @flags probably should be replaced with an struct omap_chip.
  */
 struct clksel_rate {
        u32                     val;
index 4564cc697d7ff867726ec7ccb636a958d0bd9794..abda2c7e499b2f50f8b9c7fb659ff2e04ec5a0e7 100644 (file)
@@ -45,6 +45,15 @@ extern unsigned long long notrace omap_32k_sched_clock(void);
 
 extern void omap_reserve(void);
 
+void omap2420_init_early(void);
+void omap2430_init_early(void);
+void omap3430_init_early(void);
+void omap35xx_init_early(void);
+void omap3630_init_early(void);
+void am35xx_init_early(void);
+void ti816x_init_early(void);
+void omap4430_init_early(void);
+
 /*
  * IO bases for various OMAP processors
  * Except the tap base, rest all the io bases
@@ -74,7 +83,11 @@ void omap2_set_globals_sdrc(struct omap_globals *);
 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 omap4_map_io(void);
+
 
 /**
  * omap_test_timeout - busy-loop, testing a condition
index 67b3d75884cdf10fac8524df5ab13c99c1c07ac2..2f90269422292d8ae8f854bbbead3751bfca784c 100644 (file)
 
 int omap_type(void);
 
-struct omap_chip_id {
-       u16 oc;
-       u8 type;
-};
-
-#define OMAP_CHIP_INIT(x)      { .oc = x }
-
 /*
  * omap_rev bits:
  * CPU id bits (0730, 1510, 1710, 2422...)     [31:16]
@@ -59,19 +52,6 @@ struct omap_chip_id {
  */
 unsigned int omap_rev(void);
 
-/*
- * Define CPU revision bits
- *
- * Verbose meaning of the revision bits may be different for a silicon
- * family. This difference can be handled separately.
- */
-#define OMAP_REVBITS_00                0x00
-#define OMAP_REVBITS_01                0x01
-#define OMAP_REVBITS_02                0x02
-#define OMAP_REVBITS_03                0x03
-#define OMAP_REVBITS_04                0x04
-#define OMAP_REVBITS_05                0x05
-
 /*
  * Get the CPU revision for OMAP devices
  */
@@ -262,7 +242,7 @@ IS_OMAP_TYPE(2422, 0x2422)
 IS_OMAP_TYPE(2423, 0x2423)
 IS_OMAP_TYPE(2430, 0x2430)
 IS_OMAP_TYPE(3430, 0x3430)
-IS_OMAP_TYPE(3505, 0x3505)
+IS_OMAP_TYPE(3505, 0x3517)
 IS_OMAP_TYPE(3517, 0x3517)
 
 #define cpu_is_omap310()               0
@@ -354,8 +334,9 @@ IS_OMAP_TYPE(3517, 0x3517)
                                                (!omap3_has_sgx()) &&   \
                                                (omap3_has_iva()))
 # define cpu_is_omap3530()             (cpu_is_omap3430())
-# define cpu_is_omap3505()             is_omap3505()
 # define cpu_is_omap3517()             is_omap3517()
+# define cpu_is_omap3505()             (cpu_is_omap3517() &&           \
+                                               !omap3_has_sgx())
 # undef cpu_is_omap3630
 # define cpu_is_omap3630()             is_omap363x()
 # define cpu_is_ti816x()               is_ti816x()
@@ -379,35 +360,31 @@ IS_OMAP_TYPE(3517, 0x3517)
 /* Various silicon revisions for omap2 */
 #define OMAP242X_CLASS         0x24200024
 #define OMAP2420_REV_ES1_0     OMAP242X_CLASS
-#define OMAP2420_REV_ES2_0     (OMAP242X_CLASS | (OMAP_REVBITS_01 << 8))
+#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 | (OMAP_REVBITS_01 << 8))
-#define OMAP3430_REV_ES2_1     (OMAP343X_CLASS | (OMAP_REVBITS_02 << 8))
-#define OMAP3430_REV_ES3_0     (OMAP343X_CLASS | (OMAP_REVBITS_03 << 8))
-#define OMAP3430_REV_ES3_1     (OMAP343X_CLASS | (OMAP_REVBITS_04 << 8))
-#define OMAP3430_REV_ES3_1_2   (OMAP343X_CLASS | (OMAP_REVBITS_05 << 8))
+#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 | (OMAP_REVBITS_01 << 8))
-#define OMAP3630_REV_ES1_2     (OMAP363X_CLASS | (OMAP_REVBITS_02 << 8))
+#define OMAP3630_REV_ES1_1     (OMAP363X_CLASS | (0x1 << 8))
+#define OMAP3630_REV_ES1_2     (OMAP363X_CLASS | (0x2 << 8))
 
-#define OMAP35XX_CLASS         0x35000034
-#define OMAP3503_REV(v)                (OMAP35XX_CLASS | (0x3503 << 16) | (v << 8))
-#define OMAP3515_REV(v)                (OMAP35XX_CLASS | (0x3515 << 16) | (v << 8))
-#define OMAP3525_REV(v)                (OMAP35XX_CLASS | (0x3525 << 16) | (v << 8))
-#define OMAP3530_REV(v)                (OMAP35XX_CLASS | (0x3530 << 16) | (v << 8))
-#define OMAP3505_REV(v)                (OMAP35XX_CLASS | (0x3505 << 16) | (v << 8))
-#define OMAP3517_REV(v)                (OMAP35XX_CLASS | (0x3517 << 16) | (v << 8))
+#define OMAP3517_CLASS         0x35170034
+#define OMAP3517_REV_ES1_0     OMAP3517_CLASS
+#define OMAP3517_REV_ES1_1     (OMAP3517_CLASS | (0x1 << 8))
 
 #define TI816X_CLASS           0x81600034
 #define TI8168_REV_ES1_0       TI816X_CLASS
-#define TI8168_REV_ES1_1       (TI816X_CLASS | (OMAP_REVBITS_01 << 8))
+#define TI8168_REV_ES1_1       (TI816X_CLASS | (0x1 << 8))
 
 #define OMAP443X_CLASS         0x44300044
 #define OMAP4430_REV_ES1_0     (OMAP443X_CLASS | (0x10 << 8))
@@ -418,61 +395,6 @@ IS_OMAP_TYPE(3517, 0x3517)
 #define OMAP446X_CLASS         0x44600044
 #define OMAP4460_REV_ES1_0     (OMAP446X_CLASS | (0x10 << 8))
 
-/*
- * omap_chip bits
- *
- * CHIP_IS_OMAP{2420,2430,3430} indicate that a particular structure is
- * valid on all chips of that type.  CHIP_IS_OMAP3430ES{1,2} indicates
- * something that is only valid on that particular ES revision.
- *
- * These bits may be ORed together to indicate structures that are
- * available on multiple chip types.
- *
- * To test whether a particular structure matches the current OMAP chip type,
- * use omap_chip_is().
- *
- */
-#define CHIP_IS_OMAP2420               (1 << 0)
-#define CHIP_IS_OMAP2430               (1 << 1)
-#define CHIP_IS_OMAP3430               (1 << 2)
-#define CHIP_IS_OMAP3430ES1            (1 << 3)
-#define CHIP_IS_OMAP3430ES2            (1 << 4)
-#define CHIP_IS_OMAP3430ES3_0          (1 << 5)
-#define CHIP_IS_OMAP3430ES3_1          (1 << 6)
-#define CHIP_IS_OMAP3630ES1            (1 << 7)
-#define CHIP_IS_OMAP4430ES1            (1 << 8)
-#define CHIP_IS_OMAP3630ES1_1           (1 << 9)
-#define CHIP_IS_OMAP3630ES1_2           (1 << 10)
-#define CHIP_IS_OMAP4430ES2            (1 << 11)
-#define CHIP_IS_OMAP4430ES2_1          (1 << 12)
-#define CHIP_IS_OMAP4430ES2_2          (1 << 13)
-#define CHIP_IS_TI816X                 (1 << 14)
-#define CHIP_IS_OMAP4460ES1_0          (1 << 15)
-
-#define CHIP_IS_OMAP24XX               (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430)
-
-#define CHIP_IS_OMAP4430               (CHIP_IS_OMAP4430ES1 |          \
-                                        CHIP_IS_OMAP4430ES2 |          \
-                                        CHIP_IS_OMAP4430ES2_1 |        \
-                                        CHIP_IS_OMAP4430ES2_2 |        \
-                                        CHIP_IS_OMAP4460ES1_0)
-
-/*
- * "GE" here represents "greater than or equal to" in terms of ES
- * levels.  So CHIP_GE_OMAP3430ES2 is intended to match all OMAP3430
- * chips at ES2 and beyond, but not, for example, any OMAP lines after
- * OMAP3.
- */
-#define CHIP_GE_OMAP3430ES2            (CHIP_IS_OMAP3430ES2 | \
-                                        CHIP_IS_OMAP3430ES3_0 | \
-                                        CHIP_GE_OMAP3430ES3_1)
-#define CHIP_GE_OMAP3430ES3_1          (CHIP_IS_OMAP3430ES3_1 | \
-                                        CHIP_IS_OMAP3630ES1 | \
-                                        CHIP_GE_OMAP3630ES1_1)
-#define CHIP_GE_OMAP3630ES1_1          (CHIP_IS_OMAP3630ES1_1 | \
-                                        CHIP_IS_OMAP3630ES1_2)
-
-int omap_chip_is(struct omap_chip_id oci);
 void omap2_check_revision(void);
 
 /*
index eb5d16c60cd9343589461d50465a6e8d5fee38e1..d11025e6e7a47df9921d252c46c64c087974132f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * arch/arm/plat-omap/include/mach/dmtimer.h
+ * arch/arm/plat-omap/include/plat/dmtimer.h
  *
  * OMAP Dual-Mode Timers
  *
@@ -35,6 +35,7 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/platform_device.h>
 
 #ifndef __ASM_ARCH_DMTIMER_H
 #define __ASM_ARCH_DMTIMER_H
  * in OMAP4 can be distinguished.
  */
 #define OMAP_TIMER_IP_VERSION_1                        0x1
+
+/* timer capabilities used in hwmod database */
+#define OMAP_TIMER_SECURE                              0x80000000
+#define OMAP_TIMER_ALWON                               0x40000000
+#define OMAP_TIMER_HAS_PWM                             0x20000000
+
+struct omap_timer_capability_dev_attr {
+       u32 timer_capability;
+};
+
 struct omap_dm_timer;
 struct clk;
 
+struct timer_regs {
+       u32 tidr;
+       u32 tiocp_cfg;
+       u32 tistat;
+       u32 tisr;
+       u32 tier;
+       u32 twer;
+       u32 tclr;
+       u32 tcrr;
+       u32 tldr;
+       u32 ttrg;
+       u32 twps;
+       u32 tmar;
+       u32 tcar1;
+       u32 tsicr;
+       u32 tcar2;
+       u32 tpir;
+       u32 tnir;
+       u32 tcvr;
+       u32 tocr;
+       u32 towr;
+};
+
+struct dmtimer_platform_data {
+       int (*set_timer_src)(struct platform_device *pdev, int source);
+       int timer_ip_version;
+       u32 needs_manual_reset:1;
+       bool reserved;
+
+       bool loses_context;
+
+       u32 (*get_context_loss_count)(struct device *dev);
+};
+
 struct omap_dm_timer *omap_dm_timer_request(void);
 struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id);
-void omap_dm_timer_free(struct omap_dm_timer *timer);
+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);
 
@@ -73,23 +118,23 @@ int omap_dm_timer_get_irq(struct omap_dm_timer *timer);
 u32 omap_dm_timer_modify_idlect_mask(u32 inputmask);
 struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer);
 
-void omap_dm_timer_trigger(struct omap_dm_timer *timer);
-void omap_dm_timer_start(struct omap_dm_timer *timer);
-void omap_dm_timer_stop(struct omap_dm_timer *timer);
+int omap_dm_timer_trigger(struct omap_dm_timer *timer);
+int omap_dm_timer_start(struct omap_dm_timer *timer);
+int omap_dm_timer_stop(struct omap_dm_timer *timer);
 
 int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source);
-void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, unsigned int value);
-void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, unsigned int value);
-void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, unsigned int match);
-void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, int toggle, int trigger);
-void omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler);
+int omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, unsigned int value);
+int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, unsigned int value);
+int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, unsigned int match);
+int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, int toggle, int trigger);
+int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler);
 
-void omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, unsigned int value);
+int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, unsigned int value);
 
 unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer);
-void omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value);
+int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value);
 unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer);
-void omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value);
+int omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value);
 
 int omap_dm_timers_active(void);
 
@@ -98,12 +143,30 @@ int omap_dm_timers_active(void);
  * used by dmtimer.c and sys_timer related code.
  */
 
-/* register offsets */
-#define _OMAP_TIMER_ID_OFFSET          0x00
-#define _OMAP_TIMER_OCP_CFG_OFFSET     0x10
-#define _OMAP_TIMER_SYS_STAT_OFFSET    0x14
-#define _OMAP_TIMER_STAT_OFFSET                0x18
-#define _OMAP_TIMER_INT_EN_OFFSET      0x1c
+/*
+ * The interrupt registers are different between v1 and v2 ip.
+ * These registers are offsets from timer->iobase.
+ */
+#define OMAP_TIMER_ID_OFFSET           0x00
+#define OMAP_TIMER_OCP_CFG_OFFSET      0x10
+
+#define OMAP_TIMER_V1_SYS_STAT_OFFSET  0x14
+#define OMAP_TIMER_V1_STAT_OFFSET      0x18
+#define OMAP_TIMER_V1_INT_EN_OFFSET    0x1c
+
+#define OMAP_TIMER_V2_IRQSTATUS_RAW    0x24
+#define OMAP_TIMER_V2_IRQSTATUS                0x28
+#define OMAP_TIMER_V2_IRQENABLE_SET    0x2c
+#define OMAP_TIMER_V2_IRQENABLE_CLR    0x30
+
+/*
+ * The functional registers have a different base on v1 and v2 ip.
+ * These registers are offsets from timer->func_base. The func_base
+ * is samae as io_base for v1 and io_base + 0x14 for v2 ip.
+ *
+ */
+#define OMAP_TIMER_V2_FUNC_OFFSET              0x14
+
 #define _OMAP_TIMER_WAKEUP_EN_OFFSET   0x20
 #define _OMAP_TIMER_CTRL_OFFSET                0x24
 #define                OMAP_TIMER_CTRL_GPOCFG          (1 << 14)
@@ -147,21 +210,6 @@ int omap_dm_timers_active(void);
 /* register offsets with the write pending bit encoded */
 #define        WPSHIFT                                 16
 
-#define OMAP_TIMER_ID_REG                      (_OMAP_TIMER_ID_OFFSET \
-                                                       | (WP_NONE << WPSHIFT))
-
-#define OMAP_TIMER_OCP_CFG_REG                 (_OMAP_TIMER_OCP_CFG_OFFSET \
-                                                       | (WP_NONE << WPSHIFT))
-
-#define OMAP_TIMER_SYS_STAT_REG                        (_OMAP_TIMER_SYS_STAT_OFFSET \
-                                                       | (WP_NONE << WPSHIFT))
-
-#define OMAP_TIMER_STAT_REG                    (_OMAP_TIMER_STAT_OFFSET \
-                                                       | (WP_NONE << WPSHIFT))
-
-#define OMAP_TIMER_INT_EN_REG                  (_OMAP_TIMER_INT_EN_OFFSET \
-                                                       | (WP_NONE << WPSHIFT))
-
 #define OMAP_TIMER_WAKEUP_EN_REG               (_OMAP_TIMER_WAKEUP_EN_OFFSET \
                                                        | (WP_NONE << WPSHIFT))
 
@@ -209,49 +257,88 @@ int omap_dm_timers_active(void);
 
 struct omap_dm_timer {
        unsigned long phys_base;
+       int id;
        int irq;
-#ifdef CONFIG_ARCH_OMAP2PLUS
        struct clk *iclk, *fclk;
-#endif
-       void __iomem *io_base;
+
+       void __iomem    *io_base;
+       void __iomem    *sys_stat;      /* TISTAT timer status */
+       void __iomem    *irq_stat;      /* TISR/IRQSTATUS interrupt status */
+       void __iomem    *irq_ena;       /* irq enable */
+       void __iomem    *irq_dis;       /* irq disable, only on v2 ip */
+       void __iomem    *pend;          /* write pending */
+       void __iomem    *func_base;     /* function register base */
+
        unsigned long rate;
        unsigned reserved:1;
-       unsigned enabled:1;
        unsigned posted:1;
+       struct timer_regs context;
+       bool loses_context;
+       int ctx_loss_count;
+       int revision;
+       struct platform_device *pdev;
+       struct list_head node;
+
+       u32 (*get_context_loss_count)(struct device *dev);
 };
 
-extern u32 sys_timer_reserved;
-void omap_dm_timer_prepare(struct omap_dm_timer *timer);
+int omap_dm_timer_prepare(struct omap_dm_timer *timer);
 
-static inline u32 __omap_dm_timer_read(void __iomem *base, u32 reg,
+static inline u32 __omap_dm_timer_read(struct omap_dm_timer *timer, u32 reg,
                                                int posted)
 {
        if (posted)
-               while (__raw_readl(base + (OMAP_TIMER_WRITE_PEND_REG & 0xff))
-                               & (reg >> WPSHIFT))
+               while (__raw_readl(timer->pend) & (reg >> WPSHIFT))
                        cpu_relax();
 
-       return __raw_readl(base + (reg & 0xff));
+       return __raw_readl(timer->func_base + (reg & 0xff));
 }
 
-static inline void __omap_dm_timer_write(void __iomem *base, u32 reg, u32 val,
-                                               int posted)
+static inline void __omap_dm_timer_write(struct omap_dm_timer *timer,
+                                       u32 reg, u32 val, int posted)
 {
        if (posted)
-               while (__raw_readl(base + (OMAP_TIMER_WRITE_PEND_REG & 0xff))
-                               & (reg >> WPSHIFT))
+               while (__raw_readl(timer->pend) & (reg >> WPSHIFT))
                        cpu_relax();
 
-       __raw_writel(val, base + (reg & 0xff));
+       __raw_writel(val, timer->func_base + (reg & 0xff));
+}
+
+static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer)
+{
+       u32 tidr;
+
+       /* Assume v1 ip if bits [31:16] are zero */
+       tidr = __raw_readl(timer->io_base);
+       if (!(tidr >> 16)) {
+               timer->revision = 1;
+               timer->sys_stat = timer->io_base +
+                               OMAP_TIMER_V1_SYS_STAT_OFFSET;
+               timer->irq_stat = timer->io_base + OMAP_TIMER_V1_STAT_OFFSET;
+               timer->irq_ena = timer->io_base + OMAP_TIMER_V1_INT_EN_OFFSET;
+               timer->irq_dis = 0;
+               timer->pend = timer->io_base + _OMAP_TIMER_WRITE_PEND_OFFSET;
+               timer->func_base = timer->io_base;
+       } else {
+               timer->revision = 2;
+               timer->sys_stat = 0;
+               timer->irq_stat = timer->io_base + OMAP_TIMER_V2_IRQSTATUS;
+               timer->irq_ena = timer->io_base + OMAP_TIMER_V2_IRQENABLE_SET;
+               timer->irq_dis = timer->io_base + OMAP_TIMER_V2_IRQENABLE_CLR;
+               timer->pend = timer->io_base +
+                       _OMAP_TIMER_WRITE_PEND_OFFSET +
+                               OMAP_TIMER_V2_FUNC_OFFSET;
+               timer->func_base = timer->io_base + OMAP_TIMER_V2_FUNC_OFFSET;
+       }
 }
 
 /* Assumes the source clock has been set by caller */
-static inline void __omap_dm_timer_reset(void __iomem *base, int autoidle,
-                                               int wakeup)
+static inline void __omap_dm_timer_reset(struct omap_dm_timer *timer,
+                                       int autoidle, int wakeup)
 {
        u32 l;
 
-       l = __omap_dm_timer_read(base, OMAP_TIMER_OCP_CFG_REG, 0);
+       l = __raw_readl(timer->io_base + OMAP_TIMER_OCP_CFG_OFFSET);
        l |= 0x02 << 3;  /* Set to smart-idle mode */
        l |= 0x2 << 8;   /* Set clock activity to perserve f-clock on idle */
 
@@ -261,10 +348,10 @@ static inline void __omap_dm_timer_reset(void __iomem *base, int autoidle,
        if (wakeup)
                l |= 1 << 2;
 
-       __omap_dm_timer_write(base, OMAP_TIMER_OCP_CFG_REG, l, 0);
+       __raw_writel(l, timer->io_base + OMAP_TIMER_OCP_CFG_OFFSET);
 
        /* Match hardware reset default of posted mode */
-       __omap_dm_timer_write(base, OMAP_TIMER_IF_CTRL_REG,
+       __omap_dm_timer_write(timer, OMAP_TIMER_IF_CTRL_REG,
                                        OMAP_TIMER_CTRL_POSTED, 0);
 }
 
@@ -286,18 +373,18 @@ static inline int __omap_dm_timer_set_source(struct clk *timer_fck,
        return ret;
 }
 
-static inline void __omap_dm_timer_stop(void __iomem *base, int posted,
-                                               unsigned long rate)
+static inline void __omap_dm_timer_stop(struct omap_dm_timer *timer,
+                                       int posted, unsigned long rate)
 {
        u32 l;
 
-       l = __omap_dm_timer_read(base, OMAP_TIMER_CTRL_REG, posted);
+       l = __omap_dm_timer_read(timer, OMAP_TIMER_CTRL_REG, posted);
        if (l & OMAP_TIMER_CTRL_ST) {
                l &= ~0x1;
-               __omap_dm_timer_write(base, OMAP_TIMER_CTRL_REG, l, posted);
+               __omap_dm_timer_write(timer, OMAP_TIMER_CTRL_REG, l, posted);
 #ifdef CONFIG_ARCH_OMAP2PLUS
                /* Readback to make sure write has completed */
-               __omap_dm_timer_read(base, OMAP_TIMER_CTRL_REG, posted);
+               __omap_dm_timer_read(timer, OMAP_TIMER_CTRL_REG, posted);
                /*
                 * Wait for functional clock period x 3.5 to make sure that
                 * timer is stopped
@@ -307,34 +394,34 @@ static inline void __omap_dm_timer_stop(void __iomem *base, int posted,
        }
 
        /* Ack possibly pending interrupt */
-       __omap_dm_timer_write(base, OMAP_TIMER_STAT_REG,
-                                       OMAP_TIMER_INT_OVERFLOW, 0);
+       __raw_writel(OMAP_TIMER_INT_OVERFLOW, timer->irq_stat);
 }
 
-static inline void __omap_dm_timer_load_start(void __iomem *base, u32 ctrl,
-                                               unsigned int load, int posted)
+static inline void __omap_dm_timer_load_start(struct omap_dm_timer *timer,
+                                               u32 ctrl, unsigned int load,
+                                               int posted)
 {
-       __omap_dm_timer_write(base, OMAP_TIMER_COUNTER_REG, load, posted);
-       __omap_dm_timer_write(base, OMAP_TIMER_CTRL_REG, ctrl, posted);
+       __omap_dm_timer_write(timer, OMAP_TIMER_COUNTER_REG, load, posted);
+       __omap_dm_timer_write(timer, OMAP_TIMER_CTRL_REG, ctrl, posted);
 }
 
-static inline void __omap_dm_timer_int_enable(void __iomem *base,
+static inline void __omap_dm_timer_int_enable(struct omap_dm_timer *timer,
                                                unsigned int value)
 {
-       __omap_dm_timer_write(base, OMAP_TIMER_INT_EN_REG, value, 0);
-       __omap_dm_timer_write(base, OMAP_TIMER_WAKEUP_EN_REG, value, 0);
+       __raw_writel(value, timer->irq_ena);
+       __omap_dm_timer_write(timer, OMAP_TIMER_WAKEUP_EN_REG, value, 0);
 }
 
-static inline unsigned int __omap_dm_timer_read_counter(void __iomem *base,
-                                                       int posted)
+static inline unsigned int
+__omap_dm_timer_read_counter(struct omap_dm_timer *timer, int posted)
 {
-       return __omap_dm_timer_read(base, OMAP_TIMER_COUNTER_REG, posted);
+       return __omap_dm_timer_read(timer, OMAP_TIMER_COUNTER_REG, posted);
 }
 
-static inline void __omap_dm_timer_write_status(void __iomem *base,
+static inline void __omap_dm_timer_write_status(struct omap_dm_timer *timer,
                                                unsigned int value)
 {
-       __omap_dm_timer_write(base, OMAP_TIMER_STAT_REG, value, 0);
+       __raw_writel(value, timer->irq_stat);
 }
 
 #endif /* __ASM_ARCH_DMTIMER_H */
index 91e8de3db085d195be80690fbb5139149d7040f6..9e86ee0aed0a05fb5ad448d144a84a93e21e5d53 100644 (file)
@@ -222,26 +222,6 @@ extern void omap_gpio_restore_context(void);
 #include <linux/errno.h>
 #include <asm-generic/gpio.h>
 
-static inline int gpio_get_value(unsigned gpio)
-{
-       return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned gpio, int value)
-{
-       __gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned gpio)
-{
-       return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned gpio)
-{
-       return __gpio_to_irq(gpio);
-}
-
 static inline int irq_to_gpio(unsigned irq)
 {
        int tmp;
index ebe67ea8d06876e0d753f4670feba3e73e3cd48c..7471521c9737add0bfc8ed12a3ea023ed8570448 100644 (file)
 
 #define OMAP44XX_EMIF2_PHYS    OMAP44XX_EMIF2_BASE
                                                /* 0x4d000000 --> 0xfd200000 */
-#define OMAP44XX_EMIF2_VIRT    (OMAP44XX_EMIF2_PHYS + OMAP4_L3_PER_IO_OFFSET)
 #define OMAP44XX_EMIF2_SIZE    SZ_1M
+#define OMAP44XX_EMIF2_VIRT    (OMAP44XX_EMIF1_VIRT + OMAP44XX_EMIF1_SIZE)
 
 #define OMAP44XX_DMM_PHYS      OMAP44XX_DMM_BASE
                                                /* 0x4e000000 --> 0xfd300000 */
-#define OMAP44XX_DMM_VIRT      (OMAP44XX_DMM_PHYS + OMAP4_L3_PER_IO_OFFSET)
 #define OMAP44XX_DMM_SIZE      SZ_1M
+#define OMAP44XX_DMM_VIRT      (OMAP44XX_EMIF2_VIRT + OMAP44XX_EMIF2_SIZE)
 /*
  * ----------------------------------------------------------------------------
  * Omap specific register access
@@ -300,7 +300,7 @@ static inline void omap44xx_map_common_io(void)
 #endif
 
 extern void omap2_init_common_infrastructure(void);
-extern void omap2_init_common_devices(struct omap_sdrc_params *sdrc_cs0,
+extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
                                      struct omap_sdrc_params *sdrc_cs1);
 
 #define __arch_ioremap omap_ioremap
index 9882c657b2d4f80b3e85cb36f64082311612d3e0..8fa74e2c9d6ec6898968774a62b1c1ac65c15bfe 100644 (file)
@@ -25,9 +25,7 @@
 #define __ASM_ARCH_OMAP_MCBSP_H
 
 #include <linux/spinlock.h>
-
-#include <mach/hardware.h>
-#include <plat/clock.h>
+#include <linux/clk.h>
 
 /* macro for building platform_device for McBSP ports */
 #define OMAP_MCBSP_PLATFORM_DEVICE(port_nr)            \
@@ -40,104 +38,60 @@ static struct platform_device omap_mcbsp##port_nr = {      \
 #define MCBSP_CONFIG_TYPE3     0x3
 #define MCBSP_CONFIG_TYPE4     0x4
 
-#define OMAP7XX_MCBSP1_BASE    0xfffb1000
-#define OMAP7XX_MCBSP2_BASE    0xfffb1800
-
-#define OMAP1510_MCBSP1_BASE   0xe1011800
-#define OMAP1510_MCBSP2_BASE   0xfffb1000
-#define OMAP1510_MCBSP3_BASE   0xe1017000
-
-#define OMAP1610_MCBSP1_BASE   0xe1011800
-#define OMAP1610_MCBSP2_BASE   0xfffb1000
-#define OMAP1610_MCBSP3_BASE   0xe1017000
-
-#ifdef CONFIG_ARCH_OMAP1
-
-#define OMAP_MCBSP_REG_DRR2    0x00
-#define OMAP_MCBSP_REG_DRR1    0x02
-#define OMAP_MCBSP_REG_DXR2    0x04
-#define OMAP_MCBSP_REG_DXR1    0x06
-#define OMAP_MCBSP_REG_DRR     0x02
-#define OMAP_MCBSP_REG_DXR     0x06
-#define OMAP_MCBSP_REG_SPCR2   0x08
-#define OMAP_MCBSP_REG_SPCR1   0x0a
-#define OMAP_MCBSP_REG_RCR2    0x0c
-#define OMAP_MCBSP_REG_RCR1    0x0e
-#define OMAP_MCBSP_REG_XCR2    0x10
-#define OMAP_MCBSP_REG_XCR1    0x12
-#define OMAP_MCBSP_REG_SRGR2   0x14
-#define OMAP_MCBSP_REG_SRGR1   0x16
-#define OMAP_MCBSP_REG_MCR2    0x18
-#define OMAP_MCBSP_REG_MCR1    0x1a
-#define OMAP_MCBSP_REG_RCERA   0x1c
-#define OMAP_MCBSP_REG_RCERB   0x1e
-#define OMAP_MCBSP_REG_XCERA   0x20
-#define OMAP_MCBSP_REG_XCERB   0x22
-#define OMAP_MCBSP_REG_PCR0    0x24
-#define OMAP_MCBSP_REG_RCERC   0x26
-#define OMAP_MCBSP_REG_RCERD   0x28
-#define OMAP_MCBSP_REG_XCERC   0x2A
-#define OMAP_MCBSP_REG_XCERD   0x2C
-#define OMAP_MCBSP_REG_RCERE   0x2E
-#define OMAP_MCBSP_REG_RCERF   0x30
-#define OMAP_MCBSP_REG_XCERE   0x32
-#define OMAP_MCBSP_REG_XCERF   0x34
-#define OMAP_MCBSP_REG_RCERG   0x36
-#define OMAP_MCBSP_REG_RCERH   0x38
-#define OMAP_MCBSP_REG_XCERG   0x3A
-#define OMAP_MCBSP_REG_XCERH   0x3C
-
-/* Dummy defines, these are not available on omap1 */
-#define OMAP_MCBSP_REG_XCCR    0x00
-#define OMAP_MCBSP_REG_RCCR    0x00
-
-#else
-
-#define OMAP_MCBSP_REG_DRR2    0x00
-#define OMAP_MCBSP_REG_DRR1    0x04
-#define OMAP_MCBSP_REG_DXR2    0x08
-#define OMAP_MCBSP_REG_DXR1    0x0C
-#define OMAP_MCBSP_REG_DRR     0x00
-#define OMAP_MCBSP_REG_DXR     0x08
-#define OMAP_MCBSP_REG_SPCR2   0x10
-#define OMAP_MCBSP_REG_SPCR1   0x14
-#define OMAP_MCBSP_REG_RCR2    0x18
-#define OMAP_MCBSP_REG_RCR1    0x1C
-#define OMAP_MCBSP_REG_XCR2    0x20
-#define OMAP_MCBSP_REG_XCR1    0x24
-#define OMAP_MCBSP_REG_SRGR2   0x28
-#define OMAP_MCBSP_REG_SRGR1   0x2C
-#define OMAP_MCBSP_REG_MCR2    0x30
-#define OMAP_MCBSP_REG_MCR1    0x34
-#define OMAP_MCBSP_REG_RCERA   0x38
-#define OMAP_MCBSP_REG_RCERB   0x3C
-#define OMAP_MCBSP_REG_XCERA   0x40
-#define OMAP_MCBSP_REG_XCERB   0x44
-#define OMAP_MCBSP_REG_PCR0    0x48
-#define OMAP_MCBSP_REG_RCERC   0x4C
-#define OMAP_MCBSP_REG_RCERD   0x50
-#define OMAP_MCBSP_REG_XCERC   0x54
-#define OMAP_MCBSP_REG_XCERD   0x58
-#define OMAP_MCBSP_REG_RCERE   0x5C
-#define OMAP_MCBSP_REG_RCERF   0x60
-#define OMAP_MCBSP_REG_XCERE   0x64
-#define OMAP_MCBSP_REG_XCERF   0x68
-#define OMAP_MCBSP_REG_RCERG   0x6C
-#define OMAP_MCBSP_REG_RCERH   0x70
-#define OMAP_MCBSP_REG_XCERG   0x74
-#define OMAP_MCBSP_REG_XCERH   0x78
-#define OMAP_MCBSP_REG_SYSCON  0x8C
-#define OMAP_MCBSP_REG_THRSH2  0x90
-#define OMAP_MCBSP_REG_THRSH1  0x94
-#define OMAP_MCBSP_REG_IRQST   0xA0
-#define OMAP_MCBSP_REG_IRQEN   0xA4
-#define OMAP_MCBSP_REG_WAKEUPEN        0xA8
-#define OMAP_MCBSP_REG_XCCR    0xAC
-#define OMAP_MCBSP_REG_RCCR    0xB0
-#define OMAP_MCBSP_REG_XBUFFSTAT       0xB4
-#define OMAP_MCBSP_REG_RBUFFSTAT       0xB8
-#define OMAP_MCBSP_REG_SSELCR  0xBC
+/* McBSP register numbers. Register address offset = num * reg_step */
+enum {
+       /* Common registers */
+       OMAP_MCBSP_REG_SPCR2 = 4,
+       OMAP_MCBSP_REG_SPCR1,
+       OMAP_MCBSP_REG_RCR2,
+       OMAP_MCBSP_REG_RCR1,
+       OMAP_MCBSP_REG_XCR2,
+       OMAP_MCBSP_REG_XCR1,
+       OMAP_MCBSP_REG_SRGR2,
+       OMAP_MCBSP_REG_SRGR1,
+       OMAP_MCBSP_REG_MCR2,
+       OMAP_MCBSP_REG_MCR1,
+       OMAP_MCBSP_REG_RCERA,
+       OMAP_MCBSP_REG_RCERB,
+       OMAP_MCBSP_REG_XCERA,
+       OMAP_MCBSP_REG_XCERB,
+       OMAP_MCBSP_REG_PCR0,
+       OMAP_MCBSP_REG_RCERC,
+       OMAP_MCBSP_REG_RCERD,
+       OMAP_MCBSP_REG_XCERC,
+       OMAP_MCBSP_REG_XCERD,
+       OMAP_MCBSP_REG_RCERE,
+       OMAP_MCBSP_REG_RCERF,
+       OMAP_MCBSP_REG_XCERE,
+       OMAP_MCBSP_REG_XCERF,
+       OMAP_MCBSP_REG_RCERG,
+       OMAP_MCBSP_REG_RCERH,
+       OMAP_MCBSP_REG_XCERG,
+       OMAP_MCBSP_REG_XCERH,
+
+       /* OMAP1-OMAP2420 registers */
+       OMAP_MCBSP_REG_DRR2 = 0,
+       OMAP_MCBSP_REG_DRR1,
+       OMAP_MCBSP_REG_DXR2,
+       OMAP_MCBSP_REG_DXR1,
+
+       /* OMAP2430 and onwards */
+       OMAP_MCBSP_REG_DRR = 0,
+       OMAP_MCBSP_REG_DXR = 2,
+       OMAP_MCBSP_REG_SYSCON = 35,
+       OMAP_MCBSP_REG_THRSH2,
+       OMAP_MCBSP_REG_THRSH1,
+       OMAP_MCBSP_REG_IRQST = 40,
+       OMAP_MCBSP_REG_IRQEN,
+       OMAP_MCBSP_REG_WAKEUPEN,
+       OMAP_MCBSP_REG_XCCR,
+       OMAP_MCBSP_REG_RCCR,
+       OMAP_MCBSP_REG_XBUFFSTAT,
+       OMAP_MCBSP_REG_RBUFFSTAT,
+       OMAP_MCBSP_REG_SSELCR,
+};
 
+/* OMAP3 sidetone control registers */
 #define OMAP_ST_REG_REV                0x00
 #define OMAP_ST_REG_SYSCONFIG  0x10
 #define OMAP_ST_REG_IRQSTATUS  0x18
@@ -146,8 +100,6 @@ static struct platform_device omap_mcbsp##port_nr = {       \
 #define OMAP_ST_REG_SFIRCR     0x28
 #define OMAP_ST_REG_SSELCR     0x2C
 
-#endif
-
 /************************** McBSP SPCR1 bit definitions ***********************/
 #define RRST                   0x0001
 #define RRDY                   0x0002
@@ -344,20 +296,20 @@ typedef enum {
 struct omap_mcbsp_ops {
        void (*request)(unsigned int);
        void (*free)(unsigned int);
-       int (*set_clks_src)(u8, u8);
 };
 
 struct omap_mcbsp_platform_data {
-       unsigned long phys_base;
-       u8 dma_rx_sync, dma_tx_sync;
-       u16 rx_irq, tx_irq;
        struct omap_mcbsp_ops *ops;
-#ifdef CONFIG_ARCH_OMAP3
-       /* Sidetone block for McBSP 2 and 3 */
-       unsigned long phys_base_st;
-#endif
        u16 buffer_size;
-       unsigned int mcbsp_config_type;
+       u8 reg_size;
+       u8 reg_step;
+
+       /* McBSP platform and instance specific features */
+       bool has_wakeup; /* Wakeup capability */
+       bool has_ccr; /* Transceiver has configuration control registers */
+       int (*enable_st_clock)(unsigned int, bool);
+       int (*set_clk_src)(struct device *dev, struct clk *clk, const char *src);
+       int (*mux_signal)(struct device *dev, const char *signal, const char *src);
 };
 
 struct omap_mcbsp_st_data {
@@ -389,14 +341,12 @@ struct omap_mcbsp {
        spinlock_t lock;
        struct omap_mcbsp_platform_data *pdata;
        struct clk *fclk;
-#ifdef CONFIG_ARCH_OMAP3
        struct omap_mcbsp_st_data *st_data;
        int dma_op_mode;
        u16 max_tx_thres;
        u16 max_rx_thres;
-#endif
        void *reg_cache;
-       unsigned int mcbsp_config_type;
+       int reg_cache_size;
 };
 
 /**
@@ -408,16 +358,10 @@ struct omap_mcbsp_dev_attr {
 };
 
 extern struct omap_mcbsp **mcbsp_ptr;
-extern int omap_mcbsp_count, omap_mcbsp_cache_size;
-
-#define omap_mcbsp_check_valid_id(id)  (id < omap_mcbsp_count)
-#define id_to_mcbsp_ptr(id)            mcbsp_ptr[id];
+extern int omap_mcbsp_count;
 
 int omap_mcbsp_init(void);
-void omap_mcbsp_register_board_cfg(struct resource *res, int res_count,
-                       struct omap_mcbsp_platform_data *config, int size);
 void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config);
-#ifdef CONFIG_ARCH_OMAP3
 void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold);
 void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold);
 u16 omap_mcbsp_get_max_tx_threshold(unsigned int id);
@@ -426,18 +370,6 @@ u16 omap_mcbsp_get_fifo_size(unsigned int id);
 u16 omap_mcbsp_get_tx_delay(unsigned int id);
 u16 omap_mcbsp_get_rx_delay(unsigned int id);
 int omap_mcbsp_get_dma_op_mode(unsigned int id);
-#else
-static inline void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
-{ }
-static inline void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
-{ }
-static inline u16 omap_mcbsp_get_max_tx_threshold(unsigned int id) { return 0; }
-static inline u16 omap_mcbsp_get_max_rx_threshold(unsigned int id) { return 0; }
-static inline u16 omap_mcbsp_get_fifo_size(unsigned int id) { return 0; }
-static inline u16 omap_mcbsp_get_tx_delay(unsigned int id) { return 0; }
-static inline u16 omap_mcbsp_get_rx_delay(unsigned int id) { return 0; }
-static inline int omap_mcbsp_get_dma_op_mode(unsigned int id) { return 0; }
-#endif
 int omap_mcbsp_request(unsigned int id);
 void omap_mcbsp_free(unsigned int id);
 void omap_mcbsp_start(unsigned int id, int tx, int rx);
@@ -453,21 +385,11 @@ void omap2_mcbsp1_mux_fsr_src(u8 mux);
 int omap_mcbsp_dma_ch_params(unsigned int id, unsigned int stream);
 int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream);
 
-#ifdef CONFIG_ARCH_OMAP3
 /* Sidetone specific API */
 int omap_st_set_chgain(unsigned int id, int channel, s16 chgain);
 int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain);
 int omap_st_enable(unsigned int id);
 int omap_st_disable(unsigned int id);
 int omap_st_is_enabled(unsigned int id);
-#else
-static inline int omap_st_set_chgain(unsigned int id, int channel,
-                                    s16 chgain) { return 0; }
-static inline int omap_st_get_chgain(unsigned int id, int channel,
-                                    s16 *chgain) { return 0; }
-static inline int omap_st_enable(unsigned int id) { return 0; }
-static inline int omap_st_disable(unsigned int id) { return 0; }
-static inline int omap_st_is_enabled(unsigned int id) {  return 0; }
-#endif
 
 #endif
index ee405b36df4bbb57911c9ebd3c152ce1029d7e8e..12c5b0c345bfdf93b1f6b7c83447b78f50c8454a 100644 (file)
@@ -68,7 +68,7 @@ extern struct device omap_device_parent;
  *
  */
 struct omap_device {
-       struct platform_device          pdev;
+       struct platform_device          *pdev;
        struct omap_hwmod               **hwmods;
        struct omap_device_pm_latency   *pm_lats;
        u32                             dev_wakeup_lat;
@@ -88,25 +88,20 @@ int omap_device_shutdown(struct platform_device *pdev);
 
 /* Core code interface */
 
-int omap_device_count_resources(struct omap_device *od);
-int omap_device_fill_resources(struct omap_device *od, struct resource *res);
-
-struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,
+struct platform_device *omap_device_build(const char *pdev_name, int pdev_id,
                                      struct omap_hwmod *oh, void *pdata,
                                      int pdata_len,
                                      struct omap_device_pm_latency *pm_lats,
                                      int pm_lats_cnt, int is_early_device);
 
-struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
+struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
                                         struct omap_hwmod **oh, int oh_cnt,
                                         void *pdata, int pdata_len,
                                         struct omap_device_pm_latency *pm_lats,
                                         int pm_lats_cnt, int is_early_device);
 
-int omap_device_register(struct omap_device *od);
-int omap_early_device_register(struct omap_device *od);
-
 void __iomem *omap_device_get_rt_va(struct omap_device *od);
+struct device *omap_device_get_by_hwmod_name(const char *oh_name);
 
 /* OMAP PM interface */
 int omap_device_align_pm_lat(struct platform_device *pdev,
@@ -122,11 +117,6 @@ int omap_device_enable_hwmods(struct omap_device *od);
 int omap_device_disable_clocks(struct omap_device *od);
 int omap_device_enable_clocks(struct omap_device *od);
 
-static inline void omap_device_disable_idle_on_suspend(struct omap_device *od)
-{
-       od->flags |= OMAP_DEVICE_NO_IDLE_ON_SUSPEND;
-}
-
 /*
  * Entries should be kept in latency order ascending
  *
@@ -157,6 +147,17 @@ struct omap_device_pm_latency {
 #define OMAP_DEVICE_LATENCY_AUTO_ADJUST BIT(1)
 
 /* Get omap_device pointer from platform_device pointer */
-#define to_omap_device(x) container_of((x), struct omap_device, pdev)
+static inline struct omap_device *to_omap_device(struct platform_device *pdev)
+{
+       return pdev ? pdev->archdata.od : NULL;
+}
+
+static inline
+void omap_device_disable_idle_on_suspend(struct platform_device *pdev)
+{
+       struct omap_device *od = to_omap_device(pdev);
+
+       od->flags |= OMAP_DEVICE_NO_IDLE_ON_SUSPEND;
+}
 
 #endif
index 0e329ca88a70f8d56acd8d35ac053e51bd185623..5419f1a2aaa432622ad377d6d56fb1438aa1b944 100644 (file)
@@ -496,7 +496,6 @@ struct omap_hwmod_class {
  * @_state: internal-use hwmod state
  * @_postsetup_state: internal-use state to leave the hwmod in after _setup()
  * @flags: hwmod flags (documented below)
- * @omap_chip: OMAP chips this hwmod is present on
  * @_lock: spinlock serializing operations on this hwmod
  * @node: list node for hwmod list (internal use)
  *
@@ -526,7 +525,6 @@ struct omap_hwmod {
        char                            *clkdm_name;
        struct clockdomain              *clkdm;
        char                            *vdd_name;
-       struct voltagedomain            *voltdm;
        struct omap_hwmod_ocp_if        **masters; /* connect to *_IA */
        struct omap_hwmod_ocp_if        **slaves;  /* connect to *_TA */
        void                            *dev_attr;
@@ -545,7 +543,6 @@ struct omap_hwmod {
        u8                              _int_flags;
        u8                              _state;
        u8                              _postsetup_state;
-       const struct omap_chip_id       omap_chip;
 };
 
 int omap_hwmod_register(struct omap_hwmod **ohs);
diff --git a/arch/arm/plat-omap/include/plat/voltage.h b/arch/arm/plat-omap/include/plat/voltage.h
new file mode 100644 (file)
index 0000000..0a6a482
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * OMAP Voltage Management Routines
+ *
+ * Copyright (C) 2011, Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __ARCH_ARM_OMAP_VOLTAGE_H
+#define __ARCH_ARM_OMAP_VOLTAGE_H
+
+struct voltagedomain;
+
+struct voltagedomain *voltdm_lookup(const char *name);
+int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt);
+unsigned long voltdm_get_voltage(struct voltagedomain *voltdm);
+
+#endif
index 6c62af108710c89fc6f36e814bbf36beec338fb8..4b15cd7926d7e974a61111d141943ea22b7e697c 100644 (file)
 #include <linux/slab.h>
 
 #include <plat/mcbsp.h>
-#include <plat/omap_device.h>
 #include <linux/pm_runtime.h>
 
-/* XXX These "sideways" includes are a sign that something is wrong */
-#include "../mach-omap2/cm2xxx_3xxx.h"
-#include "../mach-omap2/cm-regbits-34xx.h"
-
 struct omap_mcbsp **mcbsp_ptr;
-int omap_mcbsp_count, omap_mcbsp_cache_size;
+int omap_mcbsp_count;
+
+#define omap_mcbsp_check_valid_id(id)  (id < omap_mcbsp_count)
+#define id_to_mcbsp_ptr(id)            mcbsp_ptr[id];
 
 static void omap_mcbsp_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val)
 {
-       if (cpu_class_is_omap1()) {
-               ((u16 *)mcbsp->reg_cache)[reg / sizeof(u16)] = (u16)val;
-               __raw_writew((u16)val, mcbsp->io_base + reg);
-       } else if (cpu_is_omap2420()) {
-               ((u16 *)mcbsp->reg_cache)[reg / sizeof(u32)] = (u16)val;
-               __raw_writew((u16)val, mcbsp->io_base + reg);
+       void __iomem *addr = mcbsp->io_base + reg * mcbsp->pdata->reg_step;
+
+       if (mcbsp->pdata->reg_size == 2) {
+               ((u16 *)mcbsp->reg_cache)[reg] = (u16)val;
+               __raw_writew((u16)val, addr);
        } else {
-               ((u32 *)mcbsp->reg_cache)[reg / sizeof(u32)] = val;
-               __raw_writel(val, mcbsp->io_base + reg);
+               ((u32 *)mcbsp->reg_cache)[reg] = val;
+               __raw_writel(val, addr);
        }
 }
 
 static int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg, bool from_cache)
 {
-       if (cpu_class_is_omap1()) {
-               return !from_cache ? __raw_readw(mcbsp->io_base + reg) :
-                               ((u16 *)mcbsp->reg_cache)[reg / sizeof(u16)];
-       } else if (cpu_is_omap2420()) {
-               return !from_cache ? __raw_readw(mcbsp->io_base + reg) :
-                               ((u16 *)mcbsp->reg_cache)[reg / sizeof(u32)];
+       void __iomem *addr = mcbsp->io_base + reg * mcbsp->pdata->reg_step;
+
+       if (mcbsp->pdata->reg_size == 2) {
+               return !from_cache ? __raw_readw(addr) :
+                                    ((u16 *)mcbsp->reg_cache)[reg];
        } else {
-               return !from_cache ? __raw_readl(mcbsp->io_base + reg) :
-                               ((u32 *)mcbsp->reg_cache)[reg / sizeof(u32)];
+               return !from_cache ? __raw_readl(addr) :
+                                    ((u32 *)mcbsp->reg_cache)[reg];
        }
 }
 
-#ifdef CONFIG_ARCH_OMAP3
 static void omap_mcbsp_st_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val)
 {
        __raw_writel(val, mcbsp->st_data->io_base_st + reg);
@@ -72,7 +67,6 @@ static int omap_mcbsp_st_read(struct omap_mcbsp *mcbsp, u16 reg)
 {
        return __raw_readl(mcbsp->st_data->io_base_st + reg);
 }
-#endif
 
 #define MCBSP_READ(mcbsp, reg) \
                omap_mcbsp_read(mcbsp, OMAP_MCBSP_REG_##reg, 0)
@@ -187,7 +181,7 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
        MCBSP_WRITE(mcbsp, MCR2, config->mcr2);
        MCBSP_WRITE(mcbsp, MCR1, config->mcr1);
        MCBSP_WRITE(mcbsp, PCR0, config->pcr0);
-       if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
+       if (mcbsp->pdata->has_ccr) {
                MCBSP_WRITE(mcbsp, XCCR, config->xccr);
                MCBSP_WRITE(mcbsp, RCCR, config->rccr);
        }
@@ -239,46 +233,28 @@ int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream)
        }
        mcbsp = id_to_mcbsp_ptr(id);
 
-       data_reg = mcbsp->phys_dma_base;
-
-       if (mcbsp->mcbsp_config_type < MCBSP_CONFIG_TYPE2) {
+       if (mcbsp->pdata->reg_size == 2) {
                if (stream)
-                       data_reg += OMAP_MCBSP_REG_DRR1;
+                       data_reg = OMAP_MCBSP_REG_DRR1;
                else
-                       data_reg += OMAP_MCBSP_REG_DXR1;
+                       data_reg = OMAP_MCBSP_REG_DXR1;
        } else {
                if (stream)
-                       data_reg += OMAP_MCBSP_REG_DRR;
+                       data_reg = OMAP_MCBSP_REG_DRR;
                else
-                       data_reg += OMAP_MCBSP_REG_DXR;
+                       data_reg = OMAP_MCBSP_REG_DXR;
        }
 
-       return data_reg;
+       return mcbsp->phys_dma_base + data_reg * mcbsp->pdata->reg_step;
 }
 EXPORT_SYMBOL(omap_mcbsp_dma_reg_params);
 
-#ifdef CONFIG_ARCH_OMAP3
-static struct omap_device *find_omap_device_by_dev(struct device *dev)
-{
-       struct platform_device *pdev = container_of(dev,
-                                       struct platform_device, dev);
-       return container_of(pdev, struct omap_device, pdev);
-}
-
 static void omap_st_on(struct omap_mcbsp *mcbsp)
 {
        unsigned int w;
-       struct omap_device *od;
 
-       od = find_omap_device_by_dev(mcbsp->dev);
-
-       /*
-        * Sidetone uses McBSP ICLK - which must not idle when sidetones
-        * are enabled or sidetones start sounding ugly.
-        */
-       w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
-       w &= ~(1 << (mcbsp->id - 2));
-       omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
+       if (mcbsp->pdata->enable_st_clock)
+               mcbsp->pdata->enable_st_clock(mcbsp->id, 1);
 
        /* Enable McBSP Sidetone */
        w = MCBSP_READ(mcbsp, SSELCR);
@@ -292,9 +268,6 @@ static void omap_st_on(struct omap_mcbsp *mcbsp)
 static void omap_st_off(struct omap_mcbsp *mcbsp)
 {
        unsigned int w;
-       struct omap_device *od;
-
-       od = find_omap_device_by_dev(mcbsp->dev);
 
        w = MCBSP_ST_READ(mcbsp, SSELCR);
        MCBSP_ST_WRITE(mcbsp, SSELCR, w & ~(ST_SIDETONEEN));
@@ -302,17 +275,13 @@ static void omap_st_off(struct omap_mcbsp *mcbsp)
        w = MCBSP_READ(mcbsp, SSELCR);
        MCBSP_WRITE(mcbsp, SSELCR, w & ~(SIDETONEEN));
 
-       w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
-       w |= 1 << (mcbsp->id - 2);
-       omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
+       if (mcbsp->pdata->enable_st_clock)
+               mcbsp->pdata->enable_st_clock(mcbsp->id, 0);
 }
 
 static void omap_st_fir_write(struct omap_mcbsp *mcbsp, s16 *fir)
 {
        u16 val, i;
-       struct omap_device *od;
-
-       od = find_omap_device_by_dev(mcbsp->dev);
 
        val = MCBSP_ST_READ(mcbsp, SSELCR);
 
@@ -340,9 +309,6 @@ static void omap_st_chgain(struct omap_mcbsp *mcbsp)
 {
        u16 w;
        struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
-       struct omap_device *od;
-
-       od = find_omap_device_by_dev(mcbsp->dev);
 
        w = MCBSP_ST_READ(mcbsp, SSELCR);
 
@@ -525,14 +491,13 @@ void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
 {
        struct omap_mcbsp *mcbsp;
 
-       if (!cpu_is_omap34xx() && !cpu_is_omap44xx())
-               return;
-
        if (!omap_mcbsp_check_valid_id(id)) {
                printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
                return;
        }
        mcbsp = id_to_mcbsp_ptr(id);
+       if (mcbsp->pdata->buffer_size == 0)
+               return;
 
        if (threshold && threshold <= mcbsp->max_tx_thres)
                MCBSP_WRITE(mcbsp, THRSH2, threshold - 1);
@@ -548,14 +513,13 @@ void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
 {
        struct omap_mcbsp *mcbsp;
 
-       if (!cpu_is_omap34xx() && !cpu_is_omap44xx())
-               return;
-
        if (!omap_mcbsp_check_valid_id(id)) {
                printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
                return;
        }
        mcbsp = id_to_mcbsp_ptr(id);
+       if (mcbsp->pdata->buffer_size == 0)
+               return;
 
        if (threshold && threshold <= mcbsp->max_rx_thres)
                MCBSP_WRITE(mcbsp, THRSH1, threshold - 1);
@@ -625,6 +589,8 @@ u16 omap_mcbsp_get_tx_delay(unsigned int id)
                return -ENODEV;
        }
        mcbsp = id_to_mcbsp_ptr(id);
+       if (mcbsp->pdata->buffer_size == 0)
+               return 0;
 
        /* Returns the number of free locations in the buffer */
        buffstat = MCBSP_READ(mcbsp, XBUFFSTAT);
@@ -648,6 +614,8 @@ u16 omap_mcbsp_get_rx_delay(unsigned int id)
                return -ENODEV;
        }
        mcbsp = id_to_mcbsp_ptr(id);
+       if (mcbsp->pdata->buffer_size == 0)
+               return 0;
 
        /* Returns the number of used locations in the buffer */
        buffstat = MCBSP_READ(mcbsp, RBUFFSTAT);
@@ -683,46 +651,6 @@ int omap_mcbsp_get_dma_op_mode(unsigned int id)
 }
 EXPORT_SYMBOL(omap_mcbsp_get_dma_op_mode);
 
-static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp)
-{
-       struct omap_device *od;
-
-       od = find_omap_device_by_dev(mcbsp->dev);
-       /*
-        * Enable wakup behavior, smart idle and all wakeups
-        * REVISIT: some wakeups may be unnecessary
-        */
-       if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
-               MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN);
-       }
-}
-
-static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp)
-{
-       struct omap_device *od;
-
-       od = find_omap_device_by_dev(mcbsp->dev);
-
-       /*
-        * Disable wakup behavior, smart idle and all wakeups
-        */
-       if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
-               /*
-                * HW bug workaround - If no_idle mode is taken, we need to
-                * go to smart_idle before going to always_idle, or the
-                * device will not hit retention anymore.
-                */
-
-               MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
-       }
-}
-#else
-static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp) {}
-static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp) {}
-static inline void omap_st_start(struct omap_mcbsp *mcbsp) {}
-static inline void omap_st_stop(struct omap_mcbsp *mcbsp) {}
-#endif
-
 int omap_mcbsp_request(unsigned int id)
 {
        struct omap_mcbsp *mcbsp;
@@ -735,7 +663,7 @@ int omap_mcbsp_request(unsigned int id)
        }
        mcbsp = id_to_mcbsp_ptr(id);
 
-       reg_cache = kzalloc(omap_mcbsp_cache_size, GFP_KERNEL);
+       reg_cache = kzalloc(mcbsp->reg_cache_size, GFP_KERNEL);
        if (!reg_cache) {
                return -ENOMEM;
        }
@@ -757,8 +685,9 @@ int omap_mcbsp_request(unsigned int id)
 
        pm_runtime_get_sync(mcbsp->dev);
 
-       /* Do procedure specific to omap34xx arch, if applicable */
-       omap34xx_mcbsp_request(mcbsp);
+       /* Enable wakeup behavior */
+       if (mcbsp->pdata->has_wakeup)
+               MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN);
 
        /*
         * Make sure that transmitter, receiver and sample-rate generator are
@@ -795,8 +724,9 @@ err_clk_disable:
        if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
                mcbsp->pdata->ops->free(id);
 
-       /* Do procedure specific to omap34xx arch, if applicable */
-       omap34xx_mcbsp_free(mcbsp);
+       /* Disable wakeup behavior */
+       if (mcbsp->pdata->has_wakeup)
+               MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
 
        pm_runtime_put_sync(mcbsp->dev);
 
@@ -825,8 +755,9 @@ void omap_mcbsp_free(unsigned int id)
        if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
                mcbsp->pdata->ops->free(id);
 
-       /* Do procedure specific to omap34xx arch, if applicable */
-       omap34xx_mcbsp_free(mcbsp);
+       /* Disable wakeup behavior */
+       if (mcbsp->pdata->has_wakeup)
+               MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
 
        pm_runtime_put_sync(mcbsp->dev);
 
@@ -866,7 +797,7 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
        }
        mcbsp = id_to_mcbsp_ptr(id);
 
-       if (cpu_is_omap34xx())
+       if (mcbsp->st_data)
                omap_st_start(mcbsp);
 
        /* Only enable SRG, if McBSP is master */
@@ -904,7 +835,7 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
                MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 7));
        }
 
-       if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
+       if (mcbsp->pdata->has_ccr) {
                /* Release the transmitter and receiver */
                w = MCBSP_READ_CACHE(mcbsp, XCCR);
                w &= ~(tx ? XDISABLE : 0);
@@ -934,7 +865,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
 
        /* Reset transmitter */
        tx &= 1;
-       if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
+       if (mcbsp->pdata->has_ccr) {
                w = MCBSP_READ_CACHE(mcbsp, XCCR);
                w |= (tx ? XDISABLE : 0);
                MCBSP_WRITE(mcbsp, XCCR, w);
@@ -944,7 +875,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
 
        /* Reset receiver */
        rx &= 1;
-       if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
+       if (mcbsp->pdata->has_ccr) {
                w = MCBSP_READ_CACHE(mcbsp, RCCR);
                w |= (rx ? RDISABLE : 0);
                MCBSP_WRITE(mcbsp, RCCR, w);
@@ -961,39 +892,72 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
                MCBSP_WRITE(mcbsp, SPCR2, w & ~(1 << 6));
        }
 
-       if (cpu_is_omap34xx())
+       if (mcbsp->st_data)
                omap_st_stop(mcbsp);
 }
 EXPORT_SYMBOL(omap_mcbsp_stop);
 
-/*
- * The following functions are only required on an OMAP1-only build.
- * mach-omap2/mcbsp.c contains the real functions
- */
-#ifndef CONFIG_ARCH_OMAP2PLUS
 int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id)
 {
-       WARN(1, "%s: should never be called on an OMAP1-only kernel\n",
-            __func__);
-       return -EINVAL;
+       struct omap_mcbsp *mcbsp;
+       const char *src;
+
+       if (!omap_mcbsp_check_valid_id(id)) {
+               pr_err("%s: Invalid id (%d)\n", __func__, id + 1);
+               return -EINVAL;
+       }
+       mcbsp = id_to_mcbsp_ptr(id);
+
+       if (fck_src_id == MCBSP_CLKS_PAD_SRC)
+               src = "clks_ext";
+       else if (fck_src_id == MCBSP_CLKS_PRCM_SRC)
+               src = "clks_fclk";
+       else
+               return -EINVAL;
+
+       if (mcbsp->pdata->set_clk_src)
+               return mcbsp->pdata->set_clk_src(mcbsp->dev, mcbsp->fclk, src);
+       else
+               return -EINVAL;
 }
+EXPORT_SYMBOL(omap2_mcbsp_set_clks_src);
 
 void omap2_mcbsp1_mux_clkr_src(u8 mux)
 {
-       WARN(1, "%s: should never be called on an OMAP1-only kernel\n",
-            __func__);
-       return;
+       struct omap_mcbsp *mcbsp;
+       const char *src;
+
+       if (mux == CLKR_SRC_CLKR)
+               src = "clkr";
+       else if (mux == CLKR_SRC_CLKX)
+               src = "clkx";
+       else
+               return;
+
+       mcbsp = id_to_mcbsp_ptr(0);
+       if (mcbsp->pdata->mux_signal)
+               mcbsp->pdata->mux_signal(mcbsp->dev, "clkr", src);
 }
+EXPORT_SYMBOL(omap2_mcbsp1_mux_clkr_src);
 
 void omap2_mcbsp1_mux_fsr_src(u8 mux)
 {
-       WARN(1, "%s: should never be called on an OMAP1-only kernel\n",
-            __func__);
-       return;
+       struct omap_mcbsp *mcbsp;
+       const char *src;
+
+       if (mux == FSR_SRC_FSR)
+               src = "fsr";
+       else if (mux == FSR_SRC_FSX)
+               src = "fsx";
+       else
+               return;
+
+       mcbsp = id_to_mcbsp_ptr(0);
+       if (mcbsp->pdata->mux_signal)
+               mcbsp->pdata->mux_signal(mcbsp->dev, "fsr", src);
 }
-#endif
+EXPORT_SYMBOL(omap2_mcbsp1_mux_fsr_src);
 
-#ifdef CONFIG_ARCH_OMAP3
 #define max_thres(m)                   (mcbsp->pdata->buffer_size)
 #define valid_threshold(m, val)                ((val) <= max_thres(m))
 #define THRESHOLD_PROP_BUILDER(prop)                                   \
@@ -1084,6 +1048,17 @@ unlock:
 
 static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
 
+static const struct attribute *additional_attrs[] = {
+       &dev_attr_max_tx_thres.attr,
+       &dev_attr_max_rx_thres.attr,
+       &dev_attr_dma_op_mode.attr,
+       NULL,
+};
+
+static const struct attribute_group additional_attr_group = {
+       .attrs = (struct attribute **)additional_attrs,
+};
+
 static ssize_t st_taps_show(struct device *dev,
                            struct device_attribute *attr, char *buf)
 {
@@ -1142,27 +1117,6 @@ out:
 
 static DEVICE_ATTR(st_taps, 0644, st_taps_show, st_taps_store);
 
-static const struct attribute *additional_attrs[] = {
-       &dev_attr_max_tx_thres.attr,
-       &dev_attr_max_rx_thres.attr,
-       &dev_attr_dma_op_mode.attr,
-       NULL,
-};
-
-static const struct attribute_group additional_attr_group = {
-       .attrs = (struct attribute **)additional_attrs,
-};
-
-static inline int __devinit omap_additional_add(struct device *dev)
-{
-       return sysfs_create_group(&dev->kobj, &additional_attr_group);
-}
-
-static inline void __devexit omap_additional_remove(struct device *dev)
-{
-       sysfs_remove_group(&dev->kobj, &additional_attr_group);
-}
-
 static const struct attribute *sidetone_attrs[] = {
        &dev_attr_st_taps.attr,
        NULL,
@@ -1172,10 +1126,9 @@ static const struct attribute_group sidetone_attr_group = {
        .attrs = (struct attribute **)sidetone_attrs,
 };
 
-static int __devinit omap_st_add(struct omap_mcbsp *mcbsp)
+static int __devinit omap_st_add(struct omap_mcbsp *mcbsp,
+                                struct resource *res)
 {
-       struct platform_device *pdev;
-       struct resource *res;
        struct omap_mcbsp_st_data *st_data;
        int err;
 
@@ -1185,9 +1138,6 @@ static int __devinit omap_st_add(struct omap_mcbsp *mcbsp)
                goto err1;
        }
 
-       pdev = container_of(mcbsp->dev, struct platform_device, dev);
-
-       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sidetone");
        st_data->io_base_st = ioremap(res->start, resource_size(res));
        if (!st_data->io_base_st) {
                err = -ENOMEM;
@@ -1214,59 +1164,10 @@ static void __devexit omap_st_remove(struct omap_mcbsp *mcbsp)
 {
        struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
 
-       if (st_data) {
-               sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group);
-               iounmap(st_data->io_base_st);
-               kfree(st_data);
-       }
-}
-
-static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp)
-{
-       mcbsp->dma_op_mode = MCBSP_DMA_MODE_ELEMENT;
-       if (cpu_is_omap34xx()) {
-               /*
-                * Initially configure the maximum thresholds to a safe value.
-                * The McBSP FIFO usage with these values should not go under
-                * 16 locations.
-                * If the whole FIFO without safety buffer is used, than there
-                * is a possibility that the DMA will be not able to push the
-                * new data on time, causing channel shifts in runtime.
-                */
-               mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10;
-               mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10;
-               /*
-                * REVISIT: Set dmap_op_mode to THRESHOLD as default
-                * for mcbsp2 instances.
-                */
-               if (omap_additional_add(mcbsp->dev))
-                       dev_warn(mcbsp->dev,
-                               "Unable to create additional controls\n");
-
-               if (mcbsp->id == 2 || mcbsp->id == 3)
-                       if (omap_st_add(mcbsp))
-                               dev_warn(mcbsp->dev,
-                                "Unable to create sidetone controls\n");
-
-       } else {
-               mcbsp->max_tx_thres = -EINVAL;
-               mcbsp->max_rx_thres = -EINVAL;
-       }
-}
-
-static inline void __devexit omap34xx_device_exit(struct omap_mcbsp *mcbsp)
-{
-       if (cpu_is_omap34xx()) {
-               omap_additional_remove(mcbsp->dev);
-
-               if (mcbsp->id == 2 || mcbsp->id == 3)
-                       omap_st_remove(mcbsp);
-       }
+       sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group);
+       iounmap(st_data->io_base_st);
+       kfree(st_data);
 }
-#else
-static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp) {}
-static inline void __devexit omap34xx_device_exit(struct omap_mcbsp *mcbsp) {}
-#endif /* CONFIG_ARCH_OMAP3 */
 
 /*
  * McBSP1 and McBSP3 are directly mapped on 1610 and 1510.
@@ -1316,7 +1217,7 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev)
                }
        }
        mcbsp->phys_base = res->start;
-       omap_mcbsp_cache_size = resource_size(res);
+       mcbsp->reg_cache_size = resource_size(res);
        mcbsp->io_base = ioremap(res->start, resource_size(res));
        if (!mcbsp->io_base) {
                ret = -ENOMEM;
@@ -1364,15 +1265,52 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev)
        mcbsp->pdata = pdata;
        mcbsp->dev = &pdev->dev;
        mcbsp_ptr[id] = mcbsp;
-       mcbsp->mcbsp_config_type = pdata->mcbsp_config_type;
        platform_set_drvdata(pdev, mcbsp);
        pm_runtime_enable(mcbsp->dev);
 
-       /* Initialize mcbsp properties for OMAP34XX if needed / applicable */
-       omap34xx_device_init(mcbsp);
+       mcbsp->dma_op_mode = MCBSP_DMA_MODE_ELEMENT;
+       if (mcbsp->pdata->buffer_size) {
+               /*
+                * Initially configure the maximum thresholds to a safe value.
+                * The McBSP FIFO usage with these values should not go under
+                * 16 locations.
+                * If the whole FIFO without safety buffer is used, than there
+                * is a possibility that the DMA will be not able to push the
+                * new data on time, causing channel shifts in runtime.
+                */
+               mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10;
+               mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10;
+
+               ret = sysfs_create_group(&mcbsp->dev->kobj,
+                                        &additional_attr_group);
+               if (ret) {
+                       dev_err(mcbsp->dev,
+                               "Unable to create additional controls\n");
+                       goto err_thres;
+               }
+       } else {
+               mcbsp->max_tx_thres = -EINVAL;
+               mcbsp->max_rx_thres = -EINVAL;
+       }
+
+       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sidetone");
+       if (res) {
+               ret = omap_st_add(mcbsp, res);
+               if (ret) {
+                       dev_err(mcbsp->dev,
+                               "Unable to create sidetone controls\n");
+                       goto err_st;
+               }
+       }
 
        return 0;
 
+err_st:
+       if (mcbsp->pdata->buffer_size)
+               sysfs_remove_group(&mcbsp->dev->kobj,
+                                  &additional_attr_group);
+err_thres:
+       clk_put(mcbsp->fclk);
 err_res:
        iounmap(mcbsp->io_base);
 err_ioremap:
@@ -1392,7 +1330,12 @@ static int __devexit omap_mcbsp_remove(struct platform_device *pdev)
                                mcbsp->pdata->ops->free)
                        mcbsp->pdata->ops->free(mcbsp->id);
 
-               omap34xx_device_exit(mcbsp);
+               if (mcbsp->pdata->buffer_size)
+                       sysfs_remove_group(&mcbsp->dev->kobj,
+                                          &additional_attr_group);
+
+               if (mcbsp->st_data)
+                       omap_st_remove(mcbsp);
 
                clk_put(mcbsp->fclk);
 
index 02609eee05621ab682de81d0fd215972dffbb158..cd90bedd9306fb6389d5f9eef0d6061db1c02076 100644 (file)
@@ -85,6 +85,8 @@
 #include <linux/clk.h>
 #include <linux/clkdev.h>
 #include <linux/pm_runtime.h>
+#include <linux/of.h>
+#include <linux/notifier.h>
 
 #include <plat/omap_device.h>
 #include <plat/omap_hwmod.h>
 #define USE_WAKEUP_LAT                 0
 #define IGNORE_WAKEUP_LAT              1
 
+static int omap_device_register(struct platform_device *pdev);
+static int omap_early_device_register(struct platform_device *pdev);
+static struct omap_device *omap_device_alloc(struct platform_device *pdev,
+                                     struct omap_hwmod **ohs, int oh_cnt,
+                                     struct omap_device_pm_latency *pm_lats,
+                                     int pm_lats_cnt);
+static void omap_device_delete(struct omap_device *od);
+
+
+static struct omap_device_pm_latency omap_default_latency[] = {
+       {
+               .deactivate_func = omap_device_idle_hwmods,
+               .activate_func   = omap_device_enable_hwmods,
+               .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+       }
+};
+
 /* Private functions */
 
 /**
@@ -114,7 +133,7 @@ static int _omap_device_activate(struct omap_device *od, u8 ignore_lat)
 {
        struct timespec a, b, c;
 
-       pr_debug("omap_device: %s: activating\n", od->pdev.name);
+       dev_dbg(&od->pdev->dev, "omap_device: activating\n");
 
        while (od->pm_lat_level > 0) {
                struct omap_device_pm_latency *odpl;
@@ -138,25 +157,24 @@ static int _omap_device_activate(struct omap_device *od, u8 ignore_lat)
                c = timespec_sub(b, a);
                act_lat = timespec_to_ns(&c);
 
-               pr_debug("omap_device: %s: pm_lat %d: activate: elapsed time "
-                        "%llu nsec\n", od->pdev.name, od->pm_lat_level,
-                        act_lat);
+               dev_dbg(&od->pdev->dev,
+                       "omap_device: pm_lat %d: activate: elapsed time "
+                       "%llu nsec\n", od->pm_lat_level, act_lat);
 
                if (act_lat > odpl->activate_lat) {
                        odpl->activate_lat_worst = act_lat;
                        if (odpl->flags & OMAP_DEVICE_LATENCY_AUTO_ADJUST) {
                                odpl->activate_lat = act_lat;
-                               pr_warning("omap_device: %s.%d: new worst case "
-                                          "activate latency %d: %llu\n",
-                                          od->pdev.name, od->pdev.id,
-                                          od->pm_lat_level, act_lat);
+                               dev_dbg(&od->pdev->dev,
+                                       "new worst case activate latency "
+                                       "%d: %llu\n",
+                                       od->pm_lat_level, act_lat);
                        } else
-                               pr_warning("omap_device: %s.%d: activate "
-                                          "latency %d higher than exptected. "
-                                          "(%llu > %d)\n",
-                                          od->pdev.name, od->pdev.id,
-                                          od->pm_lat_level, act_lat,
-                                          odpl->activate_lat);
+                               dev_warn(&od->pdev->dev,
+                                        "activate latency %d "
+                                        "higher than exptected. (%llu > %d)\n",
+                                        od->pm_lat_level, act_lat,
+                                        odpl->activate_lat);
                }
 
                od->dev_wakeup_lat -= odpl->activate_lat;
@@ -183,7 +201,7 @@ static int _omap_device_deactivate(struct omap_device *od, u8 ignore_lat)
 {
        struct timespec a, b, c;
 
-       pr_debug("omap_device: %s: deactivating\n", od->pdev.name);
+       dev_dbg(&od->pdev->dev, "omap_device: deactivating\n");
 
        while (od->pm_lat_level < od->pm_lats_cnt) {
                struct omap_device_pm_latency *odpl;
@@ -206,28 +224,26 @@ static int _omap_device_deactivate(struct omap_device *od, u8 ignore_lat)
                c = timespec_sub(b, a);
                deact_lat = timespec_to_ns(&c);
 
-               pr_debug("omap_device: %s: pm_lat %d: deactivate: elapsed time "
-                        "%llu nsec\n", od->pdev.name, od->pm_lat_level,
-                        deact_lat);
+               dev_dbg(&od->pdev->dev,
+                       "omap_device: pm_lat %d: deactivate: elapsed time "
+                       "%llu nsec\n", od->pm_lat_level, deact_lat);
 
                if (deact_lat > odpl->deactivate_lat) {
                        odpl->deactivate_lat_worst = deact_lat;
                        if (odpl->flags & OMAP_DEVICE_LATENCY_AUTO_ADJUST) {
                                odpl->deactivate_lat = deact_lat;
-                               pr_warning("omap_device: %s.%d: new worst case "
-                                          "deactivate latency %d: %llu\n",
-                                          od->pdev.name, od->pdev.id,
-                                          od->pm_lat_level, deact_lat);
+                               dev_dbg(&od->pdev->dev,
+                                       "new worst case deactivate latency "
+                                       "%d: %llu\n",
+                                       od->pm_lat_level, deact_lat);
                        } else
-                               pr_warning("omap_device: %s.%d: deactivate "
-                                          "latency %d higher than exptected. "
-                                          "(%llu > %d)\n",
-                                          od->pdev.name, od->pdev.id,
-                                          od->pm_lat_level, deact_lat,
-                                          odpl->deactivate_lat);
+                               dev_warn(&od->pdev->dev,
+                                        "deactivate latency %d "
+                                        "higher than exptected. (%llu > %d)\n",
+                                        od->pm_lat_level, deact_lat,
+                                        odpl->deactivate_lat);
                }
 
-
                od->dev_wakeup_lat += odpl->activate_lat;
 
                od->pm_lat_level++;
@@ -245,28 +261,27 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
        if (!clk_alias || !clk_name)
                return;
 
-       pr_debug("omap_device: %s: Creating %s -> %s\n",
-                dev_name(&od->pdev.dev), clk_alias, clk_name);
+       dev_dbg(&od->pdev->dev, "Creating %s -> %s\n", clk_alias, clk_name);
 
-       r = clk_get_sys(dev_name(&od->pdev.dev), clk_alias);
+       r = clk_get_sys(dev_name(&od->pdev->dev), clk_alias);
        if (!IS_ERR(r)) {
-               pr_warning("omap_device: %s: alias %s already exists\n",
-                          dev_name(&od->pdev.dev), clk_alias);
+               dev_warn(&od->pdev->dev,
+                        "alias %s already exists\n", clk_alias);
                clk_put(r);
                return;
        }
 
        r = omap_clk_get_by_name(clk_name);
        if (IS_ERR(r)) {
-               pr_err("omap_device: %s: omap_clk_get_by_name for %s failed\n",
-                      dev_name(&od->pdev.dev), clk_name);
+               dev_err(&od->pdev->dev,
+                       "omap_clk_get_by_name for %s failed\n", clk_name);
                return;
        }
 
-       l = clkdev_alloc(r, clk_alias, dev_name(&od->pdev.dev));
+       l = clkdev_alloc(r, clk_alias, dev_name(&od->pdev->dev));
        if (!l) {
-               pr_err("omap_device: %s: clkdev_alloc for %s failed\n",
-                      dev_name(&od->pdev.dev), clk_alias);
+               dev_err(&od->pdev->dev,
+                       "clkdev_alloc for %s failed\n", clk_alias);
                return;
        }
 
@@ -304,6 +319,96 @@ static void _add_hwmod_clocks_clkdev(struct omap_device *od,
 }
 
 
+static struct dev_pm_domain omap_device_pm_domain;
+
+/**
+ * omap_device_build_from_dt - build an omap_device with multiple hwmods
+ * @pdev_name: name of the platform_device driver to use
+ * @pdev_id: this platform_device's connection ID
+ * @oh: ptr to the single omap_hwmod that backs this omap_device
+ * @pdata: platform_data ptr to associate with the platform_device
+ * @pdata_len: amount of memory pointed to by @pdata
+ * @pm_lats: pointer to a omap_device_pm_latency array for this device
+ * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats
+ * @is_early_device: should the device be registered as an early device or not
+ *
+ * Function for building an omap_device already registered from device-tree
+ *
+ * Returns 0 or PTR_ERR() on error.
+ */
+static int omap_device_build_from_dt(struct platform_device *pdev)
+{
+       struct omap_hwmod **hwmods;
+       struct omap_device *od;
+       struct omap_hwmod *oh;
+       struct device_node *node = pdev->dev.of_node;
+       const char *oh_name;
+       int oh_cnt, i, ret = 0;
+
+       oh_cnt = of_property_count_strings(node, "ti,hwmods");
+       if (!oh_cnt || IS_ERR_VALUE(oh_cnt)) {
+               dev_warn(&pdev->dev, "No 'hwmods' to build omap_device\n");
+               return -ENODEV;
+       }
+
+       hwmods = kzalloc(sizeof(struct omap_hwmod *) * oh_cnt, GFP_KERNEL);
+       if (!hwmods) {
+               ret = -ENOMEM;
+               goto odbfd_exit;
+       }
+
+       for (i = 0; i < oh_cnt; i++) {
+               of_property_read_string_index(node, "ti,hwmods", i, &oh_name);
+               oh = omap_hwmod_lookup(oh_name);
+               if (!oh) {
+                       dev_err(&pdev->dev, "Cannot lookup hwmod '%s'\n",
+                               oh_name);
+                       ret = -EINVAL;
+                       goto odbfd_exit1;
+               }
+               hwmods[i] = oh;
+       }
+
+       od = omap_device_alloc(pdev, hwmods, oh_cnt, NULL, 0);
+       if (!od) {
+               dev_err(&pdev->dev, "Cannot allocate omap_device for :%s\n",
+                       oh_name);
+               ret = PTR_ERR(od);
+               goto odbfd_exit1;
+       }
+
+       if (of_get_property(node, "ti,no_idle_on_suspend", NULL))
+               omap_device_disable_idle_on_suspend(pdev);
+
+       pdev->dev.pm_domain = &omap_device_pm_domain;
+
+odbfd_exit1:
+       kfree(hwmods);
+odbfd_exit:
+       return ret;
+}
+
+static int _omap_device_notifier_call(struct notifier_block *nb,
+                                     unsigned long event, void *dev)
+{
+       struct platform_device *pdev = to_platform_device(dev);
+
+       switch (event) {
+       case BUS_NOTIFY_ADD_DEVICE:
+               if (pdev->dev.of_node)
+                       omap_device_build_from_dt(pdev);
+               break;
+
+       case BUS_NOTIFY_DEL_DEVICE:
+               if (pdev->archdata.od)
+                       omap_device_delete(pdev->archdata.od);
+               break;
+       }
+
+       return NOTIFY_DONE;
+}
+
+
 /* Public functions for use by core code */
 
 /**
@@ -343,7 +448,7 @@ u32 omap_device_get_context_loss_count(struct platform_device *pdev)
  * much memory to allocate before calling
  * omap_device_fill_resources().  Returns the count.
  */
-int omap_device_count_resources(struct omap_device *od)
+static int omap_device_count_resources(struct omap_device *od)
 {
        int c = 0;
        int i;
@@ -352,7 +457,7 @@ int omap_device_count_resources(struct omap_device *od)
                c += omap_hwmod_count_resources(od->hwmods[i]);
 
        pr_debug("omap_device: %s: counted %d total resources across %d "
-                "hwmods\n", od->pdev.name, c, od->hwmods_cnt);
+                "hwmods\n", od->pdev->name, c, od->hwmods_cnt);
 
        return c;
 }
@@ -374,7 +479,8 @@ int omap_device_count_resources(struct omap_device *od)
  * functions to get device resources.  Hacking around the existing
  * platform_device code wastes memory.  Returns 0.
  */
-int omap_device_fill_resources(struct omap_device *od, struct resource *res)
+static int omap_device_fill_resources(struct omap_device *od,
+                                     struct resource *res)
 {
        int c = 0;
        int i, r;
@@ -388,6 +494,113 @@ int omap_device_fill_resources(struct omap_device *od, struct resource *res)
        return 0;
 }
 
+/**
+ * omap_device_alloc - allocate an omap_device
+ * @pdev: platform_device that will be included in this omap_device
+ * @oh: ptr to the single omap_hwmod that backs this omap_device
+ * @pdata: platform_data ptr to associate with the platform_device
+ * @pdata_len: amount of memory pointed to by @pdata
+ * @pm_lats: pointer to a omap_device_pm_latency array for this device
+ * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats
+ *
+ * Convenience function for allocating an omap_device structure and filling
+ * hwmods, resources and pm_latency attributes.
+ *
+ * Returns an struct omap_device pointer or ERR_PTR() on error;
+ */
+static struct omap_device *omap_device_alloc(struct platform_device *pdev,
+                                       struct omap_hwmod **ohs, int oh_cnt,
+                                       struct omap_device_pm_latency *pm_lats,
+                                       int pm_lats_cnt)
+{
+       int ret = -ENOMEM;
+       struct omap_device *od;
+       struct resource *res = NULL;
+       int i, res_count;
+       struct omap_hwmod **hwmods;
+
+       od = kzalloc(sizeof(struct omap_device), GFP_KERNEL);
+       if (!od) {
+               ret = -ENOMEM;
+               goto oda_exit1;
+       }
+       od->hwmods_cnt = oh_cnt;
+
+       hwmods = kmemdup(ohs, sizeof(struct omap_hwmod *) * oh_cnt, GFP_KERNEL);
+       if (!hwmods)
+               goto oda_exit2;
+
+       od->hwmods = hwmods;
+       od->pdev = pdev;
+
+       /*
+        * HACK: Ideally the resources from DT should match, and hwmod
+        * should just add the missing ones. Since the name is not
+        * properly populated by DT, stick to hwmod resources only.
+        */
+       if (pdev->num_resources && pdev->resource)
+               dev_warn(&pdev->dev, "%s(): resources already allocated %d\n",
+                       __func__, pdev->num_resources);
+
+       res_count = omap_device_count_resources(od);
+       if (res_count > 0) {
+               dev_dbg(&pdev->dev, "%s(): resources allocated from hwmod %d\n",
+                       __func__, res_count);
+               res = kzalloc(sizeof(struct resource) * res_count, GFP_KERNEL);
+               if (!res)
+                       goto oda_exit3;
+
+               omap_device_fill_resources(od, res);
+
+               ret = platform_device_add_resources(pdev, res, res_count);
+               kfree(res);
+
+               if (ret)
+                       goto oda_exit3;
+       }
+
+       if (!pm_lats) {
+               pm_lats = omap_default_latency;
+               pm_lats_cnt = ARRAY_SIZE(omap_default_latency);
+       }
+
+       od->pm_lats_cnt = pm_lats_cnt;
+       od->pm_lats = kmemdup(pm_lats,
+                       sizeof(struct omap_device_pm_latency) * pm_lats_cnt,
+                       GFP_KERNEL);
+       if (!od->pm_lats)
+               goto oda_exit3;
+
+       pdev->archdata.od = od;
+
+       for (i = 0; i < oh_cnt; i++) {
+               hwmods[i]->od = od;
+               _add_hwmod_clocks_clkdev(od, hwmods[i]);
+       }
+
+       return od;
+
+oda_exit3:
+       kfree(hwmods);
+oda_exit2:
+       kfree(od);
+oda_exit1:
+       dev_err(&pdev->dev, "omap_device: build failed (%d)\n", ret);
+
+       return ERR_PTR(ret);
+}
+
+static void omap_device_delete(struct omap_device *od)
+{
+       if (!od)
+               return;
+
+       od->pdev->archdata.od = NULL;
+       kfree(od->pm_lats);
+       kfree(od->hwmods);
+       kfree(od);
+}
+
 /**
  * omap_device_build - build and register an omap_device with one omap_hwmod
  * @pdev_name: name of the platform_device driver to use
@@ -405,7 +618,7 @@ int omap_device_fill_resources(struct omap_device *od, struct resource *res)
  * information.  Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise,
  * passes along the return value of omap_device_build_ss().
  */
-struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,
+struct platform_device *omap_device_build(const char *pdev_name, int pdev_id,
                                      struct omap_hwmod *oh, void *pdata,
                                      int pdata_len,
                                      struct omap_device_pm_latency *pm_lats,
@@ -438,18 +651,15 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,
  * platform_device record.  Returns an ERR_PTR() on error, or passes
  * along the return value of omap_device_register().
  */
-struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
+struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
                                         struct omap_hwmod **ohs, int oh_cnt,
                                         void *pdata, int pdata_len,
                                         struct omap_device_pm_latency *pm_lats,
                                         int pm_lats_cnt, int is_early_device)
 {
        int ret = -ENOMEM;
+       struct platform_device *pdev;
        struct omap_device *od;
-       char *pdev_name2;
-       struct resource *res = NULL;
-       int i, res_count;
-       struct omap_hwmod **hwmods;
 
        if (!ohs || oh_cnt == 0 || !pdev_name)
                return ERR_PTR(-EINVAL);
@@ -457,72 +667,40 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
        if (!pdata && pdata_len > 0)
                return ERR_PTR(-EINVAL);
 
-       pr_debug("omap_device: %s: building with %d hwmods\n", pdev_name,
-                oh_cnt);
-
-       od = kzalloc(sizeof(struct omap_device), GFP_KERNEL);
-       if (!od)
-               return ERR_PTR(-ENOMEM);
+       pdev = platform_device_alloc(pdev_name, pdev_id);
+       if (!pdev) {
+               ret = -ENOMEM;
+               goto odbs_exit;
+       }
 
-       od->hwmods_cnt = oh_cnt;
+       /* Set the dev_name early to allow dev_xxx in omap_device_alloc */
+       if (pdev->id != -1)
+               dev_set_name(&pdev->dev, "%s.%d", pdev->name,  pdev->id);
+       else
+               dev_set_name(&pdev->dev, "%s", pdev->name);
 
-       hwmods = kzalloc(sizeof(struct omap_hwmod *) * oh_cnt,
-                        GFP_KERNEL);
-       if (!hwmods)
+       od = omap_device_alloc(pdev, ohs, oh_cnt, pm_lats, pm_lats_cnt);
+       if (!od)
                goto odbs_exit1;
 
-       memcpy(hwmods, ohs, sizeof(struct omap_hwmod *) * oh_cnt);
-       od->hwmods = hwmods;
-
-       pdev_name2 = kzalloc(strlen(pdev_name) + 1, GFP_KERNEL);
-       if (!pdev_name2)
-               goto odbs_exit2;
-       strcpy(pdev_name2, pdev_name);
-
-       od->pdev.name = pdev_name2;
-       od->pdev.id = pdev_id;
-
-       res_count = omap_device_count_resources(od);
-       if (res_count > 0) {
-               res = kzalloc(sizeof(struct resource) * res_count, GFP_KERNEL);
-               if (!res)
-                       goto odbs_exit3;
-       }
-       omap_device_fill_resources(od, res);
-
-       od->pdev.num_resources = res_count;
-       od->pdev.resource = res;
-
-       ret = platform_device_add_data(&od->pdev, pdata, pdata_len);
+       ret = platform_device_add_data(pdev, pdata, pdata_len);
        if (ret)
-               goto odbs_exit4;
-
-       od->pm_lats = pm_lats;
-       od->pm_lats_cnt = pm_lats_cnt;
+               goto odbs_exit2;
 
        if (is_early_device)
-               ret = omap_early_device_register(od);
+               ret = omap_early_device_register(pdev);
        else
-               ret = omap_device_register(od);
-
-       for (i = 0; i < oh_cnt; i++) {
-               hwmods[i]->od = od;
-               _add_hwmod_clocks_clkdev(od, hwmods[i]);
-       }
-
+               ret = omap_device_register(pdev);
        if (ret)
-               goto odbs_exit4;
+               goto odbs_exit2;
 
-       return od;
+       return pdev;
 
-odbs_exit4:
-       kfree(res);
-odbs_exit3:
-       kfree(pdev_name2);
 odbs_exit2:
-       kfree(hwmods);
+       omap_device_delete(od);
 odbs_exit1:
-       kfree(od);
+       platform_device_put(pdev);
+odbs_exit:
 
        pr_err("omap_device: %s: build failed (%d)\n", pdev_name, ret);
 
@@ -538,11 +716,11 @@ odbs_exit1:
  * platform_early_add_device() on the underlying platform_device.
  * Returns 0 by default.
  */
-int omap_early_device_register(struct omap_device *od)
+static int omap_early_device_register(struct platform_device *pdev)
 {
        struct platform_device *devices[1];
 
-       devices[0] = &(od->pdev);
+       devices[0] = pdev;
        early_platform_add_devices(devices, 1);
        return 0;
 }
@@ -638,13 +816,13 @@ static struct dev_pm_domain omap_device_pm_domain = {
  * platform_device_register() on the underlying platform_device.
  * Returns the return value of platform_device_register().
  */
-int omap_device_register(struct omap_device *od)
+static int omap_device_register(struct platform_device *pdev)
 {
-       pr_debug("omap_device: %s: registering\n", od->pdev.name);
+       pr_debug("omap_device: %s: registering\n", pdev->name);
 
-       od->pdev.dev.parent = &omap_device_parent;
-       od->pdev.dev.pm_domain = &omap_device_pm_domain;
-       return platform_device_register(&od->pdev);
+       pdev->dev.parent = &omap_device_parent;
+       pdev->dev.pm_domain = &omap_device_pm_domain;
+       return platform_device_add(pdev);
 }
 
 
@@ -671,8 +849,9 @@ int omap_device_enable(struct platform_device *pdev)
        od = to_omap_device(pdev);
 
        if (od->_state == OMAP_DEVICE_STATE_ENABLED) {
-               WARN(1, "omap_device: %s.%d: %s() called from invalid state %d\n",
-                    od->pdev.name, od->pdev.id, __func__, od->_state);
+               dev_warn(&pdev->dev,
+                        "omap_device: %s() called from invalid state %d\n",
+                        __func__, od->_state);
                return -EINVAL;
        }
 
@@ -710,8 +889,9 @@ int omap_device_idle(struct platform_device *pdev)
        od = to_omap_device(pdev);
 
        if (od->_state != OMAP_DEVICE_STATE_ENABLED) {
-               WARN(1, "omap_device: %s.%d: %s() called from invalid state %d\n",
-                    od->pdev.name, od->pdev.id, __func__, od->_state);
+               dev_warn(&pdev->dev,
+                        "omap_device: %s() called from invalid state %d\n",
+                        __func__, od->_state);
                return -EINVAL;
        }
 
@@ -742,8 +922,9 @@ int omap_device_shutdown(struct platform_device *pdev)
 
        if (od->_state != OMAP_DEVICE_STATE_ENABLED &&
            od->_state != OMAP_DEVICE_STATE_IDLE) {
-               WARN(1, "omap_device: %s.%d: %s() called from invalid state %d\n",
-                    od->pdev.name, od->pdev.id, __func__, od->_state);
+               dev_warn(&pdev->dev,
+                        "omap_device: %s() called from invalid state %d\n",
+                        __func__, od->_state);
                return -EINVAL;
        }
 
@@ -837,6 +1018,42 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od)
        return omap_hwmod_get_mpu_rt_va(od->hwmods[0]);
 }
 
+/**
+ * omap_device_get_by_hwmod_name() - convert a hwmod name to
+ * device pointer.
+ * @oh_name: name of the hwmod device
+ *
+ * Returns back a struct device * pointer associated with a hwmod
+ * device represented by a hwmod_name
+ */
+struct device *omap_device_get_by_hwmod_name(const char *oh_name)
+{
+       struct omap_hwmod *oh;
+
+       if (!oh_name) {
+               WARN(1, "%s: no hwmod name!\n", __func__);
+               return ERR_PTR(-EINVAL);
+       }
+
+       oh = omap_hwmod_lookup(oh_name);
+       if (IS_ERR_OR_NULL(oh)) {
+               WARN(1, "%s: no hwmod for %s\n", __func__,
+                       oh_name);
+               return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV);
+       }
+       if (IS_ERR_OR_NULL(oh->od)) {
+               WARN(1, "%s: no omap_device for %s\n", __func__,
+                       oh_name);
+               return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV);
+       }
+
+       if (IS_ERR_OR_NULL(oh->od->pdev))
+               return ERR_PTR(oh->od->pdev ? PTR_ERR(oh->od->pdev) : -ENODEV);
+
+       return &oh->od->pdev->dev;
+}
+EXPORT_SYMBOL(omap_device_get_by_hwmod_name);
+
 /*
  * Public functions intended for use in omap_device_pm_latency
  * .activate_func and .deactivate_func function pointers
@@ -917,8 +1134,13 @@ struct device omap_device_parent = {
        .parent         = &platform_bus,
 };
 
+static struct notifier_block platform_nb = {
+       .notifier_call = _omap_device_notifier_call,
+};
+
 static int __init omap_device_init(void)
 {
+       bus_register_notifier(&platform_bus_type, &platform_nb);
        return device_register(&omap_device_parent);
 }
 core_initcall(omap_device_init);
index 3075b9fdde831fc314522ca4636a9d4b99227b67..3abf30428beed9caf85574e63cf9440f068c8225 100644 (file)
 #define __PLAT_GPIO_H
 
 #include <linux/init.h>
-#include <asm-generic/gpio.h>
-
-/*
- * GENERIC_GPIO primitives.
- */
-#define gpio_get_value  __gpio_get_value
-#define gpio_set_value  __gpio_set_value
-#define gpio_cansleep   __gpio_cansleep
-#define gpio_to_irq     __gpio_to_irq
+#include <linux/types.h>
 
 /*
  * Orion-specific GPIO API extensions.
index 3aca5ba0f87654cf9055a880363f39fedc233473..f302d048392db9df129f7b5e025a007e28f11419 100644 (file)
@@ -4,7 +4,6 @@
 
 obj-y  := dma.o
 
-obj-$(CONFIG_GENERIC_GPIO)     += gpio.o
 obj-$(CONFIG_PXA3xx)           += mfp.o
 obj-$(CONFIG_PXA95x)           += mfp.o
 obj-$(CONFIG_ARCH_MMP)         += mfp.o
diff --git a/arch/arm/plat-pxa/include/plat/gpio-pxa.h b/arch/arm/plat-pxa/include/plat/gpio-pxa.h
new file mode 100644 (file)
index 0000000..b6390be
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef __PLAT_PXA_GPIO_H
+#define __PLAT_PXA_GPIO_H
+
+struct irq_data;
+
+/*
+ * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with
+ * one set of registers. The register offsets are organized below:
+ *
+ *           GPLR    GPDR    GPSR    GPCR    GRER    GFER    GEDR
+ * BANK 0 - 0x0000  0x000C  0x0018  0x0024  0x0030  0x003C  0x0048
+ * BANK 1 - 0x0004  0x0010  0x001C  0x0028  0x0034  0x0040  0x004C
+ * BANK 2 - 0x0008  0x0014  0x0020  0x002C  0x0038  0x0044  0x0050
+ *
+ * BANK 3 - 0x0100  0x010C  0x0118  0x0124  0x0130  0x013C  0x0148
+ * BANK 4 - 0x0104  0x0110  0x011C  0x0128  0x0134  0x0140  0x014C
+ * BANK 5 - 0x0108  0x0114  0x0120  0x012C  0x0138  0x0144  0x0150
+ *
+ * NOTE:
+ *   BANK 3 is only available on PXA27x and later processors.
+ *   BANK 4 and 5 are only available on PXA935
+ */
+
+#define GPIO_BANK(n)   (GPIO_REGS_VIRT + BANK_OFF(n))
+
+#define GPLR_OFFSET    0x00
+#define GPDR_OFFSET    0x0C
+#define GPSR_OFFSET    0x18
+#define GPCR_OFFSET    0x24
+#define GRER_OFFSET    0x30
+#define GFER_OFFSET    0x3C
+#define GEDR_OFFSET    0x48
+
+/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
+ * Those cases currently cause holes in the GPIO number space, the
+ * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
+ */
+extern int pxa_last_gpio;
+
+typedef int (*set_wake_t)(struct irq_data *d, unsigned int on);
+
+extern void pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn);
+
+#endif /* __PLAT_PXA_GPIO_H */
index 1ddd2b97a72995d90107cb05d0658b1c035236f5..258f77210b02ab8784771aa89b9d2d0b9428169a 100644 (file)
@@ -1,35 +1,10 @@
 #ifndef __PLAT_GPIO_H
 #define __PLAT_GPIO_H
 
-struct irq_data;
+#define __ARM_GPIOLIB_COMPLEX
 
-/*
- * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with
- * one set of registers. The register offsets are organized below:
- *
- *           GPLR    GPDR    GPSR    GPCR    GRER    GFER    GEDR
- * BANK 0 - 0x0000  0x000C  0x0018  0x0024  0x0030  0x003C  0x0048
- * BANK 1 - 0x0004  0x0010  0x001C  0x0028  0x0034  0x0040  0x004C
- * BANK 2 - 0x0008  0x0014  0x0020  0x002C  0x0038  0x0044  0x0050
- *
- * BANK 3 - 0x0100  0x010C  0x0118  0x0124  0x0130  0x013C  0x0148
- * BANK 4 - 0x0104  0x0110  0x011C  0x0128  0x0134  0x0140  0x014C
- * BANK 5 - 0x0108  0x0114  0x0120  0x012C  0x0138  0x0144  0x0150
- *
- * NOTE:
- *   BANK 3 is only available on PXA27x and later processors.
- *   BANK 4 and 5 are only available on PXA935
- */
-
-#define GPIO_BANK(n)   (GPIO_REGS_VIRT + BANK_OFF(n))
-
-#define GPLR_OFFSET    0x00
-#define GPDR_OFFSET    0x0C
-#define GPSR_OFFSET    0x18
-#define GPCR_OFFSET    0x24
-#define GRER_OFFSET    0x30
-#define GFER_OFFSET    0x3C
-#define GEDR_OFFSET    0x48
+/* The individual machine provides register offsets and NR_BUILTIN_GPIO */
+#include <mach/gpio-pxa.h>
 
 static inline int gpio_get_value(unsigned gpio)
 {
@@ -52,13 +27,4 @@ static inline void gpio_set_value(unsigned gpio, int value)
 
 #define gpio_cansleep          __gpio_cansleep
 
-/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
- * Those cases currently cause holes in the GPIO number space, the
- * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
- */
-extern int pxa_last_gpio;
-
-typedef int (*set_wake_t)(struct irq_data *d, unsigned int on);
-
-extern void pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn);
 #endif /* __PLAT_GPIO_H */
index f88216d23991bd642e710aeacfc584d4ef4c4cd1..c65eb791d1bb6d68f4fdc2b60ee9e2b4b45ceae4 100644 (file)
@@ -163,9 +163,9 @@ static __init int s5p_gpioint_add(struct s3c_gpio_chip *chip)
        ct->chip.irq_mask = irq_gc_mask_set_bit;
        ct->chip.irq_unmask = irq_gc_mask_clr_bit;
        ct->chip.irq_set_type = s5p_gpioint_set_type,
-       ct->regs.ack = PEND_OFFSET + REG_OFFSET(chip->group);
-       ct->regs.mask = MASK_OFFSET + REG_OFFSET(chip->group);
-       ct->regs.type = CON_OFFSET + REG_OFFSET(chip->group);
+       ct->regs.ack = PEND_OFFSET + REG_OFFSET(group - bank->start);
+       ct->regs.mask = MASK_OFFSET + REG_OFFSET(group - bank->start);
+       ct->regs.type = CON_OFFSET + REG_OFFSET(group - bank->start);
        irq_setup_generic_chip(gc, IRQ_MSK(chip->chip.ngpio),
                               IRQ_GC_INIT_MASK_CACHE,
                               IRQ_NOREQUEST | IRQ_NOPROBE, 0);
index b857c91257dde3c885c1b3bf1d813b0ae4adf961..40a8c178f10d9e85a2873c83247c3f2fe553f408 100644 (file)
@@ -1,24 +1 @@
-/*
- * arch/arm/plat-spear/include/plat/gpio.h
- *
- * GPIO macros for SPEAr platform
- *
- * Copyright (C) 2009 ST Microelectronics
- * Viresh Kumar<viresh.kumar@st.com>
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#ifndef __PLAT_GPIO_H
-#define __PLAT_GPIO_H
-
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
-
-#endif /* __PLAT_GPIO_H */
+/* empty */
index 177cdaf835644fdf613dbafd203a8e2dcf0e08d3..b122adc8bdbb593b09218c3d334394064de3fd72 100644 (file)
@@ -24,6 +24,7 @@ config MIPS
        select GENERIC_IRQ_PROBE
        select GENERIC_IRQ_SHOW
        select HAVE_ARCH_JUMP_LABEL
+       select IRQ_FORCED_THREADING
 
 menu "Machine selection"
 
@@ -722,6 +723,7 @@ config CAVIUM_OCTEON_SIMULATOR
        select SYS_SUPPORTS_HIGHMEM
        select SYS_SUPPORTS_HOTPLUG_CPU
        select SYS_HAS_CPU_CAVIUM_OCTEON
+       select HOLES_IN_ZONE
        help
          The Octeon simulator is software performance model of the Cavium
          Octeon Processor. It supports simulating Octeon processors on x86
@@ -744,6 +746,7 @@ config CAVIUM_OCTEON_REFERENCE_BOARD
        select ZONE_DMA32
        select USB_ARCH_HAS_OHCI
        select USB_ARCH_HAS_EHCI
+       select HOLES_IN_ZONE
        help
          This option supports all of the Octeon reference boards from Cavium
          Networks. It builds a kernel that dynamically determines the Octeon
@@ -973,6 +976,9 @@ config ISA_DMA_API
 config GENERIC_GPIO
        bool
 
+config HOLES_IN_ZONE
+       bool
+
 #
 # Endianess selection.  Sufficiently obscure so many users don't know what to
 # answer,so we try hard to limit the available choices.  Also the use of a
index 3b2c18b14341c22c10af18699bc36b844466ea9a..f72c48d4804c30989e78324639ec516f6d1aea75 100644 (file)
@@ -492,7 +492,7 @@ static void __init alchemy_setup_macs(int ctype)
                memcpy(au1xxx_eth0_platform_data.mac, ethaddr, 6);
 
        ret = platform_device_register(&au1xxx_eth0_device);
-       if (!ret)
+       if (ret)
                printk(KERN_INFO "Alchemy: failed to register MAC0\n");
 
 
index 647e518c90bc4bf239a0f3499822edd58616ec3c..b86324a42601105f7b540d25c3b89c1245b69b5e 100644 (file)
@@ -158,15 +158,21 @@ static void restore_core_regs(void)
 
 void au_sleep(void)
 {
-       int cpuid = alchemy_get_cputype();
-       if (cpuid != ALCHEMY_CPU_UNKNOWN) {
-               save_core_regs();
-               if (cpuid <= ALCHEMY_CPU_AU1500)
-                       alchemy_sleep_au1000();
-               else if (cpuid <= ALCHEMY_CPU_AU1200)
-                       alchemy_sleep_au1550();
-               restore_core_regs();
+       save_core_regs();
+
+       switch (alchemy_get_cputype()) {
+       case ALCHEMY_CPU_AU1000:
+       case ALCHEMY_CPU_AU1500:
+       case ALCHEMY_CPU_AU1100:
+               alchemy_sleep_au1000();
+               break;
+       case ALCHEMY_CPU_AU1550:
+       case ALCHEMY_CPU_AU1200:
+               alchemy_sleep_au1550();
+               break;
        }
+
+       restore_core_regs();
 }
 
 #endif /* CONFIG_PM */
index 596ad00e7f05f7bd0c6dc41b663ed2694fdc263d..463d2c4d9441f9592ce6abf85d27b1e8c38694af 100644 (file)
@@ -89,8 +89,12 @@ static void bcsr_csc_handler(unsigned int irq, struct irq_desc *d)
 {
        unsigned short bisr = __raw_readw(bcsr_virt + BCSR_REG_INTSTAT);
 
+       disable_irq_nosync(irq);
+
        for ( ; bisr; bisr &= bisr - 1)
                generic_handle_irq(bcsr_csc_base + __ffs(bisr));
+
+       enable_irq(irq);
 }
 
 /* NOTE: both the enable and mask bits must be cleared, otherwise the
index 1dac4f27d33452e7c572b06f4000bd6a44de232b..4a8980027ecf83538229e71ea67fe3c27c2a4517 100644 (file)
@@ -23,13 +23,6 @@ void __init board_setup(void)
        unsigned long freq0, clksrc, div, pfc;
        unsigned short whoami;
 
-       /* Set Config[OD] (disable overlapping bus transaction):
-        * This gets rid of a _lot_ of spurious interrupts (especially
-        * wrt. IDE); but incurs ~10% performance hit in some
-        * cpu-bound applications.
-        */
-       set_c0_config(1 << 19);
-
        bcsr_init(DB1200_BCSR_PHYS_ADDR,
                  DB1200_BCSR_PHYS_ADDR + DB1200_BCSR_HEXLED_OFS);
 
index 03db3daadbd8f95524783ae7c802e9524e9fb346..88c4babfdb5d491dd151906f20d3c5df068f946c 100644 (file)
@@ -98,7 +98,8 @@ static struct irq_chip ar7_sec_irq_type = {
 
 static struct irqaction ar7_cascade_action = {
        .handler = no_action,
-       .name = "AR7 cascade interrupt"
+       .name = "AR7 cascade interrupt",
+       .flags = IRQF_NO_THREAD,
 };
 
 static void __init ar7_irq_init(int base)
index cea6021cb8d7a3172976bd1a8c7b378b41331c93..162e11b4ed755f7e227d4cfc485d40170716abdf 100644 (file)
@@ -222,6 +222,7 @@ static struct irq_chip bcm63xx_external_irq_chip = {
 static struct irqaction cpu_ip2_cascade_action = {
        .handler        = no_action,
        .name           = "cascade_ip2",
+       .flags          = IRQF_NO_THREAD,
 };
 
 void __init arch_init_irq(void)
index cb9bf820fe53b4640a7b72264be61deacf998fa7..965c777d356132df575aa6f42534a58b17443415 100644 (file)
@@ -48,6 +48,7 @@ asmlinkage void plat_irq_dispatch(void)
 static struct irqaction cascade = {
        .handler        = no_action,
        .name           = "cascade",
+       .flags          = IRQF_NO_THREAD,
 };
 
 void __init arch_init_irq(void)
index fa45e924be05b9e40cf9d23b5a6a866034dfb8f3..f7b7ba6d5c45f589951f301bca6f29bc1e8bacba 100644 (file)
@@ -101,20 +101,24 @@ int cpu_fpu_mask = DEC_CPU_IRQ_MASK(DEC_CPU_INR_FPU);
 static struct irqaction ioirq = {
        .handler = no_action,
        .name = "cascade",
+       .flags = IRQF_NO_THREAD,
 };
 static struct irqaction fpuirq = {
        .handler = no_action,
        .name = "fpu",
+       .flags = IRQF_NO_THREAD,
 };
 
 static struct irqaction busirq = {
        .flags = IRQF_DISABLED,
        .name = "bus error",
+       .flags = IRQF_NO_THREAD,
 };
 
 static struct irqaction haltirq = {
        .handler = dec_intr_halt,
        .name = "halt",
+       .flags = IRQF_NO_THREAD,
 };
 
 
index 3dbd7a5a6ad33f5ab8335c0c45d84f235adb9d01..7798887a1288a7fc529e29d536287536a6dd628b 100644 (file)
@@ -169,7 +169,7 @@ void emma2rh_gpio_irq_init(void)
 
 static struct irqaction irq_cascade = {
           .handler = no_action,
-          .flags = 0,
+          .flags = IRQF_NO_THREAD,
           .name = "cascade",
           .dev_id = NULL,
           .next = NULL,
index 0d5a42b5f47abb4091d3257270b72f80ed1fe3ce..a58addb98cfd7f9b3d94d1f5bd165675f2ea3232 100644 (file)
@@ -54,7 +54,6 @@
 #define cpu_has_mips_r2_exec_hazard 0
 #define cpu_has_dsp            0
 #define cpu_has_mipsmt         0
-#define cpu_has_userlocal      0
 #define cpu_has_vint           0
 #define cpu_has_veic           0
 #define cpu_hwrena_impl_bits   0xc0000000
index 62c094085947db735ba4e2390094db048d1fee3b..35371641575d3b86c85ac913095b0e6d06f8775d 100644 (file)
@@ -13,7 +13,6 @@
 #define __ASM_MACH_POWERTV_DMA_COHERENCE_H
 
 #include <linux/sched.h>
-#include <linux/version.h>
 #include <linux/device.h>
 #include <asm/mach-powertv/asic.h>
 
index b4ba2449444b33101c33d4e9d7fd17b968db8466..cb41af5f3406cbddc91e23633463fe6a3b65e769 100644 (file)
                 * to cover the pipeline delay.
                 */
                .set    mips32
-               mfc0    v1, CP0_TCSTATUS
+               mfc0    k0, CP0_TCSTATUS
                .set    mips0
-               LONG_S  v1, PT_TCSTATUS(sp)
+               LONG_S  k0, PT_TCSTATUS(sp)
 #endif /* CONFIG_MIPS_MT_SMTC */
                LONG_S  $4, PT_R4(sp)
                LONG_S  $5, PT_R5(sp)
index 73031f7fc827e70c42ba99562897874b060605c5..4397972949fa315e6796b828d65778394fd21451 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/init.h>
 
 #include <linux/spinlock.h>
-#include <linux/sysdev.h>
+#include <linux/syscore_ops.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
 #include <linux/delay.h>
@@ -86,7 +86,6 @@ struct jz_gpio_chip {
        spinlock_t lock;
 
        struct gpio_chip gpio_chip;
-       struct sys_device sysdev;
 };
 
 static struct jz_gpio_chip jz4740_gpio_chips[];
@@ -459,49 +458,47 @@ static struct jz_gpio_chip jz4740_gpio_chips[] = {
        JZ4740_GPIO_CHIP(D),
 };
 
-static inline struct jz_gpio_chip *sysdev_to_chip(struct sys_device *dev)
+static void jz4740_gpio_suspend_chip(struct jz_gpio_chip *chip)
 {
-       return container_of(dev, struct jz_gpio_chip, sysdev);
+       chip->suspend_mask = readl(chip->base + JZ_REG_GPIO_MASK);
+       writel(~(chip->wakeup), chip->base + JZ_REG_GPIO_MASK_SET);
+       writel(chip->wakeup, chip->base + JZ_REG_GPIO_MASK_CLEAR);
 }
 
-static int jz4740_gpio_suspend(struct sys_device *dev, pm_message_t state)
+static int jz4740_gpio_suspend(void)
 {
-       struct jz_gpio_chip *chip = sysdev_to_chip(dev);
+       int i;
 
-       chip->suspend_mask = readl(chip->base + JZ_REG_GPIO_MASK);
-       writel(~(chip->wakeup), chip->base + JZ_REG_GPIO_MASK_SET);
-       writel(chip->wakeup, chip->base + JZ_REG_GPIO_MASK_CLEAR);
+       for (i = 0; i < ARRAY_SIZE(jz4740_gpio_chips); i++)
+               jz4740_gpio_suspend_chip(&jz4740_gpio_chips[i]);
 
        return 0;
 }
 
-static int jz4740_gpio_resume(struct sys_device *dev)
+static void jz4740_gpio_resume_chip(struct jz_gpio_chip *chip)
 {
-       struct jz_gpio_chip *chip = sysdev_to_chip(dev);
        uint32_t mask = chip->suspend_mask;
 
        writel(~mask, chip->base + JZ_REG_GPIO_MASK_CLEAR);
        writel(mask, chip->base + JZ_REG_GPIO_MASK_SET);
+}
 
-       return 0;
+static void jz4740_gpio_resume(void)
+{
+       int i;
+
+       for (i = ARRAY_SIZE(jz4740_gpio_chips) - 1; i >= 0 ; i--)
+               jz4740_gpio_resume_chip(&jz4740_gpio_chips[i]);
 }
 
-static struct sysdev_class jz4740_gpio_sysdev_class = {
-       .name = "gpio",
+static struct syscore_ops jz4740_gpio_syscore_ops = {
        .suspend = jz4740_gpio_suspend,
        .resume = jz4740_gpio_resume,
 };
 
-static int jz4740_gpio_chip_init(struct jz_gpio_chip *chip, unsigned int id)
+static void jz4740_gpio_chip_init(struct jz_gpio_chip *chip, unsigned int id)
 {
-       int ret, irq;
-
-       chip->sysdev.id = id;
-       chip->sysdev.cls = &jz4740_gpio_sysdev_class;
-       ret = sysdev_register(&chip->sysdev);
-
-       if (ret)
-               return ret;
+       int irq;
 
        spin_lock_init(&chip->lock);
 
@@ -519,22 +516,17 @@ static int jz4740_gpio_chip_init(struct jz_gpio_chip *chip, unsigned int id)
                irq_set_chip_and_handler(irq, &jz_gpio_irq_chip,
                                         handle_level_irq);
        }
-
-       return 0;
 }
 
 static int __init jz4740_gpio_init(void)
 {
        unsigned int i;
-       int ret;
-
-       ret = sysdev_class_register(&jz4740_gpio_sysdev_class);
-       if (ret)
-               return ret;
 
        for (i = 0; i < ARRAY_SIZE(jz4740_gpio_chips); ++i)
                jz4740_gpio_chip_init(&jz4740_gpio_chips[i], i);
 
+       register_syscore_ops(&jz4740_gpio_syscore_ops);
+
        printk(KERN_INFO "JZ4740 GPIO initialized\n");
 
        return 0;
index feb8021a305f49a4e6f366183e27626316398ed3..6a2d758dd8e9ed0b4a0afb043d2972869620834c 100644 (file)
 
 #include <asm-generic/sections.h>
 
+#if defined(KBUILD_MCOUNT_RA_ADDRESS) && defined(CONFIG_32BIT)
+#define MCOUNT_OFFSET_INSNS 5
+#else
+#define MCOUNT_OFFSET_INSNS 4
+#endif
+
+/*
+ * Check if the address is in kernel space
+ *
+ * Clone core_kernel_text() from kernel/extable.c, but doesn't call
+ * init_kernel_text() for Ftrace doesn't trace functions in init sections.
+ */
+static inline int in_kernel_space(unsigned long ip)
+{
+       if (ip >= (unsigned long)_stext &&
+           ip <= (unsigned long)_etext)
+               return 1;
+       return 0;
+}
+
 #ifdef CONFIG_DYNAMIC_FTRACE
 
 #define JAL 0x0c000000         /* jump & link: ip --> ra, jump to target */
@@ -54,20 +74,6 @@ static inline void ftrace_dyn_arch_init_insns(void)
 #endif
 }
 
-/*
- * Check if the address is in kernel space
- *
- * Clone core_kernel_text() from kernel/extable.c, but doesn't call
- * init_kernel_text() for Ftrace doesn't trace functions in init sections.
- */
-static inline int in_kernel_space(unsigned long ip)
-{
-       if (ip >= (unsigned long)_stext &&
-           ip <= (unsigned long)_etext)
-               return 1;
-       return 0;
-}
-
 static int ftrace_modify_code(unsigned long ip, unsigned int new_code)
 {
        int faulted;
@@ -112,11 +118,6 @@ static int ftrace_modify_code(unsigned long ip, unsigned int new_code)
  *                                  1: offset = 4 instructions
  */
 
-#if defined(KBUILD_MCOUNT_RA_ADDRESS) && defined(CONFIG_32BIT)
-#define MCOUNT_OFFSET_INSNS 5
-#else
-#define MCOUNT_OFFSET_INSNS 4
-#endif
 #define INSN_B_1F (0x10000000 | MCOUNT_OFFSET_INSNS)
 
 int ftrace_make_nop(struct module *mod,
index 5c74eb797f08f1f4a6cc24df2d1c9567e5a198ed..32b397b646ee16074c93cf541b72eee85a4aafa4 100644 (file)
@@ -229,7 +229,7 @@ static void i8259A_shutdown(void)
         */
        if (i8259A_auto_eoi >= 0) {
                outb(0xff, PIC_MASTER_IMR);     /* mask all of 8259A-1 */
-               outb(0xff, PIC_SLAVE_IMR);      /* mask all of 8259A-1 */
+               outb(0xff, PIC_SLAVE_IMR);      /* mask all of 8259A-2 */
        }
 }
 
@@ -295,6 +295,7 @@ static void init_8259A(int auto_eoi)
 static struct irqaction irq2 = {
        .handler = no_action,
        .name = "cascade",
+       .flags = IRQF_NO_THREAD,
 };
 
 static struct resource pic1_io_resource = {
index 876a75cc376f7a8602d231c1c11440be8c88d7ae..922a554cd10802336aa5c23ce030dcbf8432c017 100644 (file)
@@ -349,3 +349,10 @@ SYSCALL_DEFINE6(32_fanotify_mark, int, fanotify_fd, unsigned int, flags,
        return sys_fanotify_mark(fanotify_fd, flags, merge_64(a3, a4),
                                 dfd, pathname);
 }
+
+SYSCALL_DEFINE6(32_futex, u32 __user *, uaddr, int, op, u32, val,
+               struct compat_timespec __user *, utime, u32 __user *, uaddr2,
+               u32, val3)
+{
+       return compat_sys_futex(uaddr, op, val, utime, uaddr2, val3);
+}
index f9296e894e465f83cccd9195df9baeb5d43dee17..6de1f598346e3bfd527f1d3cad321160aedb3c02 100644 (file)
@@ -315,7 +315,7 @@ EXPORT(sysn32_call_table)
        PTR     sys_fremovexattr
        PTR     sys_tkill
        PTR     sys_ni_syscall
-       PTR     compat_sys_futex
+       PTR     sys_32_futex
        PTR     compat_sys_sched_setaffinity    /* 6195 */
        PTR     compat_sys_sched_getaffinity
        PTR     sys_cacheflush
index 4d7c9827706f3d8dc821cfb258a12c22a384ddc2..1d813169e453ea3709b0410521b8526638d96a98 100644 (file)
@@ -441,7 +441,7 @@ sys_call_table:
        PTR     sys_fremovexattr                /* 4235 */
        PTR     sys_tkill
        PTR     sys_sendfile64
-       PTR     compat_sys_futex
+       PTR     sys_32_futex
        PTR     compat_sys_sched_setaffinity
        PTR     compat_sys_sched_getaffinity    /* 4240 */
        PTR     compat_sys_io_setup
index dbbe0ce48d89a4957a349febda33d0934c97d9af..f8524003676ac99f06d0ebb297206dfab415edce 100644 (file)
@@ -8,6 +8,7 @@
  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
  */
 #include <linux/cache.h>
+#include <linux/irqflags.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/personality.h>
@@ -658,6 +659,8 @@ static void do_signal(struct pt_regs *regs)
 asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused,
        __u32 thread_info_flags)
 {
+       local_irq_enable();
+
        /* deal with pending signal delivery */
        if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
                do_signal(regs);
index b7517e3abc8527721fdffca5ded64a035d33fddb..cbea618af0b4071feacd04e8abb922f9c0556c09 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/bug.h>
 #include <linux/compiler.h>
 #include <linux/init.h>
+#include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/sched.h>
@@ -364,21 +365,26 @@ static int regs_to_trapnr(struct pt_regs *regs)
        return (regs->cp0_cause >> 2) & 0x1f;
 }
 
-static DEFINE_SPINLOCK(die_lock);
+static DEFINE_RAW_SPINLOCK(die_lock);
 
 void __noreturn die(const char *str, struct pt_regs *regs)
 {
        static int die_counter;
        int sig = SIGSEGV;
 #ifdef CONFIG_MIPS_MT_SMTC
-       unsigned long dvpret = dvpe();
+       unsigned long dvpret;
 #endif /* CONFIG_MIPS_MT_SMTC */
 
+       oops_enter();
+
        if (notify_die(DIE_OOPS, str, regs, 0, regs_to_trapnr(regs), SIGSEGV) == NOTIFY_STOP)
                sig = 0;
 
        console_verbose();
-       spin_lock_irq(&die_lock);
+       raw_spin_lock_irq(&die_lock);
+#ifdef CONFIG_MIPS_MT_SMTC
+       dvpret = dvpe();
+#endif /* CONFIG_MIPS_MT_SMTC */
        bust_spinlocks(1);
 #ifdef CONFIG_MIPS_MT_SMTC
        mips_mt_regdump(dvpret);
@@ -387,7 +393,9 @@ void __noreturn die(const char *str, struct pt_regs *regs)
        printk("%s[#%d]:\n", str, ++die_counter);
        show_registers(regs);
        add_taint(TAINT_DIE);
-       spin_unlock_irq(&die_lock);
+       raw_spin_unlock_irq(&die_lock);
+
+       oops_exit();
 
        if (in_interrupt())
                panic("Fatal exception in interrupt");
index 2cd50ad0d5c66ec04d4034c6bf81b690dd5cb1a8..3efcb065f78a4fcc9a55a842f7574ceb89d43f7a 100644 (file)
@@ -192,7 +192,7 @@ static struct tc *get_tc(int index)
        }
        spin_unlock(&vpecontrol.tc_list_lock);
 
-       return NULL;
+       return res;
 }
 
 /* allocate a vpe and associate it with this minor (or index) */
index fc89795cafdb6ad1fecb5274b76f74bc8fd85121..f9737bb3c5ab7442b055a6d0d7aa0e7529b37b6d 100644 (file)
@@ -123,11 +123,10 @@ void ltq_enable_irq(struct irq_data *d)
 static unsigned int ltq_startup_eiu_irq(struct irq_data *d)
 {
        int i;
-       int irq_nr = d->irq - INT_NUM_IRQ0;
 
        ltq_enable_irq(d);
        for (i = 0; i < MAX_EIU; i++) {
-               if (irq_nr == ltq_eiu_irq[i]) {
+               if (d->irq == ltq_eiu_irq[i]) {
                        /* low level - we should really handle set_type */
                        ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_C) |
                                (0x6 << (i * 4)), LTQ_EIU_EXIN_C);
@@ -147,11 +146,10 @@ static unsigned int ltq_startup_eiu_irq(struct irq_data *d)
 static void ltq_shutdown_eiu_irq(struct irq_data *d)
 {
        int i;
-       int irq_nr = d->irq - INT_NUM_IRQ0;
 
        ltq_disable_irq(d);
        for (i = 0; i < MAX_EIU; i++) {
-               if (irq_nr == ltq_eiu_irq[i]) {
+               if (d->irq == ltq_eiu_irq[i]) {
                        /* disable */
                        ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) & ~(1 << i),
                                LTQ_EIU_EXIN_INEN);
index 66eb52fa50a16d3590131ee098b159acf3e63190..033b3184c7a70d180dbed8950c0d7e4e594317dd 100644 (file)
@@ -10,7 +10,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/version.h>
 #include <linux/ioport.h>
 
 #include <lantiq_soc.h>
index 9d69f01e352b7f693f3e47aed0de0839480a1337..39f0d2641cbfece73d507aa01b0d5e888e26b272 100644 (file)
@@ -8,7 +8,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/version.h>
 #include <linux/ioport.h>
 
 #include <lantiq_soc.h>
index de4c165515d780571712c81e9e641c9a31728c8c..d608b6ef0edd7712aa9d34c5668d2590a8e3a962 100644 (file)
@@ -105,6 +105,7 @@ asmlinkage void plat_irq_dispatch(void)
 static struct irqaction cascade = {
        .handler        = no_action,
        .name           = "cascade",
+       .flags          = IRQF_NO_THREAD,
 };
 
 void __init arch_init_irq(void)
index d61a04222b87217563543b8fb1ead4241c3ff859..3cf1fef29f0e76cbdff9828b896b21d5c6b568d4 100644 (file)
@@ -42,6 +42,7 @@ asmlinkage void mach_irq_dispatch(unsigned int pending)
 static struct irqaction cascade_irqaction = {
        .handler = no_action,
        .name = "cascade",
+       .flags = IRQF_NO_THREAD,
 };
 
 void __init mach_init_irq(void)
index 081db102bb9835d7c15dd4f71db536e5783c40b8..14b081841b6b0d7ed2117917dc2306cfbf46ce0d 100644 (file)
@@ -96,12 +96,13 @@ static irqreturn_t ip6_action(int cpl, void *dev_id)
 struct irqaction ip6_irqaction = {
        .handler = ip6_action,
        .name = "cascade",
-       .flags = IRQF_SHARED,
+       .flags = IRQF_SHARED | IRQF_NO_THREAD,
 };
 
 struct irqaction cascade_irqaction = {
        .handler = no_action,
        .name = "cascade",
+       .flags = IRQF_NO_THREAD,
 };
 
 void __init mach_init_irq(void)
index 9ff5d0fac556569eb53d6dc85e16925f1b04cb62..302d779d5b0d02b1de195ca87b76f4b8f84bfaa3 100644 (file)
@@ -6,6 +6,7 @@
  * Copyright (C) 2011 Wind River Systems,
  *   written by Ralf Baechle <ralf@linux-mips.org>
  */
+#include <linux/compiler.h>
 #include <linux/errno.h>
 #include <linux/mm.h>
 #include <linux/mman.h>
 #include <linux/sched.h>
 
 unsigned long shm_align_mask = PAGE_SIZE - 1;  /* Sane caches */
-
 EXPORT_SYMBOL(shm_align_mask);
 
 /* gap between mmap and stack */
 #define MIN_GAP (128*1024*1024UL)
-#define MAX_GAP        ((TASK_SIZE)/6*5)
+#define MAX_GAP ((TASK_SIZE)/6*5)
 
 static int mmap_is_legacy(void)
 {
@@ -57,13 +57,13 @@ static inline unsigned long COLOUR_ALIGN_DOWN(unsigned long addr,
        return base - off;
 }
 
-#define COLOUR_ALIGN(addr,pgoff)                               \
+#define COLOUR_ALIGN(addr, pgoff)                              \
        ((((addr) + shm_align_mask) & ~shm_align_mask) +        \
         (((pgoff) << PAGE_SHIFT) & shm_align_mask))
 
 enum mmap_allocation_direction {UP, DOWN};
 
-static unsigned long arch_get_unmapped_area_foo(struct file *filp,
+static unsigned long arch_get_unmapped_area_common(struct file *filp,
        unsigned long addr0, unsigned long len, unsigned long pgoff,
        unsigned long flags, enum mmap_allocation_direction dir)
 {
@@ -103,16 +103,16 @@ static unsigned long arch_get_unmapped_area_foo(struct file *filp,
 
                vma = find_vma(mm, addr);
                if (TASK_SIZE - len >= addr &&
-                  (!vma || addr + len <= vma->vm_start))
+                   (!vma || addr + len <= vma->vm_start))
                        return addr;
        }
 
        if (dir == UP) {
                addr = mm->mmap_base;
-                       if (do_color_align)
-                               addr = COLOUR_ALIGN(addr, pgoff);
-                       else
-                               addr = PAGE_ALIGN(addr);
+               if (do_color_align)
+                       addr = COLOUR_ALIGN(addr, pgoff);
+               else
+                       addr = PAGE_ALIGN(addr);
 
                for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) {
                        /* At this point:  (!vma || addr < vma->vm_end). */
@@ -131,28 +131,30 @@ static unsigned long arch_get_unmapped_area_foo(struct file *filp,
                        mm->free_area_cache = mm->mmap_base;
                }
 
-               /* either no address requested or can't fit in requested address hole */
+               /*
+                * either no address requested, or the mapping can't fit into
+                * the requested address hole
+                */
                addr = mm->free_area_cache;
-                       if (do_color_align) {
-                               unsigned long base =
-                                       COLOUR_ALIGN_DOWN(addr - len, pgoff);
-
+               if (do_color_align) {
+                       unsigned long base =
+                               COLOUR_ALIGN_DOWN(addr - len, pgoff);
                        addr = base + len;
-                }
+               }
 
                /* make sure it can fit in the remaining address space */
                if (likely(addr > len)) {
                        vma = find_vma(mm, addr - len);
                        if (!vma || addr <= vma->vm_start) {
-                               /* remember the address as a hint for next time */
-                               return mm->free_area_cache = addr-len;
+                               /* cache the address as a hint for next time */
+                               return mm->free_area_cache = addr - len;
                        }
                }
 
                if (unlikely(mm->mmap_base < len))
                        goto bottomup;
 
-               addr = mm->mmap_base-len;
+               addr = mm->mmap_base - len;
                if (do_color_align)
                        addr = COLOUR_ALIGN_DOWN(addr, pgoff);
 
@@ -163,8 +165,8 @@ static unsigned long arch_get_unmapped_area_foo(struct file *filp,
                         * return with success:
                         */
                        vma = find_vma(mm, addr);
-                       if (likely(!vma || addr+len <= vma->vm_start)) {
-                               /* remember the address as a hint for next time */
+                       if (likely(!vma || addr + len <= vma->vm_start)) {
+                               /* cache the address as a hint for next time */
                                return mm->free_area_cache = addr;
                        }
 
@@ -173,7 +175,7 @@ static unsigned long arch_get_unmapped_area_foo(struct file *filp,
                                mm->cached_hole_size = vma->vm_start - addr;
 
                        /* try just below the current vma->vm_start */
-                       addr = vma->vm_start-len;
+                       addr = vma->vm_start - len;
                        if (do_color_align)
                                addr = COLOUR_ALIGN_DOWN(addr, pgoff);
                } while (likely(len < vma->vm_start));
@@ -201,7 +203,7 @@ bottomup:
 unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr0,
        unsigned long len, unsigned long pgoff, unsigned long flags)
 {
-       return arch_get_unmapped_area_foo(filp,
+       return arch_get_unmapped_area_common(filp,
                        addr0, len, pgoff, flags, UP);
 }
 
@@ -213,7 +215,7 @@ unsigned long arch_get_unmapped_area_topdown(struct file *filp,
        unsigned long addr0, unsigned long len, unsigned long pgoff,
        unsigned long flags)
 {
-       return arch_get_unmapped_area_foo(filp,
+       return arch_get_unmapped_area_common(filp,
                        addr0, len, pgoff, flags, DOWN);
 }
 
index b6e1cff5066704de206ed92febcb6e8bb7da49b3..e06370f58ef3b5eee07d527ef8d653179dc60c25 100644 (file)
@@ -1759,14 +1759,13 @@ static void __cpuinit build_r3000_tlb_modify_handler(void)
        u32 *p = handle_tlbm;
        struct uasm_label *l = labels;
        struct uasm_reloc *r = relocs;
-       struct work_registers wr;
 
        memset(handle_tlbm, 0, sizeof(handle_tlbm));
        memset(labels, 0, sizeof(labels));
        memset(relocs, 0, sizeof(relocs));
 
        build_r3000_tlbchange_handler_head(&p, K0, K1);
-       build_pte_modifiable(&p, &r, wr.r1, wr.r2,  wr.r3, label_nopage_tlbm);
+       build_pte_modifiable(&p, &r, K0, K1,  -1, label_nopage_tlbm);
        uasm_i_nop(&p); /* load delay */
        build_make_write(&p, &r, K0, K1);
        build_r3000_pte_reload_tlbwi(&p, K0, K1);
@@ -1963,7 +1962,8 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
                        uasm_i_andi(&p, wr.r3, wr.r3, 2);
                        uasm_il_beqz(&p, &r, wr.r3, label_tlbl_goaround2);
                }
-
+               if (PM_DEFAULT_MASK == 0)
+                       uasm_i_nop(&p);
                /*
                 * We clobbered C0_PAGEMASK, restore it.  On the other branch
                 * it is restored in build_huge_tlb_write_entry.
index 1d36c511a7a5951c227800f917dd815449baf064..d53ff91b277c8f358a96058ddffada9901345ba1 100644 (file)
@@ -350,12 +350,14 @@ unsigned int plat_ipi_resched_int_xlate(unsigned int cpu)
 
 static struct irqaction i8259irq = {
        .handler = no_action,
-       .name = "XT-PIC cascade"
+       .name = "XT-PIC cascade",
+       .flags = IRQF_NO_THREAD,
 };
 
 static struct irqaction corehi_irqaction = {
        .handler = no_action,
-       .name = "CoreHi"
+       .name = "CoreHi",
+       .flags = IRQF_NO_THREAD,
 };
 
 static msc_irqmap_t __initdata msc_irqmap[] = {
index 9bd3f731f62eb3b52b305e369c3b5ba1065ed9ae..2dca585dd2f7eb71c002dc0942b1e44cec7af173 100644 (file)
@@ -2,4 +2,4 @@ obj-y                           += setup.o platform.o irq.o setup.o time.o
 obj-$(CONFIG_SMP)              += smp.o smpboot.o
 obj-$(CONFIG_EARLY_PRINTK)     += xlr_console.o
 
-EXTRA_CFLAGS                   += -Werror
+ccflags-y                      += -Werror
index 603d7493e9660308cd63e0343c41911a932b5b9c..8656388b34bd4fac95d7dadf6584d9fe6cdbceb6 100644 (file)
@@ -171,8 +171,13 @@ static int __devinit ltq_pci_startup(struct ltq_pci_data *conf)
        u32 temp_buffer;
 
        /* set clock to 33Mhz */
-       ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) & ~0xf00000, LTQ_CGU_IFCCR);
-       ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) | 0x800000, LTQ_CGU_IFCCR);
+       if (ltq_is_ar9()) {
+               ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) & ~0x1f00000, LTQ_CGU_IFCCR);
+               ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) | 0xe00000, LTQ_CGU_IFCCR);
+       } else {
+               ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) & ~0xf00000, LTQ_CGU_IFCCR);
+               ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) | 0x800000, LTQ_CGU_IFCCR);
+       }
 
        /* external or internal clock ? */
        if (conf->clock) {
index 764362ce5e404119b375f327d0c01111ee559383..5f3a69cebad1d51554052bec403279972d5023ee 100644 (file)
@@ -215,7 +215,7 @@ static int __init rc32434_pci_init(void)
        rc32434_pcibridge_init();
 
        io_map_base = ioremap(rc32434_res_pci_io1.start,
-                             resource_size(&rcrc32434_res_pci_io1));
+                             resource_size(&rc32434_res_pci_io1));
 
        if (!io_map_base)
                return -ENOMEM;
index 4531c4a514bc499b2dedfbe9bf497149a39947df..d3c3d81757a538ea13ee3ab56942d1aeea00df3c 100644 (file)
@@ -108,12 +108,14 @@ asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
 
 static struct irqaction cic_cascade_msp = {
        .handler = no_action,
-       .name    = "MSP CIC cascade"
+       .name    = "MSP CIC cascade",
+       .flags   = IRQF_NO_THREAD,
 };
 
 static struct irqaction per_cascade_msp = {
        .handler = no_action,
-       .name    = "MSP PER cascade"
+       .name    = "MSP PER cascade",
+       .flags   = IRQF_NO_THREAD,
 };
 
 void __init arch_init_irq(void)
index 6b93c81779c1a6166ca0a5ead00f81b1632badd4..1ebe22bdadc87668c35587687434af376876bafc 100644 (file)
@@ -167,7 +167,7 @@ static struct irq_chip level_irq_type = {
 
 static struct irqaction gic_action = {
        .handler =      no_action,
-       .flags =        IRQF_DISABLED,
+       .flags =        IRQF_DISABLED | IRQF_NO_THREAD,
        .name =         "GIC",
 };
 
index b4d08e4d2ea949b6818f8bac47d2f7576d516918..f72c336ea27b3b059ca4c6a169e3b1cefce23d47 100644 (file)
@@ -155,32 +155,32 @@ static void __irq_entry indy_buserror_irq(void)
 
 static struct irqaction local0_cascade = {
        .handler        = no_action,
-       .flags          = IRQF_DISABLED,
+       .flags          = IRQF_DISABLED | IRQF_NO_THREAD,
        .name           = "local0 cascade",
 };
 
 static struct irqaction local1_cascade = {
        .handler        = no_action,
-       .flags          = IRQF_DISABLED,
+       .flags          = IRQF_DISABLED | IRQF_NO_THREAD,
        .name           = "local1 cascade",
 };
 
 static struct irqaction buserr = {
        .handler        = no_action,
-       .flags          = IRQF_DISABLED,
+       .flags          = IRQF_DISABLED | IRQF_NO_THREAD,
        .name           = "Bus Error",
 };
 
 static struct irqaction map0_cascade = {
        .handler        = no_action,
-       .flags          = IRQF_DISABLED,
+       .flags          = IRQF_DISABLED | IRQF_NO_THREAD,
        .name           = "mapable0 cascade",
 };
 
 #ifdef USE_LIO3_IRQ
 static struct irqaction map1_cascade = {
        .handler        = no_action,
-       .flags          = IRQF_DISABLED,
+       .flags          = IRQF_DISABLED | IRQF_NO_THREAD,
        .name           = "mapable1 cascade",
 };
 #define SGI_INTERRUPTS SGINT_END
index a7e5a6d917b1572c283903729f7f495f3fb334f0..3ab5b5d25b0acca9aeeb2c3306a38af4b8637d89 100644 (file)
@@ -359,6 +359,7 @@ void sni_rm200_init_8259A(void)
 static struct irqaction sni_rm200_irq2 = {
        .handler = no_action,
        .name = "cascade",
+       .flags = IRQF_NO_THREAD,
 };
 
 static struct resource sni_rm200_pic1_resource = {
index 70a3b85f37576dcc8ac6ad8f68155c79c5ae747b..fad2bef432cdd94ad509fe2d6b45d74ee36d3661 100644 (file)
@@ -34,6 +34,7 @@ static irq_cascade_t irq_cascade[NR_IRQS] __cacheline_aligned;
 static struct irqaction cascade_irqaction = {
        .handler        = no_action,
        .name           = "cascade",
+       .flags          = IRQF_NO_THREAD,
 };
 
 int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int))
index 1407c07bdade6215eab5edc2cf3bbbe08544e379..f6ae2b2b6870d603ff0f33e72bd706c010244077 100644 (file)
@@ -280,7 +280,7 @@ static inline unsigned long srmmu_hwprobe(unsigned long vaddr)
        return retval;
 }
 #else
-#define srmmu_hwprobe(addr) (srmmu_swprobe(addr, 0) & SRMMU_PTE_PMASK)
+#define srmmu_hwprobe(addr) srmmu_swprobe(addr, 0)
 #endif
 
 static inline int
index 1e94f946570ee6bfb56f66b6a42b9d99032d2a75..8aa0d44085860f67cf4f454a8a4c4de5d03d2207 100644 (file)
@@ -230,7 +230,8 @@ static void pci_parse_of_addrs(struct platform_device *op,
                        res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2];
                } else if (i == dev->rom_base_reg) {
                        res = &dev->resource[PCI_ROM_RESOURCE];
-                       flags |= IORESOURCE_READONLY | IORESOURCE_CACHEABLE;
+                       flags |= IORESOURCE_READONLY | IORESOURCE_CACHEABLE
+                             | IORESOURCE_SIZEALIGN;
                } else {
                        printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i);
                        continue;
index 1ba95aff5d5958cdeb1142a24f18ea0c63717722..2caa556db86dc44818521233c5ba7aad226ca186 100644 (file)
@@ -273,10 +273,7 @@ void do_sigreturn32(struct pt_regs *regs)
                case 1: set.sig[0] = seta[0] + (((long)seta[1]) << 32);
        }
        sigdelsetmask(&set, ~_BLOCKABLE);
-       spin_lock_irq(&current->sighand->siglock);
-       current->blocked = set;
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       set_current_blocked(&set);
        return;
 
 segv:
@@ -377,10 +374,7 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
                case 1: set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32);
        }
        sigdelsetmask(&set, ~_BLOCKABLE);
-       spin_lock_irq(&current->sighand->siglock);
-       current->blocked = set;
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       set_current_blocked(&set);
        return;
 segv:
        force_sig(SIGSEGV, current);
@@ -782,6 +776,7 @@ static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka,
                                  siginfo_t *info,
                                  sigset_t *oldset, struct pt_regs *regs)
 {
+       sigset_t blocked;
        int err;
 
        if (ka->sa.sa_flags & SA_SIGINFO)
@@ -792,12 +787,10 @@ static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka,
        if (err)
                return err;
 
-       spin_lock_irq(&current->sighand->siglock);
-       sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
+       sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask);
        if (!(ka->sa.sa_flags & SA_NOMASK))
-               sigaddset(&current->blocked,signr);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+               sigaddset(&blocked, signr);
+       set_current_blocked(&blocked);
 
        tracehook_signal_handler(signr, info, ka, regs, 0);
 
@@ -881,7 +874,7 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs,
         */
        if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
                current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
-               sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
+               set_current_blocked(&current->saved_sigmask);
        }
 }
 
index 04ede8f04add3f397ca46c8ebee249d85c92213c..8ce247ac04cc0d905abd7d7e1d5de20073ce654a 100644 (file)
@@ -62,12 +62,13 @@ struct rt_signal_frame {
 
 static int _sigpause_common(old_sigset_t set)
 {
-       set &= _BLOCKABLE;
-       spin_lock_irq(&current->sighand->siglock);
+       sigset_t blocked;
+
        current->saved_sigmask = current->blocked;
-       siginitset(&current->blocked, set);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+
+       set &= _BLOCKABLE;
+       siginitset(&blocked, set);
+       set_current_blocked(&blocked);
 
        current->state = TASK_INTERRUPTIBLE;
        schedule();
@@ -139,10 +140,7 @@ asmlinkage void do_sigreturn(struct pt_regs *regs)
                goto segv_and_exit;
 
        sigdelsetmask(&set, ~_BLOCKABLE);
-       spin_lock_irq(&current->sighand->siglock);
-       current->blocked = set;
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       set_current_blocked(&set);
        return;
 
 segv_and_exit:
@@ -209,10 +207,7 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
        }
 
        sigdelsetmask(&set, ~_BLOCKABLE);
-       spin_lock_irq(&current->sighand->siglock);
-       current->blocked = set;
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       set_current_blocked(&set);
        return;
 segv:
        force_sig(SIGSEGV, current);
@@ -470,6 +465,7 @@ static inline int
 handle_signal(unsigned long signr, struct k_sigaction *ka,
              siginfo_t *info, sigset_t *oldset, struct pt_regs *regs)
 {
+       sigset_t blocked;
        int err;
 
        if (ka->sa.sa_flags & SA_SIGINFO)
@@ -480,12 +476,10 @@ handle_signal(unsigned long signr, struct k_sigaction *ka,
        if (err)
                return err;
 
-       spin_lock_irq(&current->sighand->siglock);
-       sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
+       sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask);
        if (!(ka->sa.sa_flags & SA_NOMASK))
-               sigaddset(&current->blocked, signr);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+               sigaddset(&blocked, signr);
+       set_current_blocked(&blocked);
 
        tracehook_signal_handler(signr, info, ka, regs, 0);
 
@@ -581,7 +575,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
         */
        if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
                clear_thread_flag(TIF_RESTORE_SIGMASK);
-               sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
+               set_current_blocked(&current->saved_sigmask);
        }
 }
 
index 47509df3b893acfb365ec503cbe00f2dabeea2ac..a2b81598d90562695abefa70b8c66ea11832341c 100644 (file)
@@ -70,10 +70,7 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs)
                                goto do_sigsegv;
                }
                sigdelsetmask(&set, ~_BLOCKABLE);
-               spin_lock_irq(&current->sighand->siglock);
-               current->blocked = set;
-               recalc_sigpending();
-               spin_unlock_irq(&current->sighand->siglock);
+               set_current_blocked(&set);
        }
        if (test_thread_flag(TIF_32BIT)) {
                pc &= 0xffffffff;
@@ -242,12 +239,13 @@ struct rt_signal_frame {
 
 static long _sigpause_common(old_sigset_t set)
 {
-       set &= _BLOCKABLE;
-       spin_lock_irq(&current->sighand->siglock);
+       sigset_t blocked;
+
        current->saved_sigmask = current->blocked;
-       siginitset(&current->blocked, set);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+
+       set &= _BLOCKABLE;
+       siginitset(&blocked, set);
+       set_current_blocked(&blocked);
 
        current->state = TASK_INTERRUPTIBLE;
        schedule();
@@ -327,10 +325,7 @@ void do_rt_sigreturn(struct pt_regs *regs)
        pt_regs_clear_syscall(regs);
 
        sigdelsetmask(&set, ~_BLOCKABLE);
-       spin_lock_irq(&current->sighand->siglock);
-       current->blocked = set;
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       set_current_blocked(&set);
        return;
 segv:
        force_sig(SIGSEGV, current);
@@ -484,18 +479,17 @@ static inline int handle_signal(unsigned long signr, struct k_sigaction *ka,
                                siginfo_t *info,
                                sigset_t *oldset, struct pt_regs *regs)
 {
+       sigset_t blocked;
        int err;
 
        err = setup_rt_frame(ka, regs, signr, oldset,
                             (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL);
        if (err)
                return err;
-       spin_lock_irq(&current->sighand->siglock);
-       sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
+       sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask);
        if (!(ka->sa.sa_flags & SA_NOMASK))
-               sigaddset(&current->blocked,signr);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+               sigaddset(&blocked, signr);
+       set_current_blocked(&blocked);
 
        tracehook_signal_handler(signr, info, ka, regs, 0);
 
@@ -601,7 +595,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
         */
        if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
                current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
-               sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
+               set_current_blocked(&current->saved_sigmask);
        }
 }
 
index e485a680499824319b5e9bd6fb750806d99a9429..13c2169822a84e8313b49c7c4136f06cff60ed83 100644 (file)
@@ -162,7 +162,7 @@ ready:
                printk(KERN_INFO "swprobe: padde %x\n", paddr_calc);
        if (paddr)
                *paddr = paddr_calc;
-       return paddrbase;
+       return pte;
 }
 
 void leon_flush_icache_all(void)
index fc94607f0bd50c8d5cdbf9f98bfcd42b26b51b03..aecc8ed5f39bd71d48cb150fe30301425b2179b7 100644 (file)
@@ -21,7 +21,7 @@
 #include <asm/ptrace.h>
 #include <asm/thread_info.h>
 #include <asm/irqflags.h>
-#include <linux/atomic.h>
+#include <asm/atomic_32.h>
 #include <asm/asm-offsets.h>
 #include <hv/hypervisor.h>
 #include <arch/abi.h>
index 1f75a2a561011220f27b9d97cd27bd4f78567ea2..30638042691ddba9ed1fee52d8c086da2502dbd5 100644 (file)
@@ -70,7 +70,7 @@
  */
 
 #include <linux/linkage.h>
-#include <linux/atomic.h>
+#include <asm/atomic_32.h>
 #include <asm/page.h>
 #include <asm/processor.h>
 
index 18ae83dd1cd7379ad79d0f9755fd6a0f8f369995..b56c65de384d7f5f2a442dc1eaa24cc18d348645 100644 (file)
@@ -56,7 +56,7 @@ DEFINE_VVAR(struct vsyscall_gtod_data, vsyscall_gtod_data) =
        .lock = __SEQLOCK_UNLOCKED(__vsyscall_gtod_data.lock),
 };
 
-static enum { EMULATE, NATIVE, NONE } vsyscall_mode = EMULATE;
+static enum { EMULATE, NATIVE, NONE } vsyscall_mode = NATIVE;
 
 static int __init vsyscall_setup(char *str)
 {
index 30326443ab81d9189224cf0c373ded68da51332d..87488b93a65ce19695947bc6ca7f58f948e0f24b 100644 (file)
@@ -63,9 +63,8 @@ static void __init find_early_table_space(unsigned long end, int use_pse,
 #ifdef CONFIG_X86_32
        /* for fixmap */
        tables += roundup(__end_of_fixed_addresses * sizeof(pte_t), PAGE_SIZE);
-
-       good_end = max_pfn_mapped << PAGE_SHIFT;
 #endif
+       good_end = max_pfn_mapped << PAGE_SHIFT;
 
        base = memblock_find_in_range(start, good_end, tables, PAGE_SIZE);
        if (base == MEMBLOCK_ERROR)
index 039d91315bc56bfcf6b8693c5ea3890ba7de4363..404f21a3ff9e27fa1ef75a233559f2623f4507ab 100644 (file)
@@ -43,6 +43,17 @@ static const struct dmi_system_id pci_use_crs_table[] __initconst = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "ALiveSATA2-GLAN"),
                 },
         },
+       /* https://bugzilla.kernel.org/show_bug.cgi?id=30552 */
+       /* 2006 AMD HT/VIA system with two host bridges */
+       {
+               .callback = set_use_crs,
+               .ident = "ASUS M2V-MX SE",
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
+                       DMI_MATCH(DMI_BOARD_NAME, "M2V-MX SE"),
+                       DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
+               },
+       },
        {}
 };
 
index 58425adc22c6ae156b01b916fe6703428b6391f9..fe73276e026bf263f494a917c84c6a3fcaeaaeda 100644 (file)
@@ -678,38 +678,40 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
        pentry = (struct sfi_device_table_entry *)sb->pentry;
 
        for (i = 0; i < num; i++, pentry++) {
-               if (pentry->irq != (u8)0xff) { /* native RTE case */
+               int irq = pentry->irq;
+
+               if (irq != (u8)0xff) { /* native RTE case */
                        /* these SPI2 devices are not exposed to system as PCI
                         * devices, but they have separate RTE entry in IOAPIC
                         * so we have to enable them one by one here
                         */
-                       ioapic = mp_find_ioapic(pentry->irq);
+                       ioapic = mp_find_ioapic(irq);
                        irq_attr.ioapic = ioapic;
-                       irq_attr.ioapic_pin = pentry->irq;
+                       irq_attr.ioapic_pin = irq;
                        irq_attr.trigger = 1;
                        irq_attr.polarity = 1;
-                       io_apic_set_pci_routing(NULL, pentry->irq, &irq_attr);
+                       io_apic_set_pci_routing(NULL, irq, &irq_attr);
                } else
-                       pentry->irq = 0; /* No irq */
+                       irq = 0; /* No irq */
 
                switch (pentry->type) {
                case SFI_DEV_TYPE_IPC:
                        /* ID as IRQ is a hack that will go away */
-                       pdev = platform_device_alloc(pentry->name, pentry->irq);
+                       pdev = platform_device_alloc(pentry->name, irq);
                        if (pdev == NULL) {
                                pr_err("out of memory for SFI platform device '%s'.\n",
                                                        pentry->name);
                                continue;
                        }
-                       install_irq_resource(pdev, pentry->irq);
+                       install_irq_resource(pdev, irq);
                        pr_debug("info[%2d]: IPC bus, name = %16.16s, "
-                               "irq = 0x%2x\n", i, pentry->name, pentry->irq);
+                               "irq = 0x%2x\n", i, pentry->name, irq);
                        sfi_handle_ipc_dev(pdev);
                        break;
                case SFI_DEV_TYPE_SPI:
                        memset(&spi_info, 0, sizeof(spi_info));
                        strncpy(spi_info.modalias, pentry->name, SFI_NAME_LEN);
-                       spi_info.irq = pentry->irq;
+                       spi_info.irq = irq;
                        spi_info.bus_num = pentry->host_num;
                        spi_info.chip_select = pentry->addr;
                        spi_info.max_speed_hz = pentry->max_freq;
@@ -726,7 +728,7 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
                        memset(&i2c_info, 0, sizeof(i2c_info));
                        bus = pentry->host_num;
                        strncpy(i2c_info.type, pentry->name, SFI_NAME_LEN);
-                       i2c_info.irq = pentry->irq;
+                       i2c_info.irq = irq;
                        i2c_info.addr = pentry->addr;
                        pr_debug("info[%2d]: I2C bus = %d, name = %16.16s, "
                                "irq = 0x%2x, addr = 0x%x\n", i, bus,
index be4425616931ffcf0f1747aa752d76f15379c989..7835b8fc94db6d69b9e93c1806d677e8ea390736 100644 (file)
@@ -67,6 +67,9 @@ static int ghash_update(struct shash_desc *desc,
        struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm);
        u8 *dst = dctx->buffer;
 
+       if (!ctx->gf128)
+               return -ENOKEY;
+
        if (dctx->bytes) {
                int n = min(srclen, dctx->bytes);
                u8 *pos = dst + (GHASH_BLOCK_SIZE - dctx->bytes);
@@ -119,6 +122,9 @@ static int ghash_final(struct shash_desc *desc, u8 *dst)
        struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm);
        u8 *buf = dctx->buffer;
 
+       if (!ctx->gf128)
+               return -ENOKEY;
+
        ghash_flush(ctx, dctx);
        memcpy(dst, buf, GHASH_BLOCK_SIZE);
 
index 960c725713951632869b9bc01585374ea2e5ae4d..3f4c2613b3dfa1a2f672bbb6d86383dc2e58d029 100644 (file)
@@ -30,7 +30,7 @@
 
 #include <mach/at91sam9_smc.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 
 #define DRV_NAME               "pata_at91"
 #define DRV_VERSION            "0.3"
index d539efd96d4b8d5b7c032c5c0767543da7413cd7..4caa3d37bbde5783164f47cc68e278bb4d243c0d 100644 (file)
@@ -178,6 +178,15 @@ config GPIO_SCH
          The Intel Tunnel Creek processor has 5 GPIOs powered by the
          core power rail and 9 from suspend power supply.
 
+config GPIO_U300
+       bool "ST-Ericsson U300 COH 901 335/571 GPIO"
+       depends on GPIOLIB && ARCH_U300
+       help
+         Say yes here to support GPIO interface on ST-Ericsson U300.
+         The names of the two IP block variants supported are
+         COH 901 335 and COH 901 571/3. They contain 3, 5 or 7
+         ports of 8 GPIO pins each.
+
 config GPIO_VX855
        tristate "VIA VX855/VX875 GPIO"
        depends on MFD_SUPPORT && PCI
index 9588948c96f08b2e8487b6333d7151fd1e914267..19c5d27b6d2e916216594bca14e7243983634bf1 100644 (file)
@@ -14,11 +14,14 @@ obj-$(CONFIG_GPIO_ADP5588)  += gpio-adp5588.o
 obj-$(CONFIG_GPIO_BT8XX)       += gpio-bt8xx.o
 obj-$(CONFIG_GPIO_CS5535)      += gpio-cs5535.o
 obj-$(CONFIG_GPIO_DA9052)      += gpio-da9052.o
+obj-$(CONFIG_ARCH_DAVINCI)     += gpio-davinci.o
 obj-$(CONFIG_GPIO_EP93XX)      += gpio-ep93xx.o
 obj-$(CONFIG_GPIO_EXYNOS4)     += gpio-exynos4.o
 obj-$(CONFIG_GPIO_IT8761E)     += gpio-it8761e.o
 obj-$(CONFIG_GPIO_JANZ_TTL)    += gpio-janz-ttl.o
+obj-$(CONFIG_MACH_KS8695)      += gpio-ks8695.o
 obj-$(CONFIG_GPIO_LANGWELL)    += gpio-langwell.o
+obj-$(CONFIG_ARCH_LPC32XX)     += gpio-lpc32xx.o
 obj-$(CONFIG_GPIO_MAX730X)     += gpio-max730x.o
 obj-$(CONFIG_GPIO_MAX7300)     += gpio-max7300.o
 obj-$(CONFIG_GPIO_MAX7301)     += gpio-max7301.o
@@ -37,18 +40,20 @@ obj-$(CONFIG_GPIO_PCA953X)  += gpio-pca953x.o
 obj-$(CONFIG_GPIO_PCF857X)     += gpio-pcf857x.o
 obj-$(CONFIG_GPIO_PCH)         += gpio-pch.o
 obj-$(CONFIG_GPIO_PL061)       += gpio-pl061.o
+obj-$(CONFIG_PLAT_PXA)         += gpio-pxa.o
 obj-$(CONFIG_GPIO_RDC321X)     += gpio-rdc321x.o
 
 obj-$(CONFIG_GPIO_PLAT_SAMSUNG)        += gpio-plat-samsung.o
 obj-$(CONFIG_GPIO_S5PC100)     += gpio-s5pc100.o
 obj-$(CONFIG_GPIO_S5PV210)     += gpio-s5pv210.o
-
+obj-$(CONFIG_ARCH_SA1100)      += gpio-sa1100.o
 obj-$(CONFIG_GPIO_SCH)         += gpio-sch.o
 obj-$(CONFIG_GPIO_STMPE)       += gpio-stmpe.o
 obj-$(CONFIG_GPIO_SX150X)      += gpio-sx150x.o
 obj-$(CONFIG_GPIO_TC3589X)     += gpio-tc3589x.o
 obj-$(CONFIG_ARCH_TEGRA)       += gpio-tegra.o
 obj-$(CONFIG_GPIO_TIMBERDALE)  += gpio-timberdale.o
+obj-$(CONFIG_ARCH_DAVINCI_TNETV107X) += gpio-tnetv107x.o
 obj-$(CONFIG_GPIO_TPS65910)    += gpio-tps65910.o
 obj-$(CONFIG_GPIO_TPS65912)    += gpio-tps65912.o
 obj-$(CONFIG_GPIO_TWL4030)     += gpio-twl4030.o
similarity index 98%
rename from arch/arm/mach-davinci/gpio.c
rename to drivers/gpio/gpio-davinci.c
index cafbe13a82a5c5bc56e24bf60fd37fae1d324c4c..df0d59570a8410ac4ae1dfa89bed1c016ef3c2e5 100644 (file)
@@ -9,15 +9,13 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  */
-
+#include <linux/gpio.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/io.h>
 
-#include <mach/gpio.h>
-
 #include <asm/mach/irq.h>
 
 struct davinci_gpio_regs {
@@ -232,9 +230,6 @@ static void gpio_irq_enable(struct irq_data *d)
 
 static int gpio_irq_type(struct irq_data *d, unsigned trigger)
 {
-       struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);
-       u32 mask = (u32) irq_data_get_irq_handler_data(d);
-
        if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
                return -EINVAL;
 
index 72fb9c665320804b43c7e9bff8bcd663fdc2ba74..7aafbb4373396661dc1afc15b4606c11c77bb20c 100644 (file)
@@ -23,6 +23,9 @@
 #include <linux/basic_mmio_gpio.h>
 
 #include <mach/hardware.h>
+#include <mach/gpio-ep93xx.h>
+
+#define irq_to_gpio(irq)       ((irq) - gpio_to_irq(0))
 
 struct ep93xx_gpio {
        void __iomem            *mmio_base;
@@ -307,6 +310,21 @@ static int ep93xx_gpio_set_debounce(struct gpio_chip *chip,
        return 0;
 }
 
+/*
+ * Map GPIO A0..A7  (0..7)  to irq 64..71,
+ *          B0..B7  (7..15) to irq 72..79, and
+ *          F0..F7 (16..24) to irq 80..87.
+ */
+static int ep93xx_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
+{
+       int gpio = chip->base + offset;
+
+       if (gpio > EP93XX_GPIO_LINE_MAX_IRQ)
+               return -EINVAL;
+
+       return 64 + gpio;
+}
+
 static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev,
        void __iomem *mmio_base, struct ep93xx_gpio_bank *bank)
 {
@@ -321,8 +339,10 @@ static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev,
        bgc->gc.label = bank->label;
        bgc->gc.base = bank->base;
 
-       if (bank->has_debounce)
+       if (bank->has_debounce) {
                bgc->gc.set_debounce = ep93xx_gpio_set_debounce;
+               bgc->gc.to_irq = ep93xx_gpio_to_irq;
+       }
 
        return gpiochip_add(&bgc->gc);
 }
similarity index 99%
rename from arch/arm/mach-ks8695/gpio.c
rename to drivers/gpio/gpio-ks8695.c
index 31e456508a6f4d83adbf06d256216a717dd1b96c..a3ac66ea364b8cce3f624b9000d4e5c53e906c1b 100644 (file)
@@ -18,7 +18,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/init.h>
@@ -31,7 +31,7 @@
 #include <asm/mach/irq.h>
 
 #include <mach/regs-gpio.h>
-#include <mach/gpio.h>
+#include <mach/gpio-ks8695.h>
 
 /*
  * Configure a GPIO line for either GPIO function, or its internal
similarity index 99%
rename from arch/arm/mach-lpc32xx/gpiolib.c
rename to drivers/gpio/gpio-lpc32xx.c
index 69061ea8997afee70dafdd260c37b1ba49851559..5b6948081f8fb3d953d5f95703ed6dac95f9e23d 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <mach/hardware.h>
 #include <mach/platform.h>
-#include "common.h"
+#include <mach/gpio-lpc32xx.h>
 
 #define LPC32XX_GPIO_P3_INP_STATE              _GPREG(0x000)
 #define LPC32XX_GPIO_P3_OUTP_SET               _GPREG(0x004)
index 2c212c732d76e5e0996fb90a354f33e383ab7297..740caed2b278bc4defd03dccb5444885ec6804d2 100644 (file)
@@ -27,8 +27,9 @@
 #include <asm/mach/irq.h>
 
 #include <plat/pincfg.h>
+#include <plat/gpio-nomadik.h>
 #include <mach/hardware.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 
 /*
  * The GPIO module in the Nomadik family of Systems-on-Chip is an
index 0599854e22171449ed214366140313b4ac38e152..0e49d87f6c60c7b35df327dafd235a394cbb07e5 100644 (file)
@@ -25,7 +25,7 @@
 #include <mach/hardware.h>
 #include <asm/irq.h>
 #include <mach/irqs.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <asm/mach/irq.h>
 
 struct gpio_bank {
@@ -34,8 +34,8 @@ struct gpio_bank {
        u16 irq;
        u16 virtual_irq_start;
        int method;
-#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2PLUS)
        u32 suspend_wakeup;
+#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2PLUS)
        u32 saved_wakeup;
 #endif
        u32 non_wakeup_gpios;
index c43b8ff626a73900b4242833492654de49addf65..0550dcb85814026b9e759abd4c8a81d83b02f9cc 100644 (file)
@@ -577,6 +577,7 @@ pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
 void
 pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
 {
+       *gpio_base = -1;
 }
 #endif
 
similarity index 99%
rename from arch/arm/plat-pxa/gpio.c
rename to drivers/gpio/gpio-pxa.c
index a11dc36705051956d992e30085f41e12dd5f68d7..9052925c6fa2e3f9e69b409ef5a6a353e6f8cf3f 100644 (file)
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <linux/io.h>
 #include <linux/syscore_ops.h>
 #include <linux/slab.h>
 
-#include <mach/gpio.h>
+#include <mach/gpio-pxa.h>
 
 int pxa_last_gpio;
 
similarity index 96%
rename from arch/arm/mach-sa1100/gpio.c
rename to drivers/gpio/gpio-sa1100.c
index 0d3829a8c2c1df94cd2e8ceb3ef8aa751291a336..b6c1f6d80649a93145daef13d6fcfd042fe20e47 100644 (file)
@@ -7,13 +7,11 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/module.h>
 
-#include <asm/gpio.h>
 #include <mach/hardware.h>
-#include "generic.h"
 
 static int sa1100_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
index 747eb40e8afe267dc998a2abed4c96f81f332f49..6b65207c8106d031fd68be1380c0656f35d68969 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <asm/mach/irq.h>
 
+#include <mach/gpio-tegra.h>
 #include <mach/iomap.h>
 #include <mach/suspend.h>
 
@@ -134,7 +135,10 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
        return 0;
 }
 
-
+static int tegra_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
+{
+       return TEGRA_GPIO_TO_IRQ(offset);
+}
 
 static struct gpio_chip tegra_gpio_chip = {
        .label                  = "tegra-gpio",
@@ -142,6 +146,7 @@ static struct gpio_chip tegra_gpio_chip = {
        .get                    = tegra_gpio_get,
        .direction_output       = tegra_gpio_direction_output,
        .set                    = tegra_gpio_set,
+       .to_irq                 = tegra_gpio_to_irq,
        .base                   = 0,
        .ngpio                  = TEGRA_NR_GPIOS,
 };
@@ -331,6 +336,7 @@ static struct lock_class_key gpio_lock_class;
 static int __init tegra_gpio_init(void)
 {
        struct tegra_gpio_bank *bank;
+       int gpio;
        int i;
        int j;
 
@@ -352,14 +358,17 @@ static int __init tegra_gpio_init(void)
 
        gpiochip_add(&tegra_gpio_chip);
 
-       for (i = INT_GPIO_BASE; i < (INT_GPIO_BASE + TEGRA_NR_GPIOS); i++) {
-               bank = &tegra_gpio_banks[GPIO_BANK(irq_to_gpio(i))];
+       for (gpio = 0; gpio < TEGRA_NR_GPIOS; gpio++) {
+               int irq = TEGRA_GPIO_TO_IRQ(gpio);
+               /* No validity check; all Tegra GPIOs are valid IRQs */
+
+               bank = &tegra_gpio_banks[GPIO_BANK(gpio)];
 
-               irq_set_lockdep_class(i, &gpio_lock_class);
-               irq_set_chip_data(i, bank);
-               irq_set_chip_and_handler(i, &tegra_gpio_irq_chip,
+               irq_set_lockdep_class(irq, &gpio_lock_class);
+               irq_set_chip_data(irq, bank);
+               irq_set_chip_and_handler(irq, &tegra_gpio_irq_chip,
                                         handle_simple_irq);
-               set_irq_flags(i, IRQF_VALID);
+               set_irq_flags(irq, IRQF_VALID);
        }
 
        for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) {
index 53e8255cb0bac91dd5562a0c15336257229d015a..4035778852b0d7a1cfbc97d16ab1f8637c1bba59 100644 (file)
@@ -1,18 +1,17 @@
 /*
  * U300 GPIO module.
  *
- * Copyright (C) 2007-2009 ST-Ericsson AB
+ * Copyright (C) 2007-2011 ST-Ericsson AB
  * License terms: GNU General Public License (GPL) version 2
  * This can driver either of the two basic GPIO cores
  * available in the U300 platforms:
  * COH 901 335   - Used in DB3150 (U300 1.0) and DB3200 (U330 1.0)
  * COH 901 571/3 - Used in DB3210 (U365 2.0) and DB3350 (U335 1.0)
- * Notice that you also have inline macros in <asm-arch/gpio.h>
- * Author: Linus Walleij <linus.walleij@stericsson.com>
+ * Author: Linus Walleij <linus.walleij@linaro.org>
  * Author: Jonas Aaberg <jonas.aberg@stericsson.com>
- *
  */
 #include <linux/module.h>
+#include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/err.h>
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
+#include <linux/list.h>
+#include <linux/slab.h>
+#include <mach/gpio-u300.h>
 
-/* Reference to GPIO block clock */
-static struct clk *clk;
+/*
+ * Bias modes for U300 GPIOs
+ *
+ * GPIO_U300_CONFIG_BIAS_UNKNOWN: this bias mode is not known to us
+ * GPIO_U300_CONFIG_BIAS_FLOAT: no specific bias, the GPIO will float or state
+ *     is not controlled by software
+ * GPIO_U300_CONFIG_BIAS_PULL_UP: the GPIO will be pulled up (usually with high
+ *     impedance to VDD)
+ */
+#define GPIO_U300_CONFIG_BIAS_UNKNOWN  0x1000
+#define GPIO_U300_CONFIG_BIAS_FLOAT    0x1001
+#define GPIO_U300_CONFIG_BIAS_PULL_UP  0x1002
 
-/* Memory resource */
-static struct resource *memres;
-static void __iomem *virtbase;
-static struct device *gpiodev;
+/*
+ * Drive modes for U300 GPIOs (output)
+ *
+ * GPIO_U300_CONFIG_DRIVE_PUSH_PULL: the GPIO will be driven actively high and
+ *     low, this is the most typical case and is typically achieved with two
+ *     active transistors on the output
+ * GPIO_U300_CONFIG_DRIVE_OPEN_DRAIN: the GPIO will be driven with open drain
+ *     (open collector) which means it is usually wired with other output
+ *     ports which are then pulled up with an external resistor
+ * GPIO_U300_CONFIG_DRIVE_OPEN_SOURCE: the GPIO will be driven with open drain
+ *     (open emitter) which is the same as open drain mutatis mutandis but
+ *     pulled to ground
+ */
+#define GPIO_U300_CONFIG_DRIVE_PUSH_PULL       0x2000
+#define GPIO_U300_CONFIG_DRIVE_OPEN_DRAIN      0x2001
+#define GPIO_U300_CONFIG_DRIVE_OPEN_SOURCE     0x2002
+
+/*
+ * Register definitions for COH 901 335 variant
+ */
+#define U300_335_PORT_STRIDE                           (0x1C)
+/* Port X Pin Data Register 32bit, this is both input and output (R/W) */
+#define U300_335_PXPDIR                                        (0x00)
+#define U300_335_PXPDOR                                        (0x00)
+/* Port X Pin Config Register 32bit (R/W) */
+#define U300_335_PXPCR                                 (0x04)
+/* This register layout is the same in both blocks */
+#define U300_GPIO_PXPCR_ALL_PINS_MODE_MASK             (0x0000FFFFUL)
+#define U300_GPIO_PXPCR_PIN_MODE_MASK                  (0x00000003UL)
+#define U300_GPIO_PXPCR_PIN_MODE_SHIFT                 (0x00000002UL)
+#define U300_GPIO_PXPCR_PIN_MODE_INPUT                 (0x00000000UL)
+#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL      (0x00000001UL)
+#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN     (0x00000002UL)
+#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE    (0x00000003UL)
+/* Port X Interrupt Event Register 32bit (R/W) */
+#define U300_335_PXIEV                                 (0x08)
+/* Port X Interrupt Enable Register 32bit (R/W) */
+#define U300_335_PXIEN                                 (0x0C)
+/* Port X Interrupt Force Register 32bit (R/W) */
+#define U300_335_PXIFR                                 (0x10)
+/* Port X Interrupt Config Register 32bit (R/W) */
+#define U300_335_PXICR                                 (0x14)
+/* This register layout is the same in both blocks */
+#define U300_GPIO_PXICR_ALL_IRQ_CONFIG_MASK            (0x000000FFUL)
+#define U300_GPIO_PXICR_IRQ_CONFIG_MASK                        (0x00000001UL)
+#define U300_GPIO_PXICR_IRQ_CONFIG_FALLING_EDGE                (0x00000000UL)
+#define U300_GPIO_PXICR_IRQ_CONFIG_RISING_EDGE         (0x00000001UL)
+/* Port X Pull-up Enable Register 32bit (R/W) */
+#define U300_335_PXPER                                 (0x18)
+/* This register layout is the same in both blocks */
+#define U300_GPIO_PXPER_ALL_PULL_UP_DISABLE_MASK       (0x000000FFUL)
+#define U300_GPIO_PXPER_PULL_UP_DISABLE                        (0x00000001UL)
+/* Control Register 32bit (R/W) */
+#define U300_335_CR                                    (0x54)
+#define U300_335_CR_BLOCK_CLOCK_ENABLE                 (0x00000001UL)
+
+/*
+ * Register definitions for COH 901 571 / 3 variant
+ */
+#define U300_571_PORT_STRIDE                           (0x30)
+/*
+ * Control Register 32bit (R/W)
+ * bit 15-9 (mask 0x0000FE00) contains the number of cores. 8*cores
+ * gives the number of GPIO pins.
+ * bit 8-2  (mask 0x000001FC) contains the core version ID.
+ */
+#define U300_571_CR                                    (0x00)
+#define U300_571_CR_SYNC_SEL_ENABLE                    (0x00000002UL)
+#define U300_571_CR_BLOCK_CLKRQ_ENABLE                 (0x00000001UL)
+/*
+ * These registers have the same layout and function as the corresponding
+ * COH 901 335 registers, just at different offset.
+ */
+#define U300_571_PXPDIR                                        (0x04)
+#define U300_571_PXPDOR                                        (0x08)
+#define U300_571_PXPCR                                 (0x0C)
+#define U300_571_PXPER                                 (0x10)
+#define U300_571_PXIEV                                 (0x14)
+#define U300_571_PXIEN                                 (0x18)
+#define U300_571_PXIFR                                 (0x1C)
+#define U300_571_PXICR                                 (0x20)
+
+/* 8 bits per port, no version has more than 7 ports */
+#define U300_GPIO_PINS_PER_PORT 8
+#define U300_GPIO_MAX (U300_GPIO_PINS_PER_PORT * 7)
+
+struct u300_gpio {
+       struct gpio_chip chip;
+       struct list_head port_list;
+       struct clk *clk;
+       struct resource *memres;
+       void __iomem *base;
+       struct device *dev;
+       int irq_base;
+       u32 stride;
+       /* Register offsets */
+       u32 pcr;
+       u32 dor;
+       u32 dir;
+       u32 per;
+       u32 icr;
+       u32 ien;
+       u32 iev;
+};
 
 struct u300_gpio_port {
-       const char *name;
+       struct list_head node;
+       struct u300_gpio *gpio;
+       char name[8];
        int irq;
        int number;
+       u8 toggle_edge_mode;
 };
 
+/*
+ * Macro to expand to read a specific register found in the "gpio"
+ * struct. It requires the struct u300_gpio *gpio variable to exist in
+ * its context. It calculates the port offset from the given pin
+ * offset, muliplies by the port stride and adds the register offset
+ * so it provides a pointer to the desired register.
+ */
+#define U300_PIN_REG(pin, reg) \
+       (gpio->base + (pin >> 3) * gpio->stride + gpio->reg)
 
-static struct u300_gpio_port gpio_ports[] = {
-       {
-               .name = "gpio0",
-               .number = 0,
-       },
-       {
-               .name = "gpio1",
-               .number = 1,
-       },
-       {
-               .name = "gpio2",
-               .number = 2,
-       },
-#ifdef U300_COH901571_3
-       {
-               .name = "gpio3",
-               .number = 3,
-       },
-       {
-               .name = "gpio4",
-               .number = 4,
-       },
-#ifdef CONFIG_MACH_U300_BS335
-       {
-               .name = "gpio5",
-               .number = 5,
-       },
-       {
-               .name = "gpio6",
-               .number = 6,
-       },
-#endif
-#endif
+/*
+ * Provides a bitmask for a specific gpio pin inside an 8-bit GPIO
+ * register.
+ */
+#define U300_PIN_BIT(pin) \
+       (1 << (pin & 0x07))
 
+struct u300_gpio_confdata {
+       u16 bias_mode;
+       bool output;
+       int outval;
 };
 
+/* BS335 has seven ports of 8 bits each = GPIO pins 0..55 */
+#define BS335_GPIO_NUM_PORTS 7
+/* BS365 has five ports of 8 bits each = GPIO pins 0..39 */
+#define BS365_GPIO_NUM_PORTS 5
 
-#ifdef U300_COH901571_3
+#define U300_FLOATING_INPUT { \
+       .bias_mode = GPIO_U300_CONFIG_BIAS_FLOAT, \
+       .output = false, \
+}
 
-/* Default input value */
-#define DEFAULT_OUTPUT_LOW   0
-#define DEFAULT_OUTPUT_HIGH  1
+#define U300_PULL_UP_INPUT { \
+       .bias_mode = GPIO_U300_CONFIG_BIAS_PULL_UP, \
+       .output = false, \
+}
 
-/* GPIO Pull-Up status */
-#define DISABLE_PULL_UP  0
-#define ENABLE_PULL_UP  1
+#define U300_OUTPUT_LOW { \
+       .output = true, \
+       .outval = 0, \
+}
 
-#define GPIO_NOT_USED 0
-#define GPIO_IN       1
-#define GPIO_OUT      2
+#define U300_OUTPUT_HIGH { \
+       .output = true, \
+       .outval = 1, \
+}
 
-struct u300_gpio_configuration_data {
-       unsigned char pin_usage;
-       unsigned char default_output_value;
-       unsigned char pull_up;
-};
 
 /* Initial configuration */
-const struct u300_gpio_configuration_data
-u300_gpio_config[U300_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = {
-#ifdef CONFIG_MACH_U300_BS335
+static const struct __initdata u300_gpio_confdata
+bs335_gpio_config[BS335_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = {
        /* Port 0, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_HIGH,  DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP}
+               U300_FLOATING_INPUT,
+               U300_OUTPUT_HIGH,
+               U300_FLOATING_INPUT,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
        },
        /* Port 1, pins 0-7 */
        {
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_HIGH,  DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP}
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_PULL_UP_INPUT,
+               U300_FLOATING_INPUT,
+               U300_OUTPUT_HIGH,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
        },
        /* Port 2, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP}
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_OUTPUT_LOW,
+               U300_PULL_UP_INPUT,
+               U300_OUTPUT_LOW,
+               U300_PULL_UP_INPUT,
        },
        /* Port 3, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP}
+               U300_PULL_UP_INPUT,
+               U300_OUTPUT_LOW,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
        },
        /* Port 4, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP}
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
        },
        /* Port 5, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP}
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
        },
        /* Port 6, pind 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP}
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
        }
-#endif
+};
 
-#ifdef CONFIG_MACH_U300_BS365
+static const struct __initdata u300_gpio_confdata
+bs365_gpio_config[BS365_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = {
        /* Port 0, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP}
+               U300_FLOATING_INPUT,
+               U300_OUTPUT_LOW,
+               U300_FLOATING_INPUT,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_PULL_UP_INPUT,
+               U300_FLOATING_INPUT,
        },
        /* Port 1, pins 0-7 */
        {
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_HIGH,  DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP}
+               U300_OUTPUT_LOW,
+               U300_FLOATING_INPUT,
+               U300_OUTPUT_LOW,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_OUTPUT_HIGH,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
        },
        /* Port 2, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP}
+               U300_FLOATING_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
        },
        /* Port 3, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP}
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
        },
        /* Port 4, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
                /* These 4 pins doesn't exist on DB3210 */
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP}
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
        }
-#endif
 };
-#endif
 
-
-/* No users == we can power down GPIO */
-static int gpio_users;
-
-struct gpio_struct {
-       int (*callback)(void *);
-       void *data;
-       int users;
-};
-
-static struct gpio_struct gpio_pin[U300_GPIO_MAX];
-
-/*
- * Let drivers register callback in order to get notified when there is
- * an interrupt on the gpio pin
+/**
+ * to_u300_gpio() - get the pointer to u300_gpio
+ * @chip: the gpio chip member of the structure u300_gpio
  */
-int gpio_register_callback(unsigned gpio, int (*func)(void *arg), void *data)
+static inline struct u300_gpio *to_u300_gpio(struct gpio_chip *chip)
 {
-       if (gpio_pin[gpio].callback)
-               dev_warn(gpiodev, "%s: WARNING: callback already "
-                        "registered for gpio pin#%d\n", __func__, gpio);
-       gpio_pin[gpio].callback = func;
-       gpio_pin[gpio].data = data;
-
-       return 0;
+       return container_of(chip, struct u300_gpio, chip);
 }
-EXPORT_SYMBOL(gpio_register_callback);
 
-int gpio_unregister_callback(unsigned gpio)
+static int u300_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
-       if (!gpio_pin[gpio].callback)
-               dev_warn(gpiodev, "%s: WARNING: callback already "
-                        "unregistered for gpio pin#%d\n", __func__, gpio);
-       gpio_pin[gpio].callback = NULL;
-       gpio_pin[gpio].data = NULL;
+       struct u300_gpio *gpio = to_u300_gpio(chip);
 
-       return 0;
+       return readl(U300_PIN_REG(offset, dir)) & U300_PIN_BIT(offset);
 }
-EXPORT_SYMBOL(gpio_unregister_callback);
 
-/* Non-zero means valid */
-int gpio_is_valid(int number)
+static void u300_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
-       if (number >= 0 &&
-           number < (U300_GPIO_NUM_PORTS * U300_GPIO_PINS_PER_PORT))
-               return 1;
-       return 0;
-}
-EXPORT_SYMBOL(gpio_is_valid);
+       struct u300_gpio *gpio = to_u300_gpio(chip);
+       unsigned long flags;
+       u32 val;
 
-int gpio_request(unsigned gpio, const char *label)
-{
-       if (gpio_pin[gpio].users)
-               return -EINVAL;
-       else
-               gpio_pin[gpio].users++;
+       local_irq_save(flags);
 
-       gpio_users++;
+       val = readl(U300_PIN_REG(offset, dor));
+       if (value)
+               writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, dor));
+       else
+               writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, dor));
 
-       return 0;
+       local_irq_restore(flags);
 }
-EXPORT_SYMBOL(gpio_request);
 
-void gpio_free(unsigned gpio)
+static int u300_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
-       gpio_users--;
-       gpio_pin[gpio].users--;
-       if (unlikely(gpio_pin[gpio].users < 0)) {
-               dev_warn(gpiodev, "warning: gpio#%d release mismatch\n",
-                        gpio);
-               gpio_pin[gpio].users = 0;
-       }
-
-       return;
-}
-EXPORT_SYMBOL(gpio_free);
+       struct u300_gpio *gpio = to_u300_gpio(chip);
+       unsigned long flags;
+       u32 val;
 
-/* This returns zero or nonzero */
-int gpio_get_value(unsigned gpio)
-{
-       return readl(virtbase + U300_GPIO_PXPDIR +
-         PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING) & (1 << (gpio & 0x07));
+       local_irq_save(flags);
+       val = readl(U300_PIN_REG(offset, pcr));
+       /* Mask out this pin, note 2 bits per setting */
+       val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK << ((offset & 0x07) << 1));
+       writel(val, U300_PIN_REG(offset, pcr));
+       local_irq_restore(flags);
+       return 0;
 }
-EXPORT_SYMBOL(gpio_get_value);
 
-/*
- * We hope that the compiler will optimize away the unused branch
- * in case "value" is a constant
- */
-void gpio_set_value(unsigned gpio, int value)
+static int u300_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
+                                     int value)
 {
-       u32 val;
+       struct u300_gpio *gpio = to_u300_gpio(chip);
        unsigned long flags;
+       u32 oldmode;
+       u32 val;
 
        local_irq_save(flags);
-       if (value) {
-               /* set */
-               val = readl(virtbase + U300_GPIO_PXPDOR +
-                 PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING)
-                 & (1 << (gpio & 0x07));
-               writel(val | (1 << (gpio & 0x07)), virtbase +
-                 U300_GPIO_PXPDOR +
-                 PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING);
-       } else {
-               /* clear */
-               val = readl(virtbase + U300_GPIO_PXPDOR +
-                 PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING)
-                 & (1 << (gpio & 0x07));
-               writel(val & ~(1 << (gpio & 0x07)), virtbase +
-                 U300_GPIO_PXPDOR +
-                 PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING);
+       val = readl(U300_PIN_REG(offset, pcr));
+       /*
+        * Drive mode must be set by the special mode set function, set
+        * push/pull mode by default if no mode has been selected.
+        */
+       oldmode = val & (U300_GPIO_PXPCR_PIN_MODE_MASK <<
+                        ((offset & 0x07) << 1));
+       /* mode = 0 means input, else some mode is already set */
+       if (oldmode == 0) {
+               val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK <<
+                        ((offset & 0x07) << 1));
+               val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL
+                       << ((offset & 0x07) << 1));
+               writel(val, U300_PIN_REG(offset, pcr));
        }
+       u300_gpio_set(chip, offset, value);
        local_irq_restore(flags);
+       return 0;
 }
-EXPORT_SYMBOL(gpio_set_value);
 
-int gpio_direction_input(unsigned gpio)
+static int u300_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 {
+       struct u300_gpio *gpio = to_u300_gpio(chip);
+       int retirq = gpio->irq_base + offset;
+
+       dev_dbg(gpio->dev, "request IRQ for GPIO %d, return %d\n", offset,
+               retirq);
+       return retirq;
+}
+
+static int u300_gpio_config(struct gpio_chip *chip, unsigned offset,
+                    u16 param, unsigned long *data)
+{
+       struct u300_gpio *gpio = to_u300_gpio(chip);
        unsigned long flags;
        u32 val;
 
-       if (gpio > U300_GPIO_MAX)
-               return -EINVAL;
-
        local_irq_save(flags);
-       val = readl(virtbase + U300_GPIO_PXPCR + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
-       /* Mask out this pin*/
-       val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK << ((gpio & 0x07) << 1));
-       /* This is not needed since it sets the bits to zero.*/
-       /* val |= (U300_GPIO_PXPCR_PIN_MODE_INPUT << (gpio*2)); */
-       writel(val, virtbase + U300_GPIO_PXPCR + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
+       switch (param) {
+       case GPIO_U300_CONFIG_BIAS_UNKNOWN:
+       case GPIO_U300_CONFIG_BIAS_FLOAT:
+               val = readl(U300_PIN_REG(offset, per));
+               writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, per));
+               break;
+       case GPIO_U300_CONFIG_BIAS_PULL_UP:
+               val = readl(U300_PIN_REG(offset, per));
+               writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, per));
+               break;
+       case GPIO_U300_CONFIG_DRIVE_PUSH_PULL:
+               val = readl(U300_PIN_REG(offset, pcr));
+               val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK
+                        << ((offset & 0x07) << 1));
+               val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL
+                       << ((offset & 0x07) << 1));
+               writel(val, U300_PIN_REG(offset, pcr));
+               break;
+       case GPIO_U300_CONFIG_DRIVE_OPEN_DRAIN:
+               val = readl(U300_PIN_REG(offset, pcr));
+               val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK
+                        << ((offset & 0x07) << 1));
+               val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN
+                       << ((offset & 0x07) << 1));
+               writel(val, U300_PIN_REG(offset, pcr));
+               break;
+       case GPIO_U300_CONFIG_DRIVE_OPEN_SOURCE:
+               val = readl(U300_PIN_REG(offset, pcr));
+               val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK
+                        << ((offset & 0x07) << 1));
+               val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE
+                       << ((offset & 0x07) << 1));
+               writel(val, U300_PIN_REG(offset, pcr));
+               break;
+       default:
+               local_irq_restore(flags);
+               dev_err(gpio->dev, "illegal configuration requested\n");
+               return -EINVAL;
+       }
        local_irq_restore(flags);
        return 0;
 }
-EXPORT_SYMBOL(gpio_direction_input);
 
-int gpio_direction_output(unsigned gpio, int value)
+static struct gpio_chip u300_gpio_chip = {
+       .label                  = "u300-gpio-chip",
+       .owner                  = THIS_MODULE,
+       .get                    = u300_gpio_get,
+       .set                    = u300_gpio_set,
+       .direction_input        = u300_gpio_direction_input,
+       .direction_output       = u300_gpio_direction_output,
+       .to_irq                 = u300_gpio_to_irq,
+};
+
+static void u300_toggle_trigger(struct u300_gpio *gpio, unsigned offset)
 {
-       unsigned long flags;
        u32 val;
 
-       if (gpio > U300_GPIO_MAX)
-               return -EINVAL;
-
-       local_irq_save(flags);
-       val = readl(virtbase + U300_GPIO_PXPCR + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
-       /* Mask out this pin */
-       val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK << ((gpio & 0x07) << 1));
-       /*
-        * FIXME: configure for push/pull, open drain or open source per pin
-        * in setup. The current driver will only support push/pull.
-        */
-       val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL
-                       << ((gpio & 0x07) << 1));
-       writel(val, virtbase + U300_GPIO_PXPCR + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
-       gpio_set_value(gpio, value);
-       local_irq_restore(flags);
-       return 0;
+       val = readl(U300_PIN_REG(offset, icr));
+       /* Set mode depending on state */
+       if (u300_gpio_get(&gpio->chip, offset)) {
+               /* High now, let's trigger on falling edge next then */
+               writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, icr));
+               dev_dbg(gpio->dev, "next IRQ on falling edge on pin %d\n",
+                       offset);
+       } else {
+               /* Low now, let's trigger on rising edge next then */
+               writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, icr));
+               dev_dbg(gpio->dev, "next IRQ on rising edge on pin %d\n",
+                       offset);
+       }
 }
-EXPORT_SYMBOL(gpio_direction_output);
 
-/*
- * Enable an IRQ, edge is rising edge (!= 0) or falling edge (==0).
- */
-void enable_irq_on_gpio_pin(unsigned gpio, int edge)
+static int u300_gpio_irq_type(struct irq_data *d, unsigned trigger)
 {
+       struct u300_gpio_port *port = irq_data_get_irq_chip_data(d);
+       struct u300_gpio *gpio = port->gpio;
+       int offset = d->irq - gpio->irq_base;
        u32 val;
-       unsigned long flags;
-       local_irq_save(flags);
 
-       val = readl(virtbase + U300_GPIO_PXIEN + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
-       val |= (1 << (gpio & 0x07));
-       writel(val, virtbase + U300_GPIO_PXIEN + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
-       val = readl(virtbase + U300_GPIO_PXICR + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
-       if (edge)
-               val |= (1 << (gpio & 0x07));
-       else
-               val &= ~(1 << (gpio & 0x07));
-       writel(val, virtbase + U300_GPIO_PXICR + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
-       local_irq_restore(flags);
+       if ((trigger & IRQF_TRIGGER_RISING) &&
+           (trigger & IRQF_TRIGGER_FALLING)) {
+               /*
+                * The GPIO block can only trigger on falling OR rising edges,
+                * not both. So we need to toggle the mode whenever the pin
+                * goes from one state to the other with a special state flag
+                */
+               dev_dbg(gpio->dev,
+                       "trigger on both rising and falling edge on pin %d\n",
+                       offset);
+               port->toggle_edge_mode |= U300_PIN_BIT(offset);
+               u300_toggle_trigger(gpio, offset);
+       } else if (trigger & IRQF_TRIGGER_RISING) {
+               dev_dbg(gpio->dev, "trigger on rising edge on pin %d\n",
+                       offset);
+               val = readl(U300_PIN_REG(offset, icr));
+               writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, icr));
+               port->toggle_edge_mode &= ~U300_PIN_BIT(offset);
+       } else if (trigger & IRQF_TRIGGER_FALLING) {
+               dev_dbg(gpio->dev, "trigger on falling edge on pin %d\n",
+                       offset);
+               val = readl(U300_PIN_REG(offset, icr));
+               writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, icr));
+               port->toggle_edge_mode &= ~U300_PIN_BIT(offset);
+       }
+
+       return 0;
 }
-EXPORT_SYMBOL(enable_irq_on_gpio_pin);
 
-void disable_irq_on_gpio_pin(unsigned gpio)
+static void u300_gpio_irq_enable(struct irq_data *d)
 {
+       struct u300_gpio_port *port = irq_data_get_irq_chip_data(d);
+       struct u300_gpio *gpio = port->gpio;
+       int offset = d->irq - gpio->irq_base;
        u32 val;
        unsigned long flags;
 
        local_irq_save(flags);
-       val = readl(virtbase + U300_GPIO_PXIEN + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
-       val &= ~(1 << (gpio & 0x07));
-       writel(val, virtbase + U300_GPIO_PXIEN + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
+       val = readl(U300_PIN_REG(offset, ien));
+       writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, ien));
        local_irq_restore(flags);
 }
-EXPORT_SYMBOL(disable_irq_on_gpio_pin);
 
-/* Enable (value == 0) or disable (value == 1) internal pullup */
-void gpio_pullup(unsigned gpio, int value)
+static void u300_gpio_irq_disable(struct irq_data *d)
 {
+       struct u300_gpio_port *port = irq_data_get_irq_chip_data(d);
+       struct u300_gpio *gpio = port->gpio;
+       int offset = d->irq - gpio->irq_base;
        u32 val;
        unsigned long flags;
 
        local_irq_save(flags);
-       if (value) {
-               val = readl(virtbase + U300_GPIO_PXPER + PIN_TO_PORT(gpio) *
-                                       U300_GPIO_PORTX_SPACING);
-               writel(val | (1 << (gpio & 0x07)), virtbase + U300_GPIO_PXPER +
-                               PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING);
-       } else {
-               val = readl(virtbase + U300_GPIO_PXPER + PIN_TO_PORT(gpio) *
-                                       U300_GPIO_PORTX_SPACING);
-               writel(val & ~(1 << (gpio & 0x07)), virtbase + U300_GPIO_PXPER +
-                               PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING);
-       }
+       val = readl(U300_PIN_REG(offset, ien));
+       writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, ien));
        local_irq_restore(flags);
 }
-EXPORT_SYMBOL(gpio_pullup);
 
-static irqreturn_t gpio_irq_handler(int irq, void *dev_id)
+static struct irq_chip u300_gpio_irqchip = {
+       .name                   = "u300-gpio-irqchip",
+       .irq_enable             = u300_gpio_irq_enable,
+       .irq_disable            = u300_gpio_irq_disable,
+       .irq_set_type           = u300_gpio_irq_type,
+
+};
+
+static void u300_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
 {
-       struct u300_gpio_port *port = dev_id;
-       u32 val;
-       int pin;
+       struct u300_gpio_port *port = irq_get_handler_data(irq);
+       struct u300_gpio *gpio = port->gpio;
+       int pinoffset = port->number << 3; /* get the right stride */
+       unsigned long val;
 
+       desc->irq_data.chip->irq_ack(&desc->irq_data);
        /* Read event register */
-       val = readl(virtbase + U300_GPIO_PXIEV + port->number *
-                               U300_GPIO_PORTX_SPACING);
-       /* Mask with enable register */
-       val &= readl(virtbase + U300_GPIO_PXIEV + port->number *
-                               U300_GPIO_PORTX_SPACING);
+       val = readl(U300_PIN_REG(pinoffset, iev));
        /* Mask relevant bits */
-       val &= U300_GPIO_PXIEV_ALL_IRQ_EVENT_MASK;
+       val &= 0xFFU; /* 8 bits per port */
        /* ACK IRQ (clear event) */
-       writel(val, virtbase + U300_GPIO_PXIEV + port->number *
-                               U300_GPIO_PORTX_SPACING);
-       /* Print message */
-       while (val != 0) {
-               unsigned gpio;
-
-               pin = __ffs(val);
-               /* mask off this pin */
-               val &= ~(1 << pin);
-               gpio = (port->number << 3) + pin;
-
-               if (gpio_pin[gpio].callback)
-                       (void)gpio_pin[gpio].callback(gpio_pin[gpio].data);
-               else
-                       dev_dbg(gpiodev, "stray GPIO IRQ on line %d\n",
-                              gpio);
+       writel(val, U300_PIN_REG(pinoffset, iev));
+
+       /* Call IRQ handler */
+       if (val != 0) {
+               int irqoffset;
+
+               for_each_set_bit(irqoffset, &val, U300_GPIO_PINS_PER_PORT) {
+                       int pin_irq = gpio->irq_base + (port->number << 3)
+                               + irqoffset;
+                       int offset = pinoffset + irqoffset;
+
+                       dev_dbg(gpio->dev, "GPIO IRQ %d on pin %d\n",
+                               pin_irq, offset);
+                       generic_handle_irq(pin_irq);
+                       /*
+                        * Triggering IRQ on both rising and falling edge
+                        * needs mockery
+                        */
+                       if (port->toggle_edge_mode & U300_PIN_BIT(offset))
+                               u300_toggle_trigger(gpio, offset);
+               }
        }
-       return IRQ_HANDLED;
+
+       desc->irq_data.chip->irq_unmask(&desc->irq_data);
 }
 
-static void gpio_set_initial_values(void)
+static void __init u300_gpio_init_pin(struct u300_gpio *gpio,
+                                     int offset,
+                                     const struct u300_gpio_confdata *conf)
 {
-#ifdef U300_COH901571_3
-       int i, j;
-       unsigned long flags;
-       u32 val;
+       /* Set mode: input or output */
+       if (conf->output) {
+               u300_gpio_direction_output(&gpio->chip, offset, conf->outval);
 
-       /* Write default values to all pins */
-       for (i = 0; i < U300_GPIO_NUM_PORTS; i++) {
-               val = 0;
-               for (j = 0; j < 8; j++)
-                       val |= (u32) (u300_gpio_config[i][j].default_output_value != DEFAULT_OUTPUT_LOW) << j;
-               local_irq_save(flags);
-               writel(val, virtbase + U300_GPIO_PXPDOR + i * U300_GPIO_PORTX_SPACING);
-               local_irq_restore(flags);
+               /* Deactivate bias mode for output */
+               u300_gpio_config(&gpio->chip, offset,
+                                GPIO_U300_CONFIG_BIAS_FLOAT,
+                                NULL);
+
+               /* Set drive mode for output */
+               u300_gpio_config(&gpio->chip, offset,
+                                GPIO_U300_CONFIG_DRIVE_PUSH_PULL, NULL);
+
+               dev_dbg(gpio->dev, "set up pin %d as output, value: %d\n",
+                       offset, conf->outval);
+       } else {
+               u300_gpio_direction_input(&gpio->chip, offset);
+
+               /* Always set output low on input pins */
+               u300_gpio_set(&gpio->chip, offset, 0);
+
+               /* Set bias mode for input */
+               u300_gpio_config(&gpio->chip, offset, conf->bias_mode, NULL);
+
+               dev_dbg(gpio->dev, "set up pin %d as input, bias: %04x\n",
+                       offset, conf->bias_mode);
        }
+}
 
-       /*
-        * Put all pins that are set to either 'GPIO_OUT' or 'GPIO_NOT_USED'
-        * to output and 'GPIO_IN' to input for each port. And initialize
-        * default value on outputs.
-        */
-       for (i = 0; i < U300_GPIO_NUM_PORTS; i++) {
-               for (j = 0; j < U300_GPIO_PINS_PER_PORT; j++) {
-                       local_irq_save(flags);
-                       val = readl(virtbase + U300_GPIO_PXPCR +
-                                        i * U300_GPIO_PORTX_SPACING);
-                       /* Mask out this pin */
-                       val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK << (j << 1));
-
-                       if (u300_gpio_config[i][j].pin_usage != GPIO_IN)
-                               val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL << (j << 1));
-                       writel(val, virtbase + U300_GPIO_PXPCR +
-                                        i * U300_GPIO_PORTX_SPACING);
-                       local_irq_restore(flags);
+static void __init u300_gpio_init_coh901571(struct u300_gpio *gpio,
+                                    struct u300_gpio_platform *plat)
+{
+       int i, j;
+
+       /* Write default config and values to all pins */
+       for (i = 0; i < plat->ports; i++) {
+               for (j = 0; j < 8; j++) {
+                       const struct u300_gpio_confdata *conf;
+                       int offset = (i*8) + j;
+
+                       if (plat->variant == U300_GPIO_COH901571_3_BS335)
+                               conf = &bs335_gpio_config[i][j];
+                       else if (plat->variant == U300_GPIO_COH901571_3_BS365)
+                               conf = &bs365_gpio_config[i][j];
+                       else
+                               break;
+
+                       u300_gpio_init_pin(gpio, offset, conf);
                }
        }
+}
 
-       /* Enable or disable the internal pull-ups in the GPIO ASIC block */
-       for (i = 0; i < U300_GPIO_MAX; i++) {
-               val = 0;
-               for (j = 0; j < 8; j++)
-                       val |= (u32)((u300_gpio_config[i][j].pull_up == DISABLE_PULL_UP) << j);
-               local_irq_save(flags);
-               writel(val, virtbase + U300_GPIO_PXPER + i * U300_GPIO_PORTX_SPACING);
-               local_irq_restore(flags);
+static inline void u300_gpio_free_ports(struct u300_gpio *gpio)
+{
+       struct u300_gpio_port *port;
+       struct list_head *p, *n;
+
+       list_for_each_safe(p, n, &gpio->port_list) {
+               port = list_entry(p, struct u300_gpio_port, node);
+               list_del(&port->node);
+               free_irq(port->irq, port);
+               kfree(port);
        }
-#endif
 }
 
-static int __init gpio_probe(struct platform_device *pdev)
+static int __init u300_gpio_probe(struct platform_device *pdev)
 {
-       u32 val;
+       struct u300_gpio_platform *plat = dev_get_platdata(&pdev->dev);
+       struct u300_gpio *gpio;
        int err = 0;
+       int portno;
+       u32 val;
+       u32 ifr;
        int i;
-       int num_irqs;
 
-       gpiodev = &pdev->dev;
-       memset(gpio_pin, 0, sizeof(gpio_pin));
+       gpio = kzalloc(sizeof(struct u300_gpio), GFP_KERNEL);
+       if (gpio == NULL) {
+               dev_err(&pdev->dev, "failed to allocate memory\n");
+               return -ENOMEM;
+       }
+
+       gpio->chip = u300_gpio_chip;
+       gpio->chip.ngpio = plat->ports * U300_GPIO_PINS_PER_PORT;
+       gpio->irq_base = plat->gpio_irq_base;
+       gpio->chip.dev = &pdev->dev;
+       gpio->chip.base = plat->gpio_base;
+       gpio->dev = &pdev->dev;
 
        /* Get GPIO clock */
-       clk = clk_get(&pdev->dev, NULL);
-       if (IS_ERR(clk)) {
-               err = PTR_ERR(clk);
-               dev_err(gpiodev, "could not get GPIO clock\n");
+       gpio->clk = clk_get(gpio->dev, NULL);
+       if (IS_ERR(gpio->clk)) {
+               err = PTR_ERR(gpio->clk);
+               dev_err(gpio->dev, "could not get GPIO clock\n");
                goto err_no_clk;
        }
-       err = clk_enable(clk);
+       err = clk_enable(gpio->clk);
        if (err) {
-               dev_err(gpiodev, "could not enable GPIO clock\n");
+               dev_err(gpio->dev, "could not enable GPIO clock\n");
                goto err_no_clk_enable;
        }
 
-       memres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!memres)
+       gpio->memres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!gpio->memres) {
+               dev_err(gpio->dev, "could not get GPIO memory resource\n");
+               err = -ENODEV;
                goto err_no_resource;
+       }
 
-       if (!request_mem_region(memres->start, resource_size(memres),
+       if (!request_mem_region(gpio->memres->start,
+                               resource_size(gpio->memres),
                                "GPIO Controller")) {
                err = -ENODEV;
                goto err_no_ioregion;
        }
 
-       virtbase = ioremap(memres->start, resource_size(memres));
-       if (!virtbase) {
+       gpio->base = ioremap(gpio->memres->start, resource_size(gpio->memres));
+       if (!gpio->base) {
                err = -ENOMEM;
                goto err_no_ioremap;
        }
-       dev_info(gpiodev, "remapped 0x%08x to %p\n",
-                memres->start, virtbase);
-
-#ifdef U300_COH901335
-       dev_info(gpiodev, "initializing GPIO Controller COH 901 335\n");
-       /* Turn on the GPIO block */
-       writel(U300_GPIO_CR_BLOCK_CLOCK_ENABLE, virtbase + U300_GPIO_CR);
-#endif
-
-#ifdef U300_COH901571_3
-       dev_info(gpiodev, "initializing GPIO Controller COH 901 571/3\n");
-       val = readl(virtbase + U300_GPIO_CR);
-       dev_info(gpiodev, "COH901571/3 block version: %d, " \
-              "number of cores: %d\n",
-              ((val & 0x0000FE00) >> 9),
-              ((val & 0x000001FC) >> 2));
-       writel(U300_GPIO_CR_BLOCK_CLKRQ_ENABLE, virtbase + U300_GPIO_CR);
-#endif
-
-       gpio_set_initial_values();
-
-       for (num_irqs = 0 ; num_irqs < U300_GPIO_NUM_PORTS; num_irqs++) {
-
-               gpio_ports[num_irqs].irq =
-                       platform_get_irq_byname(pdev,
-                                               gpio_ports[num_irqs].name);
-
-               err = request_irq(gpio_ports[num_irqs].irq,
-                                 gpio_irq_handler, IRQF_DISABLED,
-                                 gpio_ports[num_irqs].name,
-                                 &gpio_ports[num_irqs]);
-               if (err) {
-                       dev_err(gpiodev, "cannot allocate IRQ for %s!\n",
-                               gpio_ports[num_irqs].name);
-                       goto err_no_irq;
+
+       if (plat->variant == U300_GPIO_COH901335) {
+               dev_info(gpio->dev,
+                        "initializing GPIO Controller COH 901 335\n");
+               gpio->stride = U300_335_PORT_STRIDE;
+               gpio->pcr = U300_335_PXPCR;
+               gpio->dor = U300_335_PXPDOR;
+               gpio->dir = U300_335_PXPDIR;
+               gpio->per = U300_335_PXPER;
+               gpio->icr = U300_335_PXICR;
+               gpio->ien = U300_335_PXIEN;
+               gpio->iev = U300_335_PXIEV;
+               ifr = U300_335_PXIFR;
+
+               /* Turn on the GPIO block */
+               writel(U300_335_CR_BLOCK_CLOCK_ENABLE,
+                      gpio->base + U300_335_CR);
+       } else if (plat->variant == U300_GPIO_COH901571_3_BS335 ||
+                  plat->variant == U300_GPIO_COH901571_3_BS365) {
+               dev_info(gpio->dev,
+                        "initializing GPIO Controller COH 901 571/3\n");
+               gpio->stride = U300_571_PORT_STRIDE;
+               gpio->pcr = U300_571_PXPCR;
+               gpio->dor = U300_571_PXPDOR;
+               gpio->dir = U300_571_PXPDIR;
+               gpio->per = U300_571_PXPER;
+               gpio->icr = U300_571_PXICR;
+               gpio->ien = U300_571_PXIEN;
+               gpio->iev = U300_571_PXIEV;
+               ifr = U300_571_PXIFR;
+
+               val = readl(gpio->base + U300_571_CR);
+               dev_info(gpio->dev, "COH901571/3 block version: %d, " \
+                        "number of cores: %d totalling %d pins\n",
+                        ((val & 0x000001FC) >> 2),
+                        ((val & 0x0000FE00) >> 9),
+                        ((val & 0x0000FE00) >> 9) * 8);
+               writel(U300_571_CR_BLOCK_CLKRQ_ENABLE,
+                      gpio->base + U300_571_CR);
+               u300_gpio_init_coh901571(gpio, plat);
+       } else {
+               dev_err(gpio->dev, "unknown block variant\n");
+               err = -ENODEV;
+               goto err_unknown_variant;
+       }
+
+       /* Add each port with its IRQ separately */
+       INIT_LIST_HEAD(&gpio->port_list);
+       for (portno = 0 ; portno < plat->ports; portno++) {
+               struct u300_gpio_port *port =
+                       kmalloc(sizeof(struct u300_gpio_port), GFP_KERNEL);
+
+               if (!port) {
+                       dev_err(gpio->dev, "out of memory\n");
+                       err = -ENOMEM;
+                       goto err_no_port;
                }
-               /* Turns off PortX_irq_force */
-               writel(0x0, virtbase + U300_GPIO_PXIFR +
-                                num_irqs * U300_GPIO_PORTX_SPACING);
+
+               snprintf(port->name, 8, "gpio%d", portno);
+               port->number = portno;
+               port->gpio = gpio;
+
+               port->irq = platform_get_irq_byname(pdev,
+                                                   port->name);
+
+               dev_dbg(gpio->dev, "register IRQ %d for %s\n", port->irq,
+                       port->name);
+
+               irq_set_chained_handler(port->irq, u300_gpio_irq_handler);
+               irq_set_handler_data(port->irq, port);
+
+               /* For each GPIO pin set the unique IRQ handler */
+               for (i = 0; i < U300_GPIO_PINS_PER_PORT; i++) {
+                       int irqno = gpio->irq_base + (portno << 3) + i;
+
+                       dev_dbg(gpio->dev, "handler for IRQ %d on %s\n",
+                               irqno, port->name);
+                       irq_set_chip_and_handler(irqno, &u300_gpio_irqchip,
+                                                handle_simple_irq);
+                       set_irq_flags(irqno, IRQF_VALID);
+                       irq_set_chip_data(irqno, port);
+               }
+
+               /* Turns off irq force (test register) for this port */
+               writel(0x0, gpio->base + portno * gpio->stride + ifr);
+
+               list_add_tail(&port->node, &gpio->port_list);
        }
+       dev_dbg(gpio->dev, "initialized %d GPIO ports\n", portno);
+
+       err = gpiochip_add(&gpio->chip);
+       if (err) {
+               dev_err(gpio->dev, "unable to add gpiochip: %d\n", err);
+               goto err_no_chip;
+       }
+
+       platform_set_drvdata(pdev, gpio);
 
        return 0;
 
- err_no_irq:
-       for (i = 0; i < num_irqs; i++)
-               free_irq(gpio_ports[i].irq, &gpio_ports[i]);
-       iounmap(virtbase);
- err_no_ioremap:
-       release_mem_region(memres->start, resource_size(memres));
- err_no_ioregion:
- err_no_resource:
-       clk_disable(clk);
- err_no_clk_enable:
-       clk_put(clk);
- err_no_clk:
-       dev_info(gpiodev, "module ERROR:%d\n", err);
+err_no_chip:
+err_no_port:
+       u300_gpio_free_ports(gpio);
+err_unknown_variant:
+       iounmap(gpio->base);
+err_no_ioremap:
+       release_mem_region(gpio->memres->start, resource_size(gpio->memres));
+err_no_ioregion:
+err_no_resource:
+       clk_disable(gpio->clk);
+err_no_clk_enable:
+       clk_put(gpio->clk);
+err_no_clk:
+       kfree(gpio);
+       dev_info(&pdev->dev, "module ERROR:%d\n", err);
        return err;
 }
 
-static int __exit gpio_remove(struct platform_device *pdev)
+static int __exit u300_gpio_remove(struct platform_device *pdev)
 {
-       int i;
+       struct u300_gpio_platform *plat = dev_get_platdata(&pdev->dev);
+       struct u300_gpio *gpio = platform_get_drvdata(pdev);
+       int err;
 
        /* Turn off the GPIO block */
-       writel(0x00000000U, virtbase + U300_GPIO_CR);
-       for (i = 0 ; i < U300_GPIO_NUM_PORTS; i++)
-               free_irq(gpio_ports[i].irq, &gpio_ports[i]);
-       iounmap(virtbase);
-       release_mem_region(memres->start, resource_size(memres));
-       clk_disable(clk);
-       clk_put(clk);
+       if (plat->variant == U300_GPIO_COH901335)
+               writel(0x00000000U, gpio->base + U300_335_CR);
+       if (plat->variant == U300_GPIO_COH901571_3_BS335 ||
+           plat->variant == U300_GPIO_COH901571_3_BS365)
+               writel(0x00000000U, gpio->base + U300_571_CR);
+
+       err = gpiochip_remove(&gpio->chip);
+       if (err < 0) {
+               dev_err(gpio->dev, "unable to remove gpiochip: %d\n", err);
+               return err;
+       }
+       u300_gpio_free_ports(gpio);
+       iounmap(gpio->base);
+       release_mem_region(gpio->memres->start,
+                          resource_size(gpio->memres));
+       clk_disable(gpio->clk);
+       clk_put(gpio->clk);
+       platform_set_drvdata(pdev, NULL);
+       kfree(gpio);
        return 0;
 }
 
-static struct platform_driver gpio_driver = {
+static struct platform_driver u300_gpio_driver = {
        .driver         = {
                .name   = "u300-gpio",
        },
-       .remove         = __exit_p(gpio_remove),
+       .remove         = __exit_p(u300_gpio_remove),
 };
 
 
 static int __init u300_gpio_init(void)
 {
-       return platform_driver_probe(&gpio_driver, gpio_probe);
+       return platform_driver_probe(&u300_gpio_driver, u300_gpio_probe);
 }
 
 static void __exit u300_gpio_exit(void)
 {
-       platform_driver_unregister(&gpio_driver);
+       platform_driver_unregister(&u300_gpio_driver);
 }
 
 arch_initcall(u300_gpio_init);
 module_exit(u300_gpio_exit);
 
 MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>");
-
-#ifdef U300_COH901571_3
-MODULE_DESCRIPTION("ST-Ericsson AB COH 901 571/3 GPIO driver");
-#endif
-
-#ifdef U300_COH901335
-MODULE_DESCRIPTION("ST-Ericsson AB COH 901 335 GPIO driver");
-#endif
-
+MODULE_DESCRIPTION("ST-Ericsson AB COH 901 335/COH 901 571/3 GPIO driver");
 MODULE_LICENSE("GPL");
index e88c64417a8a74feac92ec9e7e763426f96045ff..14cc88aaf3a757163e8a5c7f371943f945e20912 100644 (file)
@@ -277,7 +277,12 @@ static uint32_t atom_get_src_int(atom_exec_context *ctx, uint8_t attr,
        case ATOM_ARG_FB:
                idx = U8(*ptr);
                (*ptr)++;
-               val = gctx->scratch[((gctx->fb_base + idx) / 4)];
+               if ((gctx->fb_base + (idx * 4)) > gctx->scratch_size_bytes) {
+                       DRM_ERROR("ATOM: fb read beyond scratch region: %d vs. %d\n",
+                                 gctx->fb_base + (idx * 4), gctx->scratch_size_bytes);
+                       val = 0;
+               } else
+                       val = gctx->scratch[(gctx->fb_base / 4) + idx];
                if (print)
                        DEBUG("FB[0x%02X]", idx);
                break;
@@ -531,7 +536,11 @@ static void atom_put_dst(atom_exec_context *ctx, int arg, uint8_t attr,
        case ATOM_ARG_FB:
                idx = U8(*ptr);
                (*ptr)++;
-               gctx->scratch[((gctx->fb_base + idx) / 4)] = val;
+               if ((gctx->fb_base + (idx * 4)) > gctx->scratch_size_bytes) {
+                       DRM_ERROR("ATOM: fb write beyond scratch region: %d vs. %d\n",
+                                 gctx->fb_base + (idx * 4), gctx->scratch_size_bytes);
+               } else
+                       gctx->scratch[(gctx->fb_base / 4) + idx] = val;
                DEBUG("FB[0x%02X]", idx);
                break;
        case ATOM_ARG_PLL:
@@ -1370,11 +1379,13 @@ int atom_allocate_fb_scratch(struct atom_context *ctx)
 
                usage_bytes = firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb * 1024;
        }
+       ctx->scratch_size_bytes = 0;
        if (usage_bytes == 0)
                usage_bytes = 20 * 1024;
        /* allocate some scratch memory */
        ctx->scratch = kzalloc(usage_bytes, GFP_KERNEL);
        if (!ctx->scratch)
                return -ENOMEM;
+       ctx->scratch_size_bytes = usage_bytes;
        return 0;
 }
index a589a55b223e660576a9e393be36c371ed7f2f71..93cfe2086ba023b82b4271b136730a2d3a4cd25d 100644 (file)
@@ -137,6 +137,7 @@ struct atom_context {
        int cs_equal, cs_above;
        int io_mode;
        uint32_t *scratch;
+       int scratch_size_bytes;
 };
 
 extern int atom_debug;
index c742944d38055fad222a2ed9999dee352fd1ee11..a515b2a09d856c1c49d2a38096dda8c76ccc92b5 100644 (file)
@@ -466,7 +466,7 @@ static void atombios_crtc_program_ss(struct drm_crtc *crtc,
                        return;
                }
                args.v2.ucEnable = enable;
-               if ((ss->percentage == 0) || (ss->type & ATOM_EXTERNAL_SS_MASK))
+               if ((ss->percentage == 0) || (ss->type & ATOM_EXTERNAL_SS_MASK) || ASIC_IS_DCE41(rdev))
                        args.v2.ucEnable = ATOM_DISABLE;
        } else if (ASIC_IS_DCE3(rdev)) {
                args.v1.usSpreadSpectrumPercentage = cpu_to_le16(ss->percentage);
index 4da23889fea656a9d958ec52dc17a1df1c8518c5..79e8ebc0530723e9df8a8aa5f448b3b8068fab62 100644 (file)
@@ -129,7 +129,9 @@ static int radeon_dp_aux_native_write(struct radeon_connector *radeon_connector,
        for (retry = 0; retry < 4; retry++) {
                ret = radeon_process_aux_ch(dig_connector->dp_i2c_bus,
                                            msg, msg_bytes, NULL, 0, delay, &ack);
-               if (ret < 0)
+               if (ret == -EBUSY)
+                       continue;
+               else if (ret < 0)
                        return ret;
                if ((ack & AUX_NATIVE_REPLY_MASK) == AUX_NATIVE_REPLY_ACK)
                        return send_bytes;
@@ -160,7 +162,9 @@ static int radeon_dp_aux_native_read(struct radeon_connector *radeon_connector,
        for (retry = 0; retry < 4; retry++) {
                ret = radeon_process_aux_ch(dig_connector->dp_i2c_bus,
                                            msg, msg_bytes, recv, recv_bytes, delay, &ack);
-               if (ret < 0)
+               if (ret == -EBUSY)
+                       continue;
+               else if (ret < 0)
                        return ret;
                if ((ack & AUX_NATIVE_REPLY_MASK) == AUX_NATIVE_REPLY_ACK)
                        return ret;
@@ -236,7 +240,9 @@ int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
        for (retry = 0; retry < 4; retry++) {
                ret = radeon_process_aux_ch(auxch,
                                            msg, msg_bytes, reply, reply_bytes, 0, &ack);
-               if (ret < 0) {
+               if (ret == -EBUSY)
+                       continue;
+               else if (ret < 0) {
                        DRM_DEBUG_KMS("aux_ch failed %d\n", ret);
                        return ret;
                }
index bce63fd329d471fc57c4794e85c7d1cfa7c0e1b1..449c3d8c68367034cfba3bc012c75bcd9a8888e2 100644 (file)
@@ -1303,23 +1303,14 @@ radeon_dp_detect(struct drm_connector *connector, bool force)
                /* get the DPCD from the bridge */
                radeon_dp_getdpcd(radeon_connector);
 
-               if (radeon_hpd_sense(rdev, radeon_connector->hpd.hpd))
-                       ret = connector_status_connected;
-               else {
-                       /* need to setup ddc on the bridge */
-                       if (encoder)
-                               radeon_atom_ext_encoder_setup_ddc(encoder);
+               if (encoder) {
+                       /* setup ddc on the bridge */
+                       radeon_atom_ext_encoder_setup_ddc(encoder);
                        if (radeon_ddc_probe(radeon_connector,
-                                            radeon_connector->requires_extended_probe))
+                                            radeon_connector->requires_extended_probe)) /* try DDC */
                                ret = connector_status_connected;
-               }
-
-               if ((ret == connector_status_disconnected) &&
-                   radeon_connector->dac_load_detect) {
-                       struct drm_encoder *encoder = radeon_best_single_encoder(connector);
-                       struct drm_encoder_helper_funcs *encoder_funcs;
-                       if (encoder) {
-                               encoder_funcs = encoder->helper_private;
+                       else if (radeon_connector->dac_load_detect) { /* try load detection */
+                               struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;
                                ret = encoder_funcs->detect(encoder, connector);
                        }
                }
index 13690f3eb4a4dba8474b6a678b5c0a7f58af8898..eb3f6dc6df835050dfacaae3a663f4a79f7f254c 100644 (file)
@@ -1638,7 +1638,17 @@ atombios_set_encoder_crtc_source(struct drm_encoder *encoder)
                        break;
                case 2:
                        args.v2.ucCRTC = radeon_crtc->crtc_id;
-                       args.v2.ucEncodeMode = atombios_get_encoder_mode(encoder);
+                       if (radeon_encoder_is_dp_bridge(encoder)) {
+                               struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);
+
+                               if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)
+                                       args.v2.ucEncodeMode = ATOM_ENCODER_MODE_LVDS;
+                               else if (connector->connector_type == DRM_MODE_CONNECTOR_VGA)
+                                       args.v2.ucEncodeMode = ATOM_ENCODER_MODE_CRT;
+                               else
+                                       args.v2.ucEncodeMode = atombios_get_encoder_mode(encoder);
+                       } else
+                               args.v2.ucEncodeMode = atombios_get_encoder_mode(encoder);
                        switch (radeon_encoder->encoder_id) {
                        case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
                        case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
@@ -1755,9 +1765,17 @@ static int radeon_atom_pick_dig_encoder(struct drm_encoder *encoder)
        /* DCE4/5 */
        if (ASIC_IS_DCE4(rdev)) {
                dig = radeon_encoder->enc_priv;
-               if (ASIC_IS_DCE41(rdev))
-                       return radeon_crtc->crtc_id;
-               else {
+               if (ASIC_IS_DCE41(rdev)) {
+                       /* ontario follows DCE4 */
+                       if (rdev->family == CHIP_PALM) {
+                               if (dig->linkb)
+                                       return 1;
+                               else
+                                       return 0;
+                       } else
+                               /* llano follows DCE3.2 */
+                               return radeon_crtc->crtc_id;
+               } else {
                        switch (radeon_encoder->encoder_id) {
                        case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
                                if (dig->linkb)
index ae3c6f5dd2b71acee36f863deafc3896a874010e..082fcaea583fb08303d1baab9b68125a1cf31079 100644 (file)
@@ -321,7 +321,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
        struct ttm_mem_type_manager *man = &bdev->man[new_mem->mem_type];
        struct ttm_tt *ttm = bo->ttm;
        struct ttm_mem_reg *old_mem = &bo->mem;
-       struct ttm_mem_reg old_copy;
+       struct ttm_mem_reg old_copy = *old_mem;
        void *old_iomap;
        void *new_iomap;
        int ret;
index f2b377c56a3acda506e1efb21837bfa7138879de..36d7f270b14d4e7087bcee9f35235b344cc3618a 100644 (file)
@@ -390,7 +390,7 @@ temp_from_reg(u16 reg, s16 regval)
 {
        if (is_word_sized(reg))
                return LM75_TEMP_FROM_REG(regval);
-       return regval * 1000;
+       return ((s8)regval) * 1000;
 }
 
 static inline u16
@@ -398,7 +398,8 @@ temp_to_reg(u16 reg, long temp)
 {
        if (is_word_sized(reg))
                return LM75_TEMP_TO_REG(temp);
-       return DIV_ROUND_CLOSEST(SENSORS_LIMIT(temp, -127000, 128000), 1000);
+       return (s8)DIV_ROUND_CLOSEST(SENSORS_LIMIT(temp, -127000, 128000),
+                                    1000);
 }
 
 /* Some of analog inputs have internal scaling (2x), 8mV is ADC LSB */
@@ -1715,7 +1716,8 @@ static void w83627ehf_device_remove_files(struct device *dev)
 }
 
 /* Get the monitoring functions started */
-static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data)
+static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data,
+                                                  enum kinds kind)
 {
        int i;
        u8 tmp, diode;
@@ -1746,10 +1748,16 @@ static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data)
                w83627ehf_write_value(data, W83627EHF_REG_VBAT, tmp | 0x01);
 
        /* Get thermal sensor types */
-       diode = w83627ehf_read_value(data, W83627EHF_REG_DIODE);
+       switch (kind) {
+       case w83627ehf:
+               diode = w83627ehf_read_value(data, W83627EHF_REG_DIODE);
+               break;
+       default:
+               diode = 0x70;
+       }
        for (i = 0; i < 3; i++) {
                if ((tmp & (0x02 << i)))
-                       data->temp_type[i] = (diode & (0x10 << i)) ? 1 : 2;
+                       data->temp_type[i] = (diode & (0x10 << i)) ? 1 : 3;
                else
                        data->temp_type[i] = 4; /* thermistor */
        }
@@ -2016,7 +2024,7 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
        }
 
        /* Initialize the chip */
-       w83627ehf_init_device(data);
+       w83627ehf_init_device(data, sio_data->kind);
 
        data->vrm = vid_which_vrm();
        superio_enter(sio_data->sioreg);
index 5d8aed5ec21bb85863743e4855d450403074cf64..c01e9519f6c15ee5df4e8cb32ae44ae234f57482 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/slab.h>
 
 #include <mach/hardware.h>     /* Pick up IXP2000-specific bits */
-#include <mach/gpio.h>
+#include <mach/gpio-ixp2000.h>
 
 static inline int ixp2000_scl_pin(void *data)
 {
index 9827c5e686cb380d4a0c79f5c1e7a2a1d3c4c9a4..811dbbd9306c1fe93a04b06178b71f7e6cc9d81b 100644 (file)
@@ -327,7 +327,7 @@ config BLK_DEV_OPTI621
        select BLK_DEV_IDEPCI
        help
          This is a driver for the OPTi 82C621 EIDE controller.
-         Please read the comments at the top of <file:drivers/ide/pci/opti621.c>.
+         Please read the comments at the top of <file:drivers/ide/opti621.c>.
 
 config BLK_DEV_RZ1000
        tristate "RZ1000 chipset bugfix/support"
@@ -365,7 +365,7 @@ config BLK_DEV_ALI15X3
          normal dual channel support.
 
          Please read the comments at the top of
-         <file:drivers/ide/pci/alim15x3.c>.
+         <file:drivers/ide/alim15x3.c>.
 
          If unsure, say N.
 
@@ -528,7 +528,7 @@ config BLK_DEV_NS87415
          This driver adds detection and support for the NS87415 chip
          (used mainly on SPARC64 and PA-RISC machines).
 
-         Please read the comments at the top of <file:drivers/ide/pci/ns87415.c>.
+         Please read the comments at the top of <file:drivers/ide/ns87415.c>.
 
 config BLK_DEV_PDC202XX_OLD
        tristate "PROMISE PDC202{46|62|65|67} support"
@@ -547,7 +547,7 @@ config BLK_DEV_PDC202XX_OLD
          for more than one card.
 
          Please read the comments at the top of
-         <file:drivers/ide/pci/pdc202xx_old.c>.
+         <file:drivers/ide/pdc202xx_old.c>.
 
          If unsure, say N.
 
@@ -593,7 +593,7 @@ config BLK_DEV_SIS5513
          ATA100: SiS635, SiS645, SiS650, SiS730, SiS735, SiS740,
          SiS745, SiS750
 
-         Please read the comments at the top of <file:drivers/ide/pci/sis5513.c>.
+         Please read the comments at the top of <file:drivers/ide/sis5513.c>.
 
 config BLK_DEV_SL82C105
        tristate "Winbond SL82c105 support"
@@ -616,7 +616,7 @@ config BLK_DEV_SLC90E66
          look-a-like to the PIIX4 it should be a nice addition.
 
          Please read the comments at the top of
-         <file:drivers/ide/pci/slc90e66.c>.
+         <file:drivers/ide/slc90e66.c>.
 
 config BLK_DEV_TRM290
        tristate "Tekram TRM290 chipset support"
@@ -625,7 +625,7 @@ config BLK_DEV_TRM290
          This driver adds support for bus master DMA transfers
          using the Tekram TRM290 PCI IDE chip. Volunteers are
          needed for further tweaking and development.
-         Please read the comments at the top of <file:drivers/ide/pci/trm290.c>.
+         Please read the comments at the top of <file:drivers/ide/trm290.c>.
 
 config BLK_DEV_VIA82CXXX
        tristate "VIA82CXXX chipset support"
@@ -836,7 +836,7 @@ config BLK_DEV_ALI14XX
          of the ALI M1439/1443/1445/1487/1489 chipsets, and permits faster
          I/O speeds to be set as well.
          See the files <file:Documentation/ide/ide.txt> and
-         <file:drivers/ide/legacy/ali14xx.c> for more info.
+         <file:drivers/ide/ali14xx.c> for more info.
 
 config BLK_DEV_DTC2278
        tristate "DTC-2278 support"
@@ -847,7 +847,7 @@ config BLK_DEV_DTC2278
          boot parameter. It enables support for the secondary IDE interface
          of the DTC-2278 card, and permits faster I/O speeds to be set as
          well. See the <file:Documentation/ide/ide.txt> and
-         <file:drivers/ide/legacy/dtc2278.c> files for more info.
+         <file:drivers/ide/dtc2278.c> files for more info.
 
 config BLK_DEV_HT6560B
        tristate "Holtek HT6560B support"
@@ -858,7 +858,7 @@ config BLK_DEV_HT6560B
          boot parameter. It enables support for the secondary IDE interface
          of the Holtek card, and permits faster I/O speeds to be set as well.
          See the <file:Documentation/ide/ide.txt> and
-         <file:drivers/ide/legacy/ht6560b.c> files for more info.
+         <file:drivers/ide/ht6560b.c> files for more info.
 
 config BLK_DEV_QD65XX
        tristate "QDI QD65xx support"
@@ -867,7 +867,7 @@ config BLK_DEV_QD65XX
        help
          This driver is enabled at runtime using the "qd65xx.probe" kernel
          boot parameter.  It permits faster I/O speeds to be set.  See the
-         <file:Documentation/ide/ide.txt> and <file:drivers/ide/legacy/qd65xx.c>
+         <file:Documentation/ide/ide.txt> and <file:drivers/ide/qd65xx.c>
          for more info.
 
 config BLK_DEV_UMC8672
@@ -879,7 +879,7 @@ config BLK_DEV_UMC8672
          boot parameter. It enables support for the secondary IDE interface
          of the UMC-8672, and permits faster I/O speeds to be set as well.
          See the files <file:Documentation/ide/ide.txt> and
-         <file:drivers/ide/legacy/umc8672.c> for more info.
+         <file:drivers/ide/umc8672.c> for more info.
 
 endif
 
index 000a78e5246c5c1d9f510fcfbbfc9cf35700137a..6dede8f366c59417b3283cc03b220f6b5c58c97b 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/platform_device.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <mach/at91sam9_smc.h>
 
 #define DRV_NAME "at91_ide"
index 33d0bdc837c099a486e2bffc95dbe0fb6a8ee7c4..323bcdfff2484b6d3ddf22fddcb343216c879ee6 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/mutex.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <plat/keypad.h>
 #include <plat/menelaus.h>
 #include <asm/irq.h>
index 0dc97ec15c28cc59cda96622951c44c0a4fab6fd..9dea71849f40c2694442e3d206fde86f5a1c09fb 100644 (file)
@@ -1124,11 +1124,8 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
                for (i = 0; i < 8; i++)
                        __set_bit(BTN_0 + i, input_dev->keybit);
 
-               if (wacom_wac->features.type != WACOM_21UX2) {
-                       input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
-                       input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
-               }
-
+               input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
+               input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
                input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
 
                __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
index c621c98c99da00886931b3aed1b8364c7de6b958..a88f3cbb100b0621d56aa14fe775c116b8086352 100644 (file)
@@ -306,6 +306,11 @@ static inline bool dma_pte_present(struct dma_pte *pte)
        return (pte->val & 3) != 0;
 }
 
+static inline bool dma_pte_superpage(struct dma_pte *pte)
+{
+       return (pte->val & (1 << 7));
+}
+
 static inline int first_pte_in_page(struct dma_pte *pte)
 {
        return !((unsigned long)pte & ~VTD_PAGE_MASK);
@@ -404,6 +409,9 @@ static int dmar_forcedac;
 static int intel_iommu_strict;
 static int intel_iommu_superpage = 1;
 
+int intel_iommu_gfx_mapped;
+EXPORT_SYMBOL_GPL(intel_iommu_gfx_mapped);
+
 #define DUMMY_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-1))
 static DEFINE_SPINLOCK(device_domain_lock);
 static LIST_HEAD(device_domain_list);
@@ -577,17 +585,18 @@ static void domain_update_iommu_snooping(struct dmar_domain *domain)
 
 static void domain_update_iommu_superpage(struct dmar_domain *domain)
 {
-       int i, mask = 0xf;
+       struct dmar_drhd_unit *drhd;
+       struct intel_iommu *iommu = NULL;
+       int mask = 0xf;
 
        if (!intel_iommu_superpage) {
                domain->iommu_superpage = 0;
                return;
        }
 
-       domain->iommu_superpage = 4; /* 1TiB */
-
-       for_each_set_bit(i, &domain->iommu_bmp, g_num_of_iommus) {
-               mask |= cap_super_page_val(g_iommus[i]->cap);
+       /* set iommu_superpage to the smallest common denominator */
+       for_each_active_iommu(iommu, drhd) {
+               mask &= cap_super_page_val(iommu->cap);
                if (!mask) {
                        break;
                }
@@ -730,29 +739,23 @@ out:
 }
 
 static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain,
-                                     unsigned long pfn, int large_level)
+                                     unsigned long pfn, int target_level)
 {
        int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT;
        struct dma_pte *parent, *pte = NULL;
        int level = agaw_to_level(domain->agaw);
-       int offset, target_level;
+       int offset;
 
        BUG_ON(!domain->pgd);
        BUG_ON(addr_width < BITS_PER_LONG && pfn >> addr_width);
        parent = domain->pgd;
 
-       /* Search pte */
-       if (!large_level)
-               target_level = 1;
-       else
-               target_level = large_level;
-
        while (level > 0) {
                void *tmp_page;
 
                offset = pfn_level_offset(pfn, level);
                pte = &parent[offset];
-               if (!large_level && (pte->val & DMA_PTE_LARGE_PAGE))
+               if (!target_level && (dma_pte_superpage(pte) || !dma_pte_present(pte)))
                        break;
                if (level == target_level)
                        break;
@@ -816,13 +819,14 @@ static struct dma_pte *dma_pfn_level_pte(struct dmar_domain *domain,
 }
 
 /* clear last level pte, a tlb flush should be followed */
-static void dma_pte_clear_range(struct dmar_domain *domain,
+static int dma_pte_clear_range(struct dmar_domain *domain,
                                unsigned long start_pfn,
                                unsigned long last_pfn)
 {
        int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT;
        unsigned int large_page = 1;
        struct dma_pte *first_pte, *pte;
+       int order;
 
        BUG_ON(addr_width < BITS_PER_LONG && start_pfn >> addr_width);
        BUG_ON(addr_width < BITS_PER_LONG && last_pfn >> addr_width);
@@ -846,6 +850,9 @@ static void dma_pte_clear_range(struct dmar_domain *domain,
                                   (void *)pte - (void *)first_pte);
 
        } while (start_pfn && start_pfn <= last_pfn);
+
+       order = (large_page - 1) * 9;
+       return order;
 }
 
 /* free page table pages. last level pte should already be cleared */
@@ -3226,9 +3233,6 @@ static void __init init_no_remapping_devices(void)
                }
        }
 
-       if (dmar_map_gfx)
-               return;
-
        for_each_drhd_unit(drhd) {
                int i;
                if (drhd->ignored || drhd->include_all)
@@ -3236,18 +3240,23 @@ static void __init init_no_remapping_devices(void)
 
                for (i = 0; i < drhd->devices_cnt; i++)
                        if (drhd->devices[i] &&
-                               !IS_GFX_DEVICE(drhd->devices[i]))
+                           !IS_GFX_DEVICE(drhd->devices[i]))
                                break;
 
                if (i < drhd->devices_cnt)
                        continue;
 
-               /* bypass IOMMU if it is just for gfx devices */
-               drhd->ignored = 1;
-               for (i = 0; i < drhd->devices_cnt; i++) {
-                       if (!drhd->devices[i])
-                               continue;
-                       drhd->devices[i]->dev.archdata.iommu = DUMMY_DEVICE_DOMAIN_INFO;
+               /* This IOMMU has *only* gfx devices. Either bypass it or
+                  set the gfx_mapped flag, as appropriate */
+               if (dmar_map_gfx) {
+                       intel_iommu_gfx_mapped = 1;
+               } else {
+                       drhd->ignored = 1;
+                       for (i = 0; i < drhd->devices_cnt; i++) {
+                               if (!drhd->devices[i])
+                                       continue;
+                               drhd->devices[i]->dev.archdata.iommu = DUMMY_DEVICE_DOMAIN_INFO;
+                       }
                }
        }
 }
@@ -3568,6 +3577,8 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain,
                        found = 1;
        }
 
+       spin_unlock_irqrestore(&device_domain_lock, flags);
+
        if (found == 0) {
                unsigned long tmp_flags;
                spin_lock_irqsave(&domain->iommu_lock, tmp_flags);
@@ -3584,8 +3595,6 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain,
                        spin_unlock_irqrestore(&iommu->lock, tmp_flags);
                }
        }
-
-       spin_unlock_irqrestore(&device_domain_lock, flags);
 }
 
 static void vm_domain_remove_all_dev_info(struct dmar_domain *domain)
@@ -3739,6 +3748,7 @@ static int intel_iommu_domain_init(struct iommu_domain *domain)
                vm_domain_exit(dmar_domain);
                return -ENOMEM;
        }
+       domain_update_iommu_cap(dmar_domain);
        domain->priv = dmar_domain;
 
        return 0;
@@ -3864,14 +3874,15 @@ static int intel_iommu_unmap(struct iommu_domain *domain,
 {
        struct dmar_domain *dmar_domain = domain->priv;
        size_t size = PAGE_SIZE << gfp_order;
+       int order;
 
-       dma_pte_clear_range(dmar_domain, iova >> VTD_PAGE_SHIFT,
+       order = dma_pte_clear_range(dmar_domain, iova >> VTD_PAGE_SHIFT,
                            (iova + size - 1) >> VTD_PAGE_SHIFT);
 
        if (dmar_domain->max_addr == iova + size)
                dmar_domain->max_addr = iova;
 
-       return gfp_order;
+       return order;
 }
 
 static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain,
@@ -3950,7 +3961,11 @@ static void __devinit quirk_calpella_no_shadow_gtt(struct pci_dev *dev)
        if (!(ggc & GGC_MEMORY_VT_ENABLED)) {
                printk(KERN_INFO "DMAR: BIOS has allocated no shadow GTT; disabling IOMMU for graphics\n");
                dmar_map_gfx = 0;
-       }
+       } else if (dmar_map_gfx) {
+               /* we have to ensure the gfx device is idle before we flush */
+               printk(KERN_INFO "DMAR: Disabling batched IOTLB flush on Ironlake\n");
+               intel_iommu_strict = 1;
+       }
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x0040, quirk_calpella_no_shadow_gtt);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x0044, quirk_calpella_no_shadow_gtt);
index 49da55c1528aa01137a61c98d6033c9b84dc2e05..8c2a000cf3f5c2f887f7097cb866d0c3e41f2d7d 100644 (file)
@@ -1698,6 +1698,8 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        }
 
        ti->num_flush_requests = 1;
+       ti->discard_zeroes_data_unsupported = 1;
+
        return 0;
 
 bad:
index 89f73ca22cfa112e7c215f9ab5c846de80dd5da4..f84c08029b2154f6362220a5149a337622a23564 100644 (file)
@@ -81,8 +81,10 @@ static int parse_features(struct dm_arg_set *as, struct flakey_c *fc,
                 * corrupt_bio_byte <Nth_byte> <direction> <value> <bio_flags>
                 */
                if (!strcasecmp(arg_name, "corrupt_bio_byte")) {
-                       if (!argc)
+                       if (!argc) {
                                ti->error = "Feature corrupt_bio_byte requires parameters";
+                               return -EINVAL;
+                       }
 
                        r = dm_read_arg(_args + 1, as, &fc->corrupt_bio_byte, &ti->error);
                        if (r)
index f82147029636d87b30e990daa230dfb17ca69c50..32ac70861d66c9827518f723b2b1d8d4138493f9 100644 (file)
@@ -628,6 +628,7 @@ void *dm_kcopyd_prepare_callback(struct dm_kcopyd_client *kc,
        job->kc = kc;
        job->fn = fn;
        job->context = context;
+       job->master_job = job;
 
        atomic_inc(&kc->nr_jobs);
 
index a002dd85db1e674e2efbc188a531f001c2d0716b..86df8b2cf927a07caa30258bc54c8ec7a0c0a694 100644 (file)
@@ -449,7 +449,7 @@ static int parse_raid_params(struct raid_set *rs, char **argv,
                                rs->ti->error = "write_mostly option is only valid for RAID1";
                                return -EINVAL;
                        }
-                       if (value > rs->md.raid_disks) {
+                       if (value >= rs->md.raid_disks) {
                                rs->ti->error = "Invalid write_mostly drive index given";
                                return -EINVAL;
                        }
index 986b8754bb0813c59fb22a0feae7083740378f72..bc04518e9d8b588edc5682442c05e425eb15c451 100644 (file)
@@ -1238,14 +1238,15 @@ static void dm_table_set_integrity(struct dm_table *t)
                return;
 
        template_disk = dm_table_get_integrity_disk(t, true);
-       if (!template_disk &&
-           blk_integrity_is_initialized(dm_disk(t->md))) {
+       if (template_disk)
+               blk_integrity_register(dm_disk(t->md),
+                                      blk_get_integrity(template_disk));
+       else if (blk_integrity_is_initialized(dm_disk(t->md)))
                DMWARN("%s: device no longer has a valid integrity profile",
                       dm_device_name(t->md));
-               return;
-       }
-       blk_integrity_register(dm_disk(t->md),
-                              blk_get_integrity(template_disk));
+       else
+               DMWARN("%s: unable to establish an integrity profile",
+                      dm_device_name(t->md));
 }
 
 static int device_flush_capable(struct dm_target *ti, struct dm_dev *dev,
@@ -1282,6 +1283,22 @@ static bool dm_table_supports_flush(struct dm_table *t, unsigned flush)
        return 0;
 }
 
+static bool dm_table_discard_zeroes_data(struct dm_table *t)
+{
+       struct dm_target *ti;
+       unsigned i = 0;
+
+       /* Ensure that all targets supports discard_zeroes_data. */
+       while (i < dm_table_get_num_targets(t)) {
+               ti = dm_table_get_target(t, i++);
+
+               if (ti->discard_zeroes_data_unsupported)
+                       return 0;
+       }
+
+       return 1;
+}
+
 void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
                               struct queue_limits *limits)
 {
@@ -1304,6 +1321,9 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
        }
        blk_queue_flush(q, flush);
 
+       if (!dm_table_discard_zeroes_data(t))
+               q->limits.discard_zeroes_data = 0;
+
        dm_table_set_integrity(t);
 
        /*
index 5404b229582021c9c3811934ea73c6fa4efa1eca..5c95ccb595007cab1aba9859cc4da62cad80536f 100644 (file)
 static void autostart_arrays(int part);
 #endif
 
+/* pers_list is a list of registered personalities protected
+ * by pers_lock.
+ * pers_lock does extra service to protect accesses to
+ * mddev->thread when the mutex cannot be held.
+ */
 static LIST_HEAD(pers_list);
 static DEFINE_SPINLOCK(pers_lock);
 
@@ -739,7 +744,12 @@ static void mddev_unlock(mddev_t * mddev)
        } else
                mutex_unlock(&mddev->reconfig_mutex);
 
+       /* was we've dropped the mutex we need a spinlock to
+        * make sur the thread doesn't disappear
+        */
+       spin_lock(&pers_lock);
        md_wakeup_thread(mddev->thread);
+       spin_unlock(&pers_lock);
 }
 
 static mdk_rdev_t * find_rdev_nr(mddev_t *mddev, int nr)
@@ -6429,11 +6439,18 @@ mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev,
        return thread;
 }
 
-void md_unregister_thread(mdk_thread_t *thread)
+void md_unregister_thread(mdk_thread_t **threadp)
 {
+       mdk_thread_t *thread = *threadp;
        if (!thread)
                return;
        dprintk("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk));
+       /* Locking ensures that mddev_unlock does not wake_up a
+        * non-existent thread
+        */
+       spin_lock(&pers_lock);
+       *threadp = NULL;
+       spin_unlock(&pers_lock);
 
        kthread_stop(thread->tsk);
        kfree(thread);
@@ -7340,8 +7357,7 @@ static void reap_sync_thread(mddev_t *mddev)
        mdk_rdev_t *rdev;
 
        /* resync has finished, collect result */
-       md_unregister_thread(mddev->sync_thread);
-       mddev->sync_thread = NULL;
+       md_unregister_thread(&mddev->sync_thread);
        if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery) &&
            !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
                /* success...*/
index 1e586bb4452e3011a71cc59ae31e5e96ed63488e..0a309dc29b45a4eed774dd16132aeeef60ac52cd 100644 (file)
@@ -560,7 +560,7 @@ extern int register_md_personality(struct mdk_personality *p);
 extern int unregister_md_personality(struct mdk_personality *p);
 extern mdk_thread_t * md_register_thread(void (*run) (mddev_t *mddev),
                                mddev_t *mddev, const char *name);
-extern void md_unregister_thread(mdk_thread_t *thread);
+extern void md_unregister_thread(mdk_thread_t **threadp);
 extern void md_wakeup_thread(mdk_thread_t *thread);
 extern void md_check_recovery(mddev_t *mddev);
 extern void md_write_start(mddev_t *mddev, struct bio *bi);
index 3535c23af288e8eaac45042eb2e1909af8f0759a..d5b5fb3001717d6c5436389615c38044b9bb3b9a 100644 (file)
@@ -514,8 +514,7 @@ static int multipath_stop (mddev_t *mddev)
 {
        multipath_conf_t *conf = mddev->private;
 
-       md_unregister_thread(mddev->thread);
-       mddev->thread = NULL;
+       md_unregister_thread(&mddev->thread);
        blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
        mempool_destroy(conf->pool);
        kfree(conf->multipaths);
index f4622dd8fc590b2bbcaee444b24ab2f55336503d..d9587dffe533e69c81b6adf5221ee1da745cfa4b 100644 (file)
@@ -2562,8 +2562,7 @@ static int stop(mddev_t *mddev)
        raise_barrier(conf);
        lower_barrier(conf);
 
-       md_unregister_thread(mddev->thread);
-       mddev->thread = NULL;
+       md_unregister_thread(&mddev->thread);
        if (conf->r1bio_pool)
                mempool_destroy(conf->r1bio_pool);
        kfree(conf->mirrors);
index d7a8468ddeabc493284d5acc2f81529f9e638461..0cd9672cf9cbd6032438d4bcb3503bf4794357fc 100644 (file)
@@ -2955,7 +2955,7 @@ static int run(mddev_t *mddev)
        return 0;
 
 out_free_conf:
-       md_unregister_thread(mddev->thread);
+       md_unregister_thread(&mddev->thread);
        if (conf->r10bio_pool)
                mempool_destroy(conf->r10bio_pool);
        safe_put_page(conf->tmppage);
@@ -2973,8 +2973,7 @@ static int stop(mddev_t *mddev)
        raise_barrier(conf, 0);
        lower_barrier(conf);
 
-       md_unregister_thread(mddev->thread);
-       mddev->thread = NULL;
+       md_unregister_thread(&mddev->thread);
        blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
        if (conf->r10bio_pool)
                mempool_destroy(conf->r10bio_pool);
index 43709fa6b6dfc2c30358887aa33e8b51958554b6..ac5e8b57e50fbc2d788c0906263ce30ac56eeb60 100644 (file)
@@ -4941,8 +4941,7 @@ static int run(mddev_t *mddev)
 
        return 0;
 abort:
-       md_unregister_thread(mddev->thread);
-       mddev->thread = NULL;
+       md_unregister_thread(&mddev->thread);
        if (conf) {
                print_raid5_conf(conf);
                free_conf(conf);
@@ -4956,8 +4955,7 @@ static int stop(mddev_t *mddev)
 {
        raid5_conf_t *conf = mddev->private;
 
-       md_unregister_thread(mddev->thread);
-       mddev->thread = NULL;
+       md_unregister_thread(&mddev->thread);
        if (mddev->queue)
                mddev->queue->backing_dev_info.congested_fn = NULL;
        free_conf(conf);
index d72156517726a6dbcecde87796a5cd15bebd1bf4..a5c9ed128b974aaac3e4cba8ac03e4a2292d77d4 100644 (file)
@@ -181,7 +181,7 @@ static void v4l2_device_release(struct device *cd)
         * TODO: In the long run all drivers that use v4l2_device should use the
         * v4l2_device release callback. This check will then be unnecessary.
         */
-       if (v4l2_dev->release == NULL)
+       if (v4l2_dev && v4l2_dev->release == NULL)
                v4l2_dev = NULL;
 
        /* Release video_device and perform other
index 9cee8e7f0bcb1297116667de77ab1d3f49ce1213..af5d9d0613716177bbd0dd53d6940dd5cbe7f596 100644 (file)
@@ -44,7 +44,7 @@
 
 #include <asm/mach/irq.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <plat/menelaus.h>
 
 #define DRIVER_NAME                    "menelaus"
index a6c329040140420ab73ded04fa08c7ca9cdaa07e..2dba999caf2c997ecf0fb3a53dcb47d63c852d74 100644 (file)
@@ -33,7 +33,7 @@
 
 #include <plat/board.h>
 #include <plat/mmc.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <plat/dma.h>
 #include <plat/mux.h>
 #include <plat/fpga.h>
index 18b0bd31de78a661a1839d094e756df9d7ce6762..21b00cefae63f2372dd14ee96453bc9c6f68bd6e 100644 (file)
@@ -21,7 +21,9 @@
 #include <linux/mmc/card.h>
 #include <linux/mmc/host.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
+
+#include <mach/gpio-tegra.h>
 #include <mach/sdhci.h>
 
 #include "sdhci-pltfm.h"
index 78017eb9318ebc7dbbf4c8269b83b3d0ca924e34..9e6b498c9bebb07191d8146f447a89c56d2ca11b 100644 (file)
@@ -26,7 +26,7 @@
 #include <asm/io.h>
 #include <mach/hardware.h>
 #include <asm/sizes.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <plat/board-ams-delta.h>
 
 /*
index a916dec292156a524438b117400837fd7d9f6145..6a1d6d9a2df95454fcb7a0212be53fdaf72936b1 100644 (file)
@@ -40,7 +40,7 @@
 #include <asm/mach/flash.h>
 #include <plat/gpmc.h>
 #include <plat/onenand.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 
 #include <plat/dma.h>
 
index 29dc43523cec2822b9b50902fe005d84d2aa4312..48b4ec121f7f74c86342c2897bec326a07cd5a3f 100644 (file)
@@ -35,7 +35,7 @@
 #include <asm/mach-types.h>
 
 #include <mach/at91rm9200_emac.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <mach/board.h>
 
 #include "at91_ether.h"
index e46df5331c55f4b73d9981270c0aa61769bed784..9a7eb3b36cf3a5b39032fcdb1bde3cd426cb8940 100644 (file)
@@ -239,13 +239,19 @@ void bnx2x_int_disable(struct bnx2x *bp);
  *  FUNC_N_CLID_X = N * NUM_SPECIAL_CLIENTS + FUNC_0_CLID_X
  *
  */
-/* iSCSI L2 */
-#define BNX2X_ISCSI_ETH_CL_ID_IDX      1
-#define BNX2X_ISCSI_ETH_CID            49
+enum {
+       BNX2X_ISCSI_ETH_CL_ID_IDX,
+       BNX2X_FCOE_ETH_CL_ID_IDX,
+       BNX2X_MAX_CNIC_ETH_CL_ID_IDX,
+};
 
-/* FCoE L2 */
-#define BNX2X_FCOE_ETH_CL_ID_IDX       2
-#define BNX2X_FCOE_ETH_CID             50
+#define BNX2X_CNIC_START_ETH_CID       48
+enum {
+       /* iSCSI L2 */
+       BNX2X_ISCSI_ETH_CID = BNX2X_CNIC_START_ETH_CID,
+       /* FCoE L2 */
+       BNX2X_FCOE_ETH_CID,
+};
 
 /** Additional rings budgeting */
 #ifdef BCM_CNIC
index 223bfeebc59798bd76fd2861bd8e87fc003a41b3..2dc1199239d0b35e83da0c9e8b61e216e29e4ab8 100644 (file)
@@ -1297,7 +1297,7 @@ static inline void bnx2x_init_txdata(struct bnx2x *bp,
 static inline u8 bnx2x_cnic_eth_cl_id(struct bnx2x *bp, u8 cl_idx)
 {
        return bp->cnic_base_cl_id + cl_idx +
-               (bp->pf_num >> 1) * NON_ETH_CONTEXT_USE;
+               (bp->pf_num >> 1) * BNX2X_MAX_CNIC_ETH_CL_ID_IDX;
 }
 
 static inline u8 bnx2x_cnic_fw_sb_id(struct bnx2x *bp)
index 6d79b78cfc75594a8d9398bae83ff08bfe36246f..de3d351ccb6b19bc42c73dc2004a9a586fce20bc 100644 (file)
@@ -1435,6 +1435,8 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
        struct sk_buff *skb = *pskb;
        struct slave *slave;
        struct bonding *bond;
+       void (*recv_probe)(struct sk_buff *, struct bonding *,
+                               struct slave *);
 
        skb = skb_share_check(skb, GFP_ATOMIC);
        if (unlikely(!skb))
@@ -1448,11 +1450,12 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
        if (bond->params.arp_interval)
                slave->dev->last_rx = jiffies;
 
-       if (bond->recv_probe) {
+       recv_probe = ACCESS_ONCE(bond->recv_probe);
+       if (recv_probe) {
                struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
 
                if (likely(nskb)) {
-                       bond->recv_probe(nskb, bond, slave);
+                       recv_probe(nskb, bond, slave);
                        dev_kfree_skb(nskb);
                }
        }
index 92feac68b66e725fbe8865d688d0fdabeb8ec1ae..4cc6f44c2ba2c1770ae74f377ed36a4d0e4e995d 100644 (file)
@@ -261,11 +261,13 @@ static netdev_tx_t mscan_start_xmit(struct sk_buff *skb, struct net_device *dev)
                void __iomem *data = &regs->tx.dsr1_0;
                u16 *payload = (u16 *)frame->data;
 
-               /* It is safe to write into dsr[dlc+1] */
-               for (i = 0; i < (frame->can_dlc + 1) / 2; i++) {
+               for (i = 0; i < frame->can_dlc / 2; i++) {
                        out_be16(data, *payload++);
                        data += 2 + _MSCAN_RESERVED_DSR_SIZE;
                }
+               /* write remaining byte if necessary */
+               if (frame->can_dlc & 1)
+                       out_8(data, frame->data[frame->can_dlc - 1]);
        }
 
        out_8(&regs->tx.dlr, frame->can_dlc);
@@ -330,10 +332,13 @@ static void mscan_get_rx_frame(struct net_device *dev, struct can_frame *frame)
                void __iomem *data = &regs->rx.dsr1_0;
                u16 *payload = (u16 *)frame->data;
 
-               for (i = 0; i < (frame->can_dlc + 1) / 2; i++) {
+               for (i = 0; i < frame->can_dlc / 2; i++) {
                        *payload++ = in_be16(data);
                        data += 2 + _MSCAN_RESERVED_DSR_SIZE;
                }
+               /* read remaining byte if necessary */
+               if (frame->can_dlc & 1)
+                       frame->data[frame->can_dlc - 1] = in_8(data);
        }
 
        out_8(&regs->canrflg, MSCAN_RXF);
index 05172c39a0ceaab229c4c89411c7fabc7201ce0c..376e3e94bae075814c90082e692290c9c301ce58 100644 (file)
@@ -239,7 +239,7 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
                dest = macvlan_hash_lookup(port, eth->h_dest);
                if (dest && dest->mode == MACVLAN_MODE_BRIDGE) {
                        /* send to lowerdev first for its network taps */
-                       vlan->forward(vlan->lowerdev, skb);
+                       dev_forward_skb(vlan->lowerdev, skb);
 
                        return NET_XMIT_SUCCESS;
                }
index 6e03de034ac7549bd380fc75c715dcfee0c71f48..f76ab6bf3096580d21e23f16b77547ef15bf7d71 100644 (file)
@@ -172,7 +172,7 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv,
        memset(ring->buf, 0, ring->buf_size);
 
        ring->qp_state = MLX4_QP_STATE_RST;
-       ring->doorbell_qpn = swab32(ring->qp.qpn << 8);
+       ring->doorbell_qpn = ring->qp.qpn << 8;
 
        mlx4_en_fill_qp_context(priv, ring->size, ring->stride, 1, 0, ring->qpn,
                                ring->cqn, &ring->context);
@@ -791,7 +791,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
                skb_orphan(skb);
 
        if (ring->bf_enabled && desc_size <= MAX_BF && !bounce && !vlan_tag) {
-               *(u32 *) (&tx_desc->ctrl.vlan_tag) |= ring->doorbell_qpn;
+               *(__be32 *) (&tx_desc->ctrl.vlan_tag) |= cpu_to_be32(ring->doorbell_qpn);
                op_own |= htonl((bf_index & 0xffff) << 8);
                /* Ensure new descirptor hits memory
                * before setting ownership of this descriptor to HW */
@@ -812,7 +812,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
                wmb();
                tx_desc->ctrl.owner_opcode = op_own;
                wmb();
-               writel(ring->doorbell_qpn, ring->bf.uar->map + MLX4_SEND_DOORBELL);
+               iowrite32be(ring->doorbell_qpn, ring->bf.uar->map + MLX4_SEND_DOORBELL);
        }
 
        /* Poll CQ here */
index ed2a3977c6e781feba473d37b96675c421d68b45..e8882023576b94206d5cc13773c27b3af20761ea 100644 (file)
@@ -307,6 +307,11 @@ static ssize_t store_enabled(struct netconsole_target *nt,
                return err;
        if (enabled < 0 || enabled > 1)
                return -EINVAL;
+       if (enabled == nt->enabled) {
+               printk(KERN_INFO "netconsole: network logging has already %s\n",
+                               nt->enabled ? "started" : "stopped");
+               return -EINVAL;
+       }
 
        if (enabled) {  /* 1 */
 
index eae542a7e987e6e4dd4a54f3d7cb127f3766fc47..89f829f5f7257fcacd54902d3963520ab5b47525 100644 (file)
@@ -285,8 +285,10 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
        ip_send_check(iph);
 
        ip_local_out(skb);
+       return 1;
 
 tx_error:
+       kfree_skb(skb);
        return 1;
 }
 
@@ -305,11 +307,18 @@ static int pptp_rcv_core(struct sock *sk, struct sk_buff *skb)
        }
 
        header = (struct pptp_gre_header *)(skb->data);
+       headersize  = sizeof(*header);
 
        /* test if acknowledgement present */
        if (PPTP_GRE_IS_A(header->ver)) {
-               __u32 ack = (PPTP_GRE_IS_S(header->flags)) ?
-                               header->ack : header->seq; /* ack in different place if S = 0 */
+               __u32 ack;
+
+               if (!pskb_may_pull(skb, headersize))
+                       goto drop;
+               header = (struct pptp_gre_header *)(skb->data);
+
+               /* ack in different place if S = 0 */
+               ack = PPTP_GRE_IS_S(header->flags) ? header->ack : header->seq;
 
                ack = ntohl(ack);
 
@@ -318,21 +327,18 @@ static int pptp_rcv_core(struct sock *sk, struct sk_buff *skb)
                /* also handle sequence number wrap-around  */
                if (WRAPPED(ack, opt->ack_recv))
                        opt->ack_recv = ack;
+       } else {
+               headersize -= sizeof(header->ack);
        }
-
        /* test if payload present */
        if (!PPTP_GRE_IS_S(header->flags))
                goto drop;
 
-       headersize  = sizeof(*header);
        payload_len = ntohs(header->payload_len);
        seq         = ntohl(header->seq);
 
-       /* no ack present? */
-       if (!PPTP_GRE_IS_A(header->ver))
-               headersize -= sizeof(header->ack);
        /* check for incomplete packet (length smaller than expected) */
-       if (skb->len - headersize < payload_len)
+       if (!pskb_may_pull(skb, headersize + payload_len))
                goto drop;
 
        payload = skb->data + headersize;
index c23667017922057bf5d19c4d20fb1543e439f2dc..6d657cabb9514ed503368dcc4e410326e5ff5b08 100644 (file)
@@ -2859,7 +2859,7 @@ static void rtl8168e_2_hw_phy_config(struct rtl8169_private *tp)
        rtl_writephy(tp, 0x1f, 0x0004);
        rtl_writephy(tp, 0x1f, 0x0007);
        rtl_writephy(tp, 0x1e, 0x0020);
-       rtl_w1w0_phy(tp, 0x06, 0x0000, 0x0100);
+       rtl_w1w0_phy(tp, 0x15, 0x0000, 0x0100);
        rtl_writephy(tp, 0x1f, 0x0002);
        rtl_writephy(tp, 0x1f, 0x0000);
        rtl_writephy(tp, 0x0d, 0x0007);
@@ -3316,6 +3316,37 @@ static void __devinit rtl_init_mdio_ops(struct rtl8169_private *tp)
        }
 }
 
+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_29:
+       case RTL_GIGA_MAC_VER_30:
+       case RTL_GIGA_MAC_VER_32:
+       case RTL_GIGA_MAC_VER_33:
+       case RTL_GIGA_MAC_VER_34:
+               RTL_W32(RxConfig, RTL_R32(RxConfig) |
+                       AcceptBroadcast | AcceptMulticast | AcceptMyPhys);
+               break;
+       default:
+               break;
+       }
+}
+
+static bool rtl_wol_pll_power_down(struct rtl8169_private *tp)
+{
+       if (!(__rtl8169_get_wol(tp) & WAKE_ANY))
+               return false;
+
+       rtl_writephy(tp, 0x1f, 0x0000);
+       rtl_writephy(tp, MII_BMCR, 0x0000);
+
+       rtl_wol_suspend_quirk(tp);
+
+       return true;
+}
+
 static void r810x_phy_power_down(struct rtl8169_private *tp)
 {
        rtl_writephy(tp, 0x1f, 0x0000);
@@ -3330,18 +3361,8 @@ static void r810x_phy_power_up(struct rtl8169_private *tp)
 
 static void r810x_pll_power_down(struct rtl8169_private *tp)
 {
-       void __iomem *ioaddr = tp->mmio_addr;
-
-       if (__rtl8169_get_wol(tp) & WAKE_ANY) {
-               rtl_writephy(tp, 0x1f, 0x0000);
-               rtl_writephy(tp, MII_BMCR, 0x0000);
-
-               if (tp->mac_version == RTL_GIGA_MAC_VER_29 ||
-                   tp->mac_version == RTL_GIGA_MAC_VER_30)
-                       RTL_W32(RxConfig, RTL_R32(RxConfig) | AcceptBroadcast |
-                               AcceptMulticast | AcceptMyPhys);
+       if (rtl_wol_pll_power_down(tp))
                return;
-       }
 
        r810x_phy_power_down(tp);
 }
@@ -3430,17 +3451,8 @@ static void r8168_pll_power_down(struct rtl8169_private *tp)
            tp->mac_version == RTL_GIGA_MAC_VER_33)
                rtl_ephy_write(ioaddr, 0x19, 0xff64);
 
-       if (__rtl8169_get_wol(tp) & WAKE_ANY) {
-               rtl_writephy(tp, 0x1f, 0x0000);
-               rtl_writephy(tp, MII_BMCR, 0x0000);
-
-               if (tp->mac_version == RTL_GIGA_MAC_VER_32 ||
-                   tp->mac_version == RTL_GIGA_MAC_VER_33 ||
-                   tp->mac_version == RTL_GIGA_MAC_VER_34)
-                       RTL_W32(RxConfig, RTL_R32(RxConfig) | AcceptBroadcast |
-                               AcceptMulticast | AcceptMyPhys);
+       if (rtl_wol_pll_power_down(tp))
                return;
-       }
 
        r8168_phy_power_down(tp);
 
@@ -5788,11 +5800,30 @@ static const struct dev_pm_ops rtl8169_pm_ops = {
 
 #endif /* !CONFIG_PM */
 
+static void rtl_wol_shutdown_quirk(struct rtl8169_private *tp)
+{
+       void __iomem *ioaddr = tp->mmio_addr;
+
+       /* WoL fails with 8168b when the receiver is disabled. */
+       switch (tp->mac_version) {
+       case RTL_GIGA_MAC_VER_11:
+       case RTL_GIGA_MAC_VER_12:
+       case RTL_GIGA_MAC_VER_17:
+               pci_clear_master(tp->pci_dev);
+
+               RTL_W8(ChipCmd, CmdRxEnb);
+               /* PCI commit */
+               RTL_R8(ChipCmd);
+               break;
+       default:
+               break;
+       }
+}
+
 static void rtl_shutdown(struct pci_dev *pdev)
 {
        struct net_device *dev = pci_get_drvdata(pdev);
        struct rtl8169_private *tp = netdev_priv(dev);
-       void __iomem *ioaddr = tp->mmio_addr;
 
        rtl8169_net_suspend(dev);
 
@@ -5806,16 +5837,9 @@ static void rtl_shutdown(struct pci_dev *pdev)
        spin_unlock_irq(&tp->lock);
 
        if (system_state == SYSTEM_POWER_OFF) {
-               /* WoL fails with 8168b when the receiver is disabled. */
-               if ((tp->mac_version == RTL_GIGA_MAC_VER_11 ||
-                    tp->mac_version == RTL_GIGA_MAC_VER_12 ||
-                    tp->mac_version == RTL_GIGA_MAC_VER_17) &&
-                   (tp->features & RTL_FEATURE_WOL)) {
-                       pci_clear_master(pdev);
-
-                       RTL_W8(ChipCmd, CmdRxEnb);
-                       /* PCI commit */
-                       RTL_R8(ChipCmd);
+               if (__rtl8169_get_wol(tp) & WAKE_ANY) {
+                       rtl_wol_suspend_quirk(tp);
+                       rtl_wol_shutdown_quirk(tp);
                }
 
                pci_wake_from_d3(pdev, true);
index b9016a30cdc55fe6e9d47742ab0d6ba56af9bcf9..c90ddb61cc5661281e3498daf762fecde80287c6 100644 (file)
@@ -26,6 +26,7 @@
  *   LAN9215, LAN9216, LAN9217, LAN9218
  *   LAN9210, LAN9211
  *   LAN9220, LAN9221
+ *   LAN89218
  *
  */
 
@@ -1983,6 +1984,7 @@ static int __devinit smsc911x_init(struct net_device *dev)
        case 0x01170000:
        case 0x01160000:
        case 0x01150000:
+       case 0x218A0000:
                /* LAN911[5678] family */
                pdata->generation = pdata->idrev & 0x0000FFFF;
                break;
index 4a1374df6084ee28bed443b7c60867c1adb13c47..c11a2b8327f301410145f9281bd1ff221d3c6aaf 100644 (file)
@@ -15577,7 +15577,7 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev)
 
                cancel_work_sync(&tp->reset_task);
 
-               if (!tg3_flag(tp, USE_PHYLIB)) {
+               if (tg3_flag(tp, USE_PHYLIB)) {
                        tg3_phy_fini(tp);
                        tg3_mdio_fini(tp);
                }
index 3ff22e32b6020c5f325a1e25f97c68ea84ee3221..f7239b33d7626cff059b7769f08aee1032082db3 100644 (file)
@@ -661,6 +661,90 @@ int of_property_read_string(struct device_node *np, const char *propname,
 }
 EXPORT_SYMBOL_GPL(of_property_read_string);
 
+/**
+ * of_property_read_string_index - Find and read a string from a multiple
+ * strings property.
+ * @np:                device node from which the property value is to be read.
+ * @propname:  name of the property to be searched.
+ * @index:     index of the string in the list of strings
+ * @out_string:        pointer to null terminated return string, modified only if
+ *             return value is 0.
+ *
+ * Search for a property in a device tree node and retrieve a null
+ * terminated string value (pointer to data, not a copy) in the list of strings
+ * contained in that property.
+ * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if
+ * property does not have a value, and -EILSEQ if the string is not
+ * null-terminated within the length of the property data.
+ *
+ * The out_string pointer is modified only if a valid string can be decoded.
+ */
+int of_property_read_string_index(struct device_node *np, const char *propname,
+                                 int index, const char **output)
+{
+       struct property *prop = of_find_property(np, propname, NULL);
+       int i = 0;
+       size_t l = 0, total = 0;
+       const char *p;
+
+       if (!prop)
+               return -EINVAL;
+       if (!prop->value)
+               return -ENODATA;
+       if (strnlen(prop->value, prop->length) >= prop->length)
+               return -EILSEQ;
+
+       p = prop->value;
+
+       for (i = 0; total < prop->length; total += l, p += l) {
+               l = strlen(p) + 1;
+               if ((*p != 0) && (i++ == index)) {
+                       *output = p;
+                       return 0;
+               }
+       }
+       return -ENODATA;
+}
+EXPORT_SYMBOL_GPL(of_property_read_string_index);
+
+
+/**
+ * of_property_count_strings - Find and return the number of strings from a
+ * multiple strings property.
+ * @np:                device node from which the property value is to be read.
+ * @propname:  name of the property to be searched.
+ *
+ * Search for a property in a device tree node and retrieve the number of null
+ * terminated string contain in it. Returns the number of strings on
+ * success, -EINVAL if the property does not exist, -ENODATA if property
+ * does not have a value, and -EILSEQ if the string is not null-terminated
+ * within the length of the property data.
+ */
+int of_property_count_strings(struct device_node *np, const char *propname)
+{
+       struct property *prop = of_find_property(np, propname, NULL);
+       int i = 0;
+       size_t l = 0, total = 0;
+       const char *p;
+
+       if (!prop)
+               return -EINVAL;
+       if (!prop->value)
+               return -ENODATA;
+       if (strnlen(prop->value, prop->length) >= prop->length)
+               return -EILSEQ;
+
+       p = prop->value;
+
+       for (i = 0; total < prop->length; total += l, p += l) {
+               l = strlen(p) + 1;
+               if (*p != 0)
+                       i++;
+       }
+       return i;
+}
+EXPORT_SYMBOL_GPL(of_property_count_strings);
+
 /**
  * of_parse_phandle - Resolve a phandle property to a device_node pointer
  * @np: Pointer to device node holding phandle property
index e956f659089a2c1b91716a7bccdf68f425837131..66ab92cf3105ca4db179f34868bd1416df9a8b04 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <asm/mach-types.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <mach/vpac270.h>
 
 #include "soc_common.h"
index c9e3dc024bc3c2a1248e91c6b34bb47d43688b6b..16ad97df5ba6790b11eb40b1a4eef4fd90325cd1 100644 (file)
@@ -1769,10 +1769,12 @@ static void sas_unregister_devs_sas_addr(struct domain_device *parent,
                sas_disable_routing(parent, phy->attached_sas_addr);
        }
        memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
-       sas_port_delete_phy(phy->port, phy->phy);
-       if (phy->port->num_phys == 0)
-               sas_port_delete(phy->port);
-       phy->port = NULL;
+       if (phy->port) {
+               sas_port_delete_phy(phy->port, phy->phy);
+               if (phy->port->num_phys == 0)
+                       sas_port_delete(phy->port);
+               phy->port = NULL;
+       }
 }
 
 static int sas_discover_bfs_by_root_level(struct domain_device *root,
index 4cace3f20c04f5f0170db61fb6ec5f693a47922b..1e69527f1e4ec21a8e66ab59f7dfb73d26c478dd 100644 (file)
@@ -1328,10 +1328,9 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
                                        qla2x00_sp_compl(ha, sp);
                                } else {
                                        ctx = sp->ctx;
-                                       if (ctx->type == SRB_LOGIN_CMD ||
-                                           ctx->type == SRB_LOGOUT_CMD) {
-                                               ctx->u.iocb_cmd->free(sp);
-                                       } else {
+                                       if (ctx->type == SRB_ELS_CMD_RPT ||
+                                           ctx->type == SRB_ELS_CMD_HST ||
+                                           ctx->type == SRB_CT_CMD) {
                                                struct fc_bsg_job *bsg_job =
                                                    ctx->u.bsg_job;
                                                if (bsg_job->request->msgcode
@@ -1343,6 +1342,8 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
                                                kfree(sp->ctx);
                                                mempool_free(sp,
                                                        ha->srb_mempool);
+                                       } else {
+                                               ctx->u.iocb_cmd->free(sp);
                                        }
                                }
                        }
index 82dee9a6c0de5a7761c95820697963938bbfb3fe..d3bff424286f109c6fcb1f0956096e604b0c0459 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <asm/io.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <mach/cpu.h>
 
 /* SPI register offsets */
index 1a7c19ae766f3968f4f9bc9b575eb0785e6c70d4..8b307b428791915799f06298ce746b5ce002ecf5 100644 (file)
@@ -411,7 +411,8 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
                                skb->protocol = eth_type_trans(skb, dev);
                                skb->dev = dev;
 
-                               if (unlikely(work->word2.s.not_IP || work->word2.s.IP_exc || work->word2.s.L4_error))
+                               if (unlikely(work->word2.s.not_IP || work->word2.s.IP_exc ||
+                                       work->word2.s.L4_error || !work->word2.s.tcp_or_udp))
                                        skb->ip_summed = CHECKSUM_NONE;
                                else
                                        skb->ip_summed = CHECKSUM_UNNECESSARY;
index b922f5d2e61e0cc52d4aea4ba9c81fca0b7fcc52..caba6730a9434b33054260d3aee794cf788a5b6c 100644 (file)
@@ -46,7 +46,7 @@
 
 #ifdef CONFIG_ARM
 #include <mach/cpu.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #endif
 
 #define PDC_BUFFER_SIZE                512
index 58cf279ed87991a9ad6986c515aaad224165d56c..bc95f52cad8b6fa584d720597918c6311cf5ca26 100644 (file)
@@ -478,8 +478,10 @@ lqasc_set_termios(struct uart_port *port,
        spin_unlock_irqrestore(&ltq_asc_lock, flags);
 
        /* Don't rewrite B0 */
-        if (tty_termios_baud_rate(new))
+       if (tty_termios_baud_rate(new))
                tty_termios_encode_baud_rate(new, baud, baud);
+
+       uart_update_timeout(port, cflag, baud);
 }
 
 static const char*
index e6ba83876508e9318843757b15f3b3cba4e77f1c..7767902724542591f15c94ba29c077de17a4adb6 100644 (file)
@@ -19,6 +19,7 @@
 # define SUPPORT_SYSRQ
 #endif
 
+#include <linux/atomic.h>
 #include <linux/hrtimer.h>
 #include <linux/module.h>
 #include <linux/io.h>
@@ -33,6 +34,8 @@
 #include <linux/clk.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #include "msm_serial.h"
 
@@ -589,9 +592,8 @@ static void msm_release_port(struct uart_port *port)
                iowrite32(GSBI_PROTOCOL_IDLE, msm_port->gsbi_base +
                          GSBI_CONTROL);
 
-               gsbi_resource = platform_get_resource_byname(pdev,
-                                                            IORESOURCE_MEM,
-                                                            "gsbi_resource");
+               gsbi_resource = platform_get_resource(pdev,
+                                                       IORESOURCE_MEM, 1);
 
                if (unlikely(!gsbi_resource))
                        return;
@@ -612,8 +614,7 @@ static int msm_request_port(struct uart_port *port)
        resource_size_t size;
        int ret;
 
-       uart_resource = platform_get_resource_byname(pdev, IORESOURCE_MEM,
-                                                    "uart_resource");
+       uart_resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (unlikely(!uart_resource))
                return -ENXIO;
 
@@ -628,8 +629,7 @@ static int msm_request_port(struct uart_port *port)
                goto fail_release_port;
        }
 
-       gsbi_resource = platform_get_resource_byname(pdev, IORESOURCE_MEM,
-                                                    "gsbi_resource");
+       gsbi_resource = platform_get_resource(pdev, IORESOURCE_MEM, 1);
        /* Is this a GSBI-based port? */
        if (gsbi_resource) {
                size = resource_size(gsbi_resource);
@@ -859,6 +859,8 @@ static struct uart_driver msm_uart_driver = {
        .cons = MSM_CONSOLE,
 };
 
+static atomic_t msm_uart_next_id = ATOMIC_INIT(0);
+
 static int __init msm_serial_probe(struct platform_device *pdev)
 {
        struct msm_port *msm_port;
@@ -866,6 +868,9 @@ static int __init msm_serial_probe(struct platform_device *pdev)
        struct uart_port *port;
        int irq;
 
+       if (pdev->id == -1)
+               pdev->id = atomic_inc_return(&msm_uart_next_id) - 1;
+
        if (unlikely(pdev->id < 0 || pdev->id >= UART_NR))
                return -ENXIO;
 
@@ -875,7 +880,7 @@ static int __init msm_serial_probe(struct platform_device *pdev)
        port->dev = &pdev->dev;
        msm_port = UART_TO_MSM(port);
 
-       if (platform_get_resource_byname(pdev, IORESOURCE_MEM, "gsbi_resource"))
+       if (platform_get_resource(pdev, IORESOURCE_MEM, 1))
                msm_port->is_uartdm = 1;
        else
                msm_port->is_uartdm = 0;
@@ -899,8 +904,7 @@ static int __init msm_serial_probe(struct platform_device *pdev)
        printk(KERN_INFO "uartclk = %d\n", port->uartclk);
 
 
-       resource = platform_get_resource_byname(pdev, IORESOURCE_MEM,
-                                                    "uart_resource");
+       resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (unlikely(!resource))
                return -ENXIO;
        port->mapbase = resource->start;
@@ -924,11 +928,17 @@ static int __devexit msm_serial_remove(struct platform_device *pdev)
        return 0;
 }
 
+static struct of_device_id msm_match_table[] = {
+       { .compatible = "qcom,msm-uart" },
+       {}
+};
+
 static struct platform_driver msm_platform_driver = {
        .remove = msm_serial_remove,
        .driver = {
                .name = "msm_serial",
                .owner = THIS_MODULE,
+               .of_match_table = msm_match_table,
        },
 };
 
index 653d6a60edb54e9e748b9e11e18a22192c8e3900..d1b41933199ec0aeaecd19cc67fd26083efbfdc6 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <mach/platform.h>
 #include <mach/irqs.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 
 #define USB_CTRL       IO_ADDRESS(PNX4008_PWRMAN_BASE + 0x64)
 
index 8bdf25a8b023645ec839361cdc18f86dc624c7bb..f9a3f62a83b51d82d9192a4d9325eb0318df689e 100644 (file)
@@ -35,7 +35,7 @@
 
 #include <mach/hardware.h>
 #include <mach/memory.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <mach/cputype.h>
 
 #include <asm/mach-types.h>
index 817ab60f7537266d5f63e2e3ef9bbeb1b108bac5..dda920623c6a45b96886e5729419f9dc1c1d7534 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <mach/board.h>
 #include <mach/cpu.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 
 #include <video/atmel_lcdc.h>
 
index 10459d8bd9a01268f99321aee171d8be0abf4294..4b24f549f9b92dd70d84b48259bf38fdfebf8319 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 
 #include "omapfb.h"
 
index 8df688748b5a5376b6fd6419484e4bbdf296f0ba..622ad839fd9d46701af954235af4b30536f5c9da 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/platform_device.h>
 #include <linux/i2c/tps65010.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include "omapfb.h"
 
 #define MODULE_NAME    "omapfb-lcd_h3"
index 9fff86f67bde401ff475e2ba977db90897c613b0..12cc52a70f9642ad2c7c568b00ecca24cbb084f5 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include "omapfb.h"
 
 #define MODULE_NAME    "omapfb-lcd_h3"
index 0f5952cae85e6b2ddfd47ffd66ac1c0f7c88a919..062466402c0e67531e4fff8dbe6484973b1f7ced 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/delay.h>
 #include <linux/i2c/twl.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <plat/mux.h>
 #include <asm/mach-types.h>
 
index b87e8b83f29c5fe12f40c5c76f14ff1f071baa32..6f8d13c41202a8addf821111d674a9e7fab8f8b9 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <plat/mux.h>
 #include "omapfb.h"
 
index 564933ffac6ef73fc00b7e36bf81ca155f57d9db..b8fd5b2ec29c58899b976ae8a3a331b1ae3b345f 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/platform_device.h>
 #include <linux/i2c/twl.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <plat/mux.h>
 #include <asm/mach-types.h>
 
index ff0e6d7ab3a207b118fed6ffa0d189caae46b838..b51b332e5a2bd16d05833996191034143808af52 100644 (file)
@@ -29,7 +29,7 @@ GPIO13 - screen blanking
 #include <linux/module.h>
 #include <linux/io.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include "omapfb.h"
 
 static int palmtt_panel_init(struct lcd_panel *panel,
index 5ec4f2d439c949efd03f8b6d6024ac77cea81e83..50e00395240f67b43eb93f9c7697c5ff12d60a1a 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/clk.h>
 #include <linux/gfp.h>
 #include <asm/uaccess.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 
 #include "sdum.h"
 #include "fbcommon.h"
index 538f65a79ec5694eb16bd80567238eb320de0703..dae5dfe41ba59fdd820006b96ff4ed2803d51887 100644 (file)
@@ -1047,7 +1047,16 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
        if (!max_to_defrag)
                max_to_defrag = last_index - 1;
 
-       while (i <= last_index && defrag_count < max_to_defrag) {
+       /*
+        * make writeback starts from i, so the defrag range can be
+        * written sequentially.
+        */
+       if (i < inode->i_mapping->writeback_index)
+               inode->i_mapping->writeback_index = i;
+
+       while (i <= last_index && defrag_count < max_to_defrag &&
+              (i < (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >>
+               PAGE_CACHE_SHIFT)) {
                /*
                 * make sure we stop running if someone unmounts
                 * the FS
index f4af4cc3750003e8da20f64e8951dd4dcb7bc049..71beb02019709933015a14449a4dcb37e959e12d 100644 (file)
@@ -2018,7 +2018,7 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info)
                warned_on_ntlm = true;
                cERROR(1, "default security mechanism requested.  The default "
                        "security mechanism will be upgraded from ntlm to "
-                       "ntlmv2 in kernel release 3.1");
+                       "ntlmv2 in kernel release 3.2");
        }
        ses->overrideSecFlg = volume_info->secFlg;
 
index cac2ecfa674684762cce50d5acd323f79b8b4d5a..ef43fce519a1344a20c5aa17dddf3c2869a568cf 100644 (file)
@@ -629,7 +629,7 @@ xfs_buf_item_push(
  * the xfsbufd to get this buffer written. We have to unlock the buffer
  * to allow the xfsbufd to write it, too.
  */
-STATIC void
+STATIC bool
 xfs_buf_item_pushbuf(
        struct xfs_log_item     *lip)
 {
@@ -643,6 +643,7 @@ xfs_buf_item_pushbuf(
 
        xfs_buf_delwri_promote(bp);
        xfs_buf_relse(bp);
+       return true;
 }
 
 STATIC void
index 9e0e2fa3f2c8c532157609229734329cd8a3bbee..bb3f71d236d28fe8e5733e8264e693a0b00692d6 100644 (file)
@@ -183,13 +183,14 @@ xfs_qm_dqunpin_wait(
  * search the buffer cache can be a time consuming thing, and AIL lock is a
  * spinlock.
  */
-STATIC void
+STATIC bool
 xfs_qm_dquot_logitem_pushbuf(
        struct xfs_log_item     *lip)
 {
        struct xfs_dq_logitem   *qlip = DQUOT_ITEM(lip);
        struct xfs_dquot        *dqp = qlip->qli_dquot;
        struct xfs_buf          *bp;
+       bool                    ret = true;
 
        ASSERT(XFS_DQ_IS_LOCKED(dqp));
 
@@ -201,17 +202,20 @@ xfs_qm_dquot_logitem_pushbuf(
        if (completion_done(&dqp->q_flush) ||
            !(lip->li_flags & XFS_LI_IN_AIL)) {
                xfs_dqunlock(dqp);
-               return;
+               return true;
        }
 
        bp = xfs_incore(dqp->q_mount->m_ddev_targp, qlip->qli_format.qlf_blkno,
                        dqp->q_mount->m_quotainfo->qi_dqchunklen, XBF_TRYLOCK);
        xfs_dqunlock(dqp);
        if (!bp)
-               return;
+               return true;
        if (XFS_BUF_ISDELAYWRITE(bp))
                xfs_buf_delwri_promote(bp);
+       if (xfs_buf_ispinned(bp))
+               ret = false;
        xfs_buf_relse(bp);
+       return ret;
 }
 
 /*
index 588406dc6a35a93560c1728465d940b85848d401..836ad80d4f2b5ff606707b07b6182139d67ba94f 100644 (file)
@@ -708,13 +708,14 @@ xfs_inode_item_committed(
  * marked delayed write. If that's the case, we'll promote it and that will
  * allow the caller to write the buffer by triggering the xfsbufd to run.
  */
-STATIC void
+STATIC bool
 xfs_inode_item_pushbuf(
        struct xfs_log_item     *lip)
 {
        struct xfs_inode_log_item *iip = INODE_ITEM(lip);
        struct xfs_inode        *ip = iip->ili_inode;
        struct xfs_buf          *bp;
+       bool                    ret = true;
 
        ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED));
 
@@ -725,7 +726,7 @@ xfs_inode_item_pushbuf(
        if (completion_done(&ip->i_flush) ||
            !(lip->li_flags & XFS_LI_IN_AIL)) {
                xfs_iunlock(ip, XFS_ILOCK_SHARED);
-               return;
+               return true;
        }
 
        bp = xfs_incore(ip->i_mount->m_ddev_targp, iip->ili_format.ilf_blkno,
@@ -733,10 +734,13 @@ xfs_inode_item_pushbuf(
 
        xfs_iunlock(ip, XFS_ILOCK_SHARED);
        if (!bp)
-               return;
+               return true;
        if (XFS_BUF_ISDELAYWRITE(bp))
                xfs_buf_delwri_promote(bp);
+       if (xfs_buf_ispinned(bp))
+               ret = false;
        xfs_buf_relse(bp);
+       return ret;
 }
 
 /*
index 1e8a45e74c3e5826db4bc56c9260e0af583d6262..828662f70d64ec2f0bf43a66a6832c77debbdf18 100644 (file)
@@ -68,6 +68,8 @@
 #include <linux/ctype.h>
 #include <linux/writeback.h>
 #include <linux/capability.h>
+#include <linux/kthread.h>
+#include <linux/freezer.h>
 #include <linux/list_sort.h>
 
 #include <asm/page.h>
index 2366c54cc4fa08b991bf05ef9564ddf4ade54cfd..5cf06b85fd9d8009901354743130569d7bf6539f 100644 (file)
@@ -1652,24 +1652,13 @@ xfs_init_workqueues(void)
         */
        xfs_syncd_wq = alloc_workqueue("xfssyncd", WQ_CPU_INTENSIVE, 8);
        if (!xfs_syncd_wq)
-               goto out;
-
-       xfs_ail_wq = alloc_workqueue("xfsail", WQ_CPU_INTENSIVE, 8);
-       if (!xfs_ail_wq)
-               goto out_destroy_syncd;
-
+               return -ENOMEM;
        return 0;
-
-out_destroy_syncd:
-       destroy_workqueue(xfs_syncd_wq);
-out:
-       return -ENOMEM;
 }
 
 STATIC void
 xfs_destroy_workqueues(void)
 {
-       destroy_workqueue(xfs_ail_wq);
        destroy_workqueue(xfs_syncd_wq);
 }
 
index 06a9759b6352aa497d64396d9ce3fa0900506d3f..53597f4db9b50d9b739ae973d7bb05c6b3ea943b 100644 (file)
@@ -350,7 +350,7 @@ typedef struct xfs_item_ops {
        void (*iop_unlock)(xfs_log_item_t *);
        xfs_lsn_t (*iop_committed)(xfs_log_item_t *, xfs_lsn_t);
        void (*iop_push)(xfs_log_item_t *);
-       void (*iop_pushbuf)(xfs_log_item_t *);
+       bool (*iop_pushbuf)(xfs_log_item_t *);
        void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t);
 } xfs_item_ops_t;
 
index c15aa29fa1696e33608601329be58770f9da78b0..3a1e7ca54c2dc75d73b59c89ca30af4138c40d33 100644 (file)
@@ -28,8 +28,6 @@
 #include "xfs_trans_priv.h"
 #include "xfs_error.h"
 
-struct workqueue_struct        *xfs_ail_wq;    /* AIL workqueue */
-
 #ifdef DEBUG
 /*
  * Check that the list is sorted as it should be.
@@ -356,16 +354,10 @@ xfs_ail_delete(
        xfs_trans_ail_cursor_clear(ailp, lip);
 }
 
-/*
- * xfs_ail_worker does the work of pushing on the AIL. It will requeue itself
- * to run at a later time if there is more work to do to complete the push.
- */
-STATIC void
-xfs_ail_worker(
-       struct work_struct      *work)
+static long
+xfsaild_push(
+       struct xfs_ail          *ailp)
 {
-       struct xfs_ail          *ailp = container_of(to_delayed_work(work),
-                                       struct xfs_ail, xa_work);
        xfs_mount_t             *mp = ailp->xa_mount;
        struct xfs_ail_cursor   cur;
        xfs_log_item_t          *lip;
@@ -427,8 +419,13 @@ xfs_ail_worker(
 
                case XFS_ITEM_PUSHBUF:
                        XFS_STATS_INC(xs_push_ail_pushbuf);
-                       IOP_PUSHBUF(lip);
-                       ailp->xa_last_pushed_lsn = lsn;
+
+                       if (!IOP_PUSHBUF(lip)) {
+                               stuck++;
+                               flush_log = 1;
+                       } else {
+                               ailp->xa_last_pushed_lsn = lsn;
+                       }
                        push_xfsbufd = 1;
                        break;
 
@@ -440,7 +437,6 @@ xfs_ail_worker(
 
                case XFS_ITEM_LOCKED:
                        XFS_STATS_INC(xs_push_ail_locked);
-                       ailp->xa_last_pushed_lsn = lsn;
                        stuck++;
                        break;
 
@@ -501,20 +497,6 @@ out_done:
                /* We're past our target or empty, so idle */
                ailp->xa_last_pushed_lsn = 0;
 
-               /*
-                * We clear the XFS_AIL_PUSHING_BIT first before checking
-                * whether the target has changed. If the target has changed,
-                * this pushes the requeue race directly onto the result of the
-                * atomic test/set bit, so we are guaranteed that either the
-                * the pusher that changed the target or ourselves will requeue
-                * the work (but not both).
-                */
-               clear_bit(XFS_AIL_PUSHING_BIT, &ailp->xa_flags);
-               smp_rmb();
-               if (XFS_LSN_CMP(ailp->xa_target, target) == 0 ||
-                   test_and_set_bit(XFS_AIL_PUSHING_BIT, &ailp->xa_flags))
-                       return;
-
                tout = 50;
        } else if (XFS_LSN_CMP(lsn, target) >= 0) {
                /*
@@ -537,9 +519,30 @@ out_done:
                tout = 20;
        }
 
-       /* There is more to do, requeue us.  */
-       queue_delayed_work(xfs_syncd_wq, &ailp->xa_work,
-                                       msecs_to_jiffies(tout));
+       return tout;
+}
+
+static int
+xfsaild(
+       void            *data)
+{
+       struct xfs_ail  *ailp = data;
+       long            tout = 0;       /* milliseconds */
+
+       while (!kthread_should_stop()) {
+               if (tout && tout <= 20)
+                       __set_current_state(TASK_KILLABLE);
+               else
+                       __set_current_state(TASK_INTERRUPTIBLE);
+               schedule_timeout(tout ?
+                                msecs_to_jiffies(tout) : MAX_SCHEDULE_TIMEOUT);
+
+               try_to_freeze();
+
+               tout = xfsaild_push(ailp);
+       }
+
+       return 0;
 }
 
 /*
@@ -574,8 +577,9 @@ xfs_ail_push(
         */
        smp_wmb();
        xfs_trans_ail_copy_lsn(ailp, &ailp->xa_target, &threshold_lsn);
-       if (!test_and_set_bit(XFS_AIL_PUSHING_BIT, &ailp->xa_flags))
-               queue_delayed_work(xfs_syncd_wq, &ailp->xa_work, 0);
+       smp_wmb();
+
+       wake_up_process(ailp->xa_task);
 }
 
 /*
@@ -813,9 +817,18 @@ xfs_trans_ail_init(
        INIT_LIST_HEAD(&ailp->xa_ail);
        INIT_LIST_HEAD(&ailp->xa_cursors);
        spin_lock_init(&ailp->xa_lock);
-       INIT_DELAYED_WORK(&ailp->xa_work, xfs_ail_worker);
+
+       ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild/%s",
+                       ailp->xa_mount->m_fsname);
+       if (IS_ERR(ailp->xa_task))
+               goto out_free_ailp;
+
        mp->m_ail = ailp;
        return 0;
+
+out_free_ailp:
+       kmem_free(ailp);
+       return ENOMEM;
 }
 
 void
@@ -824,6 +837,6 @@ xfs_trans_ail_destroy(
 {
        struct xfs_ail  *ailp = mp->m_ail;
 
-       cancel_delayed_work_sync(&ailp->xa_work);
+       kthread_stop(ailp->xa_task);
        kmem_free(ailp);
 }
index 212946b97239f895f3dc3b67d28da992e7e884d6..22750b5e4a8f06e41b6d4074024b2847f6d0465d 100644 (file)
@@ -64,23 +64,17 @@ struct xfs_ail_cursor {
  */
 struct xfs_ail {
        struct xfs_mount        *xa_mount;
+       struct task_struct      *xa_task;
        struct list_head        xa_ail;
        xfs_lsn_t               xa_target;
        struct list_head        xa_cursors;
        spinlock_t              xa_lock;
-       struct delayed_work     xa_work;
        xfs_lsn_t               xa_last_pushed_lsn;
-       unsigned long           xa_flags;
 };
 
-#define XFS_AIL_PUSHING_BIT    0
-
 /*
  * From xfs_trans_ail.c
  */
-
-extern struct workqueue_struct *xfs_ail_wq;    /* AIL workqueue */
-
 void   xfs_trans_ail_update_bulk(struct xfs_ail *ailp,
                                struct xfs_ail_cursor *cur,
                                struct xfs_log_item **log_items, int nr_items,
index 3fa1f3d90ce0e21cb3ba27fa98d3201252f91f8e..99e3e50b5c571a3cb9448b69891b95796f1f6ddf 100644 (file)
@@ -197,6 +197,11 @@ struct dm_target {
         * whether or not its underlying devices have support.
         */
        unsigned discards_supported:1;
+
+       /*
+        * Set if this target does not return zeroes on discarded blocks.
+        */
+       unsigned discard_zeroes_data_unsupported:1;
 };
 
 /* Each target can link one of these into the table */
index 9180dc5cb00b02d4e586641ec4f1e64b10d99131..5dfe2d5a8b5dc25401214515f589dff63be2c125 100644 (file)
@@ -203,6 +203,11 @@ extern int of_property_read_u32_array(const struct device_node *np,
 extern int of_property_read_string(struct device_node *np,
                                   const char *propname,
                                   const char **out_string);
+extern int of_property_read_string_index(struct device_node *np,
+                                        const char *propname,
+                                        int index, const char **output);
+extern int of_property_count_strings(struct device_node *np,
+                                    const char *propname);
 extern int of_device_is_compatible(const struct device_node *device,
                                   const char *);
 extern int of_device_is_available(const struct device_node *device);
@@ -256,6 +261,19 @@ static inline int of_property_read_string(struct device_node *np,
        return -ENOSYS;
 }
 
+static inline int of_property_read_string_index(struct device_node *np,
+                                               const char *propname, int index,
+                                               const char **out_string)
+{
+       return -ENOSYS;
+}
+
+static inline int of_property_count_strings(struct device_node *np,
+                                           const char *propname)
+{
+       return -ENOSYS;
+}
+
 static inline const void *of_get_property(const struct device_node *node,
                                const char *name,
                                int *lenp)
index 1aaf915656f3930b0b04253cd9171b3ba49a4d9c..8fa4430f99c14e025ad6a189a1116f72ae831317 100644 (file)
@@ -900,6 +900,7 @@ struct netns_ipvs {
        volatile int            sync_state;
        volatile int            master_syncid;
        volatile int            backup_syncid;
+       struct mutex            sync_mutex;
        /* multicast interface name */
        char                    master_mcast_ifn[IP_VS_IFNAME_MAXLEN];
        char                    backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
index 673a024c6b2ade7b0b1d60cbf580413e0a0ba67f..5f097ca7d5c5ad3904cb72acd2e030f7589d76df 100644 (file)
@@ -66,40 +66,34 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
        return 0;
 }
 
-static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh)
+/* Slow-path computation of checksum. Socket is locked. */
+static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
 {
+       const struct udp_sock *up = udp_sk(skb->sk);
        int cscov = up->len;
+       __wsum csum = 0;
 
-       /*
-        * Sender has set `partial coverage' option on UDP-Lite socket
-        */
-       if (up->pcflag & UDPLITE_SEND_CC)    {
+       if (up->pcflag & UDPLITE_SEND_CC) {
+               /*
+                * Sender has set `partial coverage' option on UDP-Lite socket.
+                * The special case "up->pcslen == 0" signifies full coverage.
+                */
                if (up->pcslen < up->len) {
-               /* up->pcslen == 0 means that full coverage is required,
-                * partial coverage only if  0 < up->pcslen < up->len */
-                       if (0 < up->pcslen) {
-                              cscov = up->pcslen;
-                       }
-                       uh->len = htons(up->pcslen);
+                       if (0 < up->pcslen)
+                               cscov = up->pcslen;
+                       udp_hdr(skb)->len = htons(up->pcslen);
                }
-       /*
-        * NOTE: Causes for the error case  `up->pcslen > up->len':
-        *        (i)  Application error (will not be penalized).
-        *       (ii)  Payload too big for send buffer: data is split
-        *             into several packets, each with its own header.
-        *             In this case (e.g. last segment), coverage may
-        *             exceed packet length.
-        *       Since packets with coverage length > packet length are
-        *       illegal, we fall back to the defaults here.
-        */
+               /*
+                * NOTE: Causes for the error case  `up->pcslen > up->len':
+                *        (i)  Application error (will not be penalized).
+                *       (ii)  Payload too big for send buffer: data is split
+                *             into several packets, each with its own header.
+                *             In this case (e.g. last segment), coverage may
+                *             exceed packet length.
+                *       Since packets with coverage length > packet length are
+                *       illegal, we fall back to the defaults here.
+                */
        }
-       return cscov;
-}
-
-static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
-{
-       int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb));
-       __wsum csum = 0;
 
        skb->ip_summed = CHECKSUM_NONE;     /* no HW support for checksumming */
 
@@ -115,16 +109,21 @@ static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
        return csum;
 }
 
+/* Fast-path computation of checksum. Socket may not be locked. */
 static inline __wsum udplite_csum(struct sk_buff *skb)
 {
-       struct sock *sk = skb->sk;
-       int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb));
+       const struct udp_sock *up = udp_sk(skb->sk);
        const int off = skb_transport_offset(skb);
-       const int len = skb->len - off;
+       int len = skb->len - off;
 
+       if ((up->pcflag & UDPLITE_SEND_CC) && up->pcslen < len) {
+               if (0 < up->pcslen)
+                       len = up->pcslen;
+               udp_hdr(skb)->len = htons(up->pcslen);
+       }
        skb->ip_summed = CHECKSUM_NONE;     /* no HW support for checksumming */
 
-       return skb_checksum(skb, off, min(cscov, len), 0);
+       return skb_checksum(skb, off, len, 0);
 }
 
 extern void    udplite4_register(void);
index c8008dd58ef25da2d46c1563035f7a3801cfb187..640ded8f5c48299e32d30660f47e6dc862eb2933 100644 (file)
@@ -274,9 +274,7 @@ void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times)
        struct task_cputime sum;
        unsigned long flags;
 
-       spin_lock_irqsave(&cputimer->lock, flags);
        if (!cputimer->running) {
-               cputimer->running = 1;
                /*
                 * The POSIX timer interface allows for absolute time expiry
                 * values through the TIMER_ABSTIME flag, therefore we have
@@ -284,8 +282,11 @@ void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times)
                 * it.
                 */
                thread_group_cputime(tsk, &sum);
+               spin_lock_irqsave(&cputimer->lock, flags);
+               cputimer->running = 1;
                update_gt_cputime(&cputimer->cputime, &sum);
-       }
+       } else
+               spin_lock_irqsave(&cputimer->lock, flags);
        *times = cputimer->cputime;
        spin_unlock_irqrestore(&cputimer->lock, flags);
 }
index 18ee1d2f647408a6ffef7494ffdfef2043749dcf..1dbbe695a5efd9eb4f77b8a9fdf6a5da9bf2f795 100644 (file)
@@ -1172,7 +1172,7 @@ DECLARE_RWSEM(uts_sem);
 static int override_release(char __user *release, int len)
 {
        int ret = 0;
-       char buf[len];
+       char buf[65];
 
        if (current->personality & UNAME26) {
                char *rest = UTS_RELEASE;
index 666e4e677414e6d790de715761e395116441e6c4..14d0a6a632f6f8fb2dd0240d35c4853ff67d176d 100644 (file)
@@ -120,10 +120,10 @@ static int remove_migration_pte(struct page *new, struct vm_area_struct *vma,
 
                ptep = pte_offset_map(pmd, addr);
 
-               if (!is_swap_pte(*ptep)) {
-                       pte_unmap(ptep);
-                       goto out;
-               }
+               /*
+                * Peek to check is_swap_pte() before taking ptlock?  No, we
+                * can race mremap's move_ptes(), which skips anon_vma lock.
+                */
 
                ptl = pte_lockptr(mm, pmd);
        }
index 61f1f623091dbcd89992a64a635fc8de62963795..e8292369cdcf68981b4a59969b2c4af41b703f90 100644 (file)
@@ -26,6 +26,8 @@
 
 /* Bluetooth L2CAP sockets. */
 
+#include <linux/security.h>
+
 #include <net/bluetooth/bluetooth.h>
 #include <net/bluetooth/hci_core.h>
 #include <net/bluetooth/l2cap.h>
@@ -933,6 +935,8 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
                chan->force_reliable = pchan->force_reliable;
                chan->flushable = pchan->flushable;
                chan->force_active = pchan->force_active;
+
+               security_sk_clone(parent, sk);
        } else {
 
                switch (sk->sk_type) {
index 482722bbc7a052c67053a95ad357463a5bc641bf..5417f6127323ec0db7cb51d75eb1e643fb8ec339 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/device.h>
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
+#include <linux/security.h>
 #include <net/sock.h>
 
 #include <asm/system.h>
@@ -264,6 +265,8 @@ static void rfcomm_sock_init(struct sock *sk, struct sock *parent)
 
                pi->sec_level = rfcomm_pi(parent)->sec_level;
                pi->role_switch = rfcomm_pi(parent)->role_switch;
+
+               security_sk_clone(parent, sk);
        } else {
                pi->dlc->defer_setup = 0;
 
index 8270f05e3f1f27b0883020eede325df8d17154d0..a324b009e34b7bc1b66a91ce9e3a5188169ec04c 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
 #include <linux/list.h>
+#include <linux/security.h>
 #include <net/sock.h>
 
 #include <asm/system.h>
@@ -403,8 +404,10 @@ static void sco_sock_init(struct sock *sk, struct sock *parent)
 {
        BT_DBG("sk %p", sk);
 
-       if (parent)
+       if (parent) {
                sk->sk_type = parent->sk_type;
+               security_sk_clone(parent, sk);
+       }
 }
 
 static struct proto sco_proto = {
index 32b8f9f7f79e4a5ce555e4c803f7ecd79878006e..ff3ed6086ce1c6b6b4b5111c034d14a208c0d045 100644 (file)
@@ -91,7 +91,6 @@ static int br_dev_open(struct net_device *dev)
 {
        struct net_bridge *br = netdev_priv(dev);
 
-       netif_carrier_off(dev);
        netdev_update_features(dev);
        netif_start_queue(dev);
        br_stp_enable_bridge(br);
@@ -108,8 +107,6 @@ static int br_dev_stop(struct net_device *dev)
 {
        struct net_bridge *br = netdev_priv(dev);
 
-       netif_carrier_off(dev);
-
        br_stp_disable_bridge(br);
        br_multicast_stop(br);
 
index e73815456adf2763f72d15ee649e2a3b1d6052a5..1d420f64ff270b812ec206088d85c43b255a954f 100644 (file)
@@ -161,9 +161,10 @@ static void del_nbp(struct net_bridge_port *p)
        call_rcu(&p->rcu, destroy_nbp_rcu);
 }
 
-/* called with RTNL */
-static void del_br(struct net_bridge *br, struct list_head *head)
+/* Delete bridge device */
+void br_dev_delete(struct net_device *dev, struct list_head *head)
 {
+       struct net_bridge *br = netdev_priv(dev);
        struct net_bridge_port *p, *n;
 
        list_for_each_entry_safe(p, n, &br->port_list, list) {
@@ -268,7 +269,7 @@ int br_del_bridge(struct net *net, const char *name)
        }
 
        else
-               del_br(netdev_priv(dev), NULL);
+               br_dev_delete(dev, NULL);
 
        rtnl_unlock();
        return ret;
@@ -449,7 +450,7 @@ void __net_exit br_net_exit(struct net *net)
        rtnl_lock();
        for_each_netdev(net, dev)
                if (dev->priv_flags & IFF_EBRIDGE)
-                       del_br(netdev_priv(dev), &list);
+                       br_dev_delete(dev, &list);
 
        unregister_netdevice_many(&list);
        rtnl_unlock();
index 5b1ed1ba9aa7bd52a811eb3dbc2ca76d2a2050ac..e5f9ece3c9a0f9637c8ad98382b88705b27e1d30 100644 (file)
@@ -210,6 +210,7 @@ static struct rtnl_link_ops br_link_ops __read_mostly = {
        .priv_size      = sizeof(struct net_bridge),
        .setup          = br_dev_setup,
        .validate       = br_validate,
+       .dellink        = br_dev_delete,
 };
 
 int __init br_netlink_init(void)
index 78cc364997d9888bc4a1e9869c7c64edb6378ee9..857a021deea9fb6b1d2351fe7a8d3b5d84667947 100644 (file)
@@ -294,6 +294,7 @@ static inline int br_is_root_bridge(const struct net_bridge *br)
 
 /* br_device.c */
 extern void br_dev_setup(struct net_device *dev);
+extern void br_dev_delete(struct net_device *dev, struct list_head *list);
 extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,
                               struct net_device *dev);
 #ifdef CONFIG_NET_POLL_CONTROLLER
index 3231b468bb7297ba2c278758f59d741976324556..27071ee2a4e1d1d22569bac55e1eee4411bac5bd 100644 (file)
@@ -475,8 +475,11 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
 
                list_del_rcu(&rule->list);
 
-               if (rule->action == FR_ACT_GOTO)
+               if (rule->action == FR_ACT_GOTO) {
                        ops->nr_goto_rules--;
+                       if (rtnl_dereference(rule->ctarget) == NULL)
+                               ops->unresolved_rules--;
+               }
 
                /*
                 * Check if this rule is a target to any of them. If so,
index 21fab3edb92cde6bbbbb8aff46b09db948ca8b6f..d73aab3fbfc0de018fa8125421caf3014c89dfbc 100644 (file)
@@ -1389,9 +1389,7 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
 
        BUG_ON(!pcount);
 
-       /* Tweak before seqno plays */
-       if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint &&
-           !before(TCP_SKB_CB(tp->lost_skb_hint)->seq, TCP_SKB_CB(skb)->seq))
+       if (skb == tp->lost_skb_hint)
                tp->lost_cnt_hint += pcount;
 
        TCP_SKB_CB(prev)->end_seq += shifted;
index c34f015139453245238e7bd5086c35d5b5a760f4..7963e03f1068d421a8c40489ddee6d1ad0075c80 100644 (file)
@@ -927,18 +927,21 @@ int tcp_v4_md5_do_add(struct sock *sk, __be32 addr,
                        }
                        sk_nocaps_add(sk, NETIF_F_GSO_MASK);
                }
-               if (tcp_alloc_md5sig_pool(sk) == NULL) {
+
+               md5sig = tp->md5sig_info;
+               if (md5sig->entries4 == 0 &&
+                   tcp_alloc_md5sig_pool(sk) == NULL) {
                        kfree(newkey);
                        return -ENOMEM;
                }
-               md5sig = tp->md5sig_info;
 
                if (md5sig->alloced4 == md5sig->entries4) {
                        keys = kmalloc((sizeof(*keys) *
                                        (md5sig->entries4 + 1)), GFP_ATOMIC);
                        if (!keys) {
                                kfree(newkey);
-                               tcp_free_md5sig_pool();
+                               if (md5sig->entries4 == 0)
+                                       tcp_free_md5sig_pool();
                                return -ENOMEM;
                        }
 
@@ -982,6 +985,7 @@ int tcp_v4_md5_do_del(struct sock *sk, __be32 addr)
                                kfree(tp->md5sig_info->keys4);
                                tp->md5sig_info->keys4 = NULL;
                                tp->md5sig_info->alloced4 = 0;
+                               tcp_free_md5sig_pool();
                        } else if (tp->md5sig_info->entries4 != i) {
                                /* Need to do some manipulation */
                                memmove(&tp->md5sig_info->keys4[i],
@@ -989,7 +993,6 @@ int tcp_v4_md5_do_del(struct sock *sk, __be32 addr)
                                        (tp->md5sig_info->entries4 - i) *
                                         sizeof(struct tcp4_md5sig_key));
                        }
-                       tcp_free_md5sig_pool();
                        return 0;
                }
        }
index d2fe4e06b472d6f9ad69f1c31cfa510251096550..0ce3d06dce604396f406d6539d8196148c864468 100644 (file)
@@ -328,6 +328,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo)
                struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw);
                const int rto = (icsk->icsk_rto << 2) - (icsk->icsk_rto >> 1);
 
+               tw->tw_transparent      = inet_sk(sk)->transparent;
                tw->tw_rcv_wscale       = tp->rx_opt.rcv_wscale;
                tcptw->tw_rcv_nxt       = tp->rcv_nxt;
                tcptw->tw_snd_nxt       = tp->snd_nxt;
index 3b5669a2582df03c1f1b896991fba664e137d62e..d27c797f9f05e76b82317d1a73818e0a7557bdf3 100644 (file)
@@ -875,6 +875,7 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,
                skb_reset_transport_header(skb);
                __skb_push(skb, skb_gro_offset(skb));
 
+               ops = rcu_dereference(inet6_protos[proto]);
                if (!ops || !ops->gro_receive)
                        goto out_unlock;
 
index 79cc6469508d36031eefdd9e640be846ce881416..7b8fc5794352af1b1b03fb1d3120295dd787fbdf 100644 (file)
@@ -591,7 +591,8 @@ static int tcp_v6_md5_do_add(struct sock *sk, const struct in6_addr *peer,
                        }
                        sk_nocaps_add(sk, NETIF_F_GSO_MASK);
                }
-               if (tcp_alloc_md5sig_pool(sk) == NULL) {
+               if (tp->md5sig_info->entries6 == 0 &&
+                       tcp_alloc_md5sig_pool(sk) == NULL) {
                        kfree(newkey);
                        return -ENOMEM;
                }
@@ -600,8 +601,9 @@ static int tcp_v6_md5_do_add(struct sock *sk, const struct in6_addr *peer,
                                       (tp->md5sig_info->entries6 + 1)), GFP_ATOMIC);
 
                        if (!keys) {
-                               tcp_free_md5sig_pool();
                                kfree(newkey);
+                               if (tp->md5sig_info->entries6 == 0)
+                                       tcp_free_md5sig_pool();
                                return -ENOMEM;
                        }
 
@@ -647,6 +649,7 @@ static int tcp_v6_md5_do_del(struct sock *sk, const struct in6_addr *peer)
                                kfree(tp->md5sig_info->keys6);
                                tp->md5sig_info->keys6 = NULL;
                                tp->md5sig_info->alloced6 = 0;
+                               tcp_free_md5sig_pool();
                        } else {
                                /* shrink the database */
                                if (tp->md5sig_info->entries6 != i)
@@ -655,7 +658,6 @@ static int tcp_v6_md5_do_del(struct sock *sk, const struct in6_addr *peer)
                                                (tp->md5sig_info->entries6 - i)
                                                * sizeof (tp->md5sig_info->keys6[0]));
                        }
-                       tcp_free_md5sig_pool();
                        return 0;
                }
        }
index ad4ac2601a569ccb7b95e36a9c83fac58fc4693b..34b2ddeacb673b3b8d4f3e92bf726fc567c49a81 100644 (file)
@@ -1045,8 +1045,10 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len
        headroom = NET_SKB_PAD + sizeof(struct iphdr) +
                uhlen + hdr_len;
        old_headroom = skb_headroom(skb);
-       if (skb_cow_head(skb, headroom))
+       if (skb_cow_head(skb, headroom)) {
+               dev_kfree_skb(skb);
                goto abort;
+       }
 
        new_headroom = skb_headroom(skb);
        skb_orphan(skb);
index 2b771dc708a30d212ed37fc1a76abb759279f159..e3be48bf4dcdb0779c0a20072e43839b8e01d9fc 100644 (file)
@@ -2283,6 +2283,7 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
        struct ip_vs_service *svc;
        struct ip_vs_dest_user *udest_compat;
        struct ip_vs_dest_user_kern udest;
+       struct netns_ipvs *ipvs = net_ipvs(net);
 
        if (!capable(CAP_NET_ADMIN))
                return -EPERM;
@@ -2303,6 +2304,24 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
        /* increase the module use count */
        ip_vs_use_count_inc();
 
+       /* Handle daemons since they have another lock */
+       if (cmd == IP_VS_SO_SET_STARTDAEMON ||
+           cmd == IP_VS_SO_SET_STOPDAEMON) {
+               struct ip_vs_daemon_user *dm = (struct ip_vs_daemon_user *)arg;
+
+               if (mutex_lock_interruptible(&ipvs->sync_mutex)) {
+                       ret = -ERESTARTSYS;
+                       goto out_dec;
+               }
+               if (cmd == IP_VS_SO_SET_STARTDAEMON)
+                       ret = start_sync_thread(net, dm->state, dm->mcast_ifn,
+                                               dm->syncid);
+               else
+                       ret = stop_sync_thread(net, dm->state);
+               mutex_unlock(&ipvs->sync_mutex);
+               goto out_dec;
+       }
+
        if (mutex_lock_interruptible(&__ip_vs_mutex)) {
                ret = -ERESTARTSYS;
                goto out_dec;
@@ -2316,15 +2335,6 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
                /* Set timeout values for (tcp tcpfin udp) */
                ret = ip_vs_set_timeout(net, (struct ip_vs_timeout_user *)arg);
                goto out_unlock;
-       } else if (cmd == IP_VS_SO_SET_STARTDAEMON) {
-               struct ip_vs_daemon_user *dm = (struct ip_vs_daemon_user *)arg;
-               ret = start_sync_thread(net, dm->state, dm->mcast_ifn,
-                                       dm->syncid);
-               goto out_unlock;
-       } else if (cmd == IP_VS_SO_SET_STOPDAEMON) {
-               struct ip_vs_daemon_user *dm = (struct ip_vs_daemon_user *)arg;
-               ret = stop_sync_thread(net, dm->state);
-               goto out_unlock;
        }
 
        usvc_compat = (struct ip_vs_service_user *)arg;
@@ -2584,6 +2594,33 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
 
        if (copy_from_user(arg, user, copylen) != 0)
                return -EFAULT;
+       /*
+        * Handle daemons first since it has its own locking
+        */
+       if (cmd == IP_VS_SO_GET_DAEMON) {
+               struct ip_vs_daemon_user d[2];
+
+               memset(&d, 0, sizeof(d));
+               if (mutex_lock_interruptible(&ipvs->sync_mutex))
+                       return -ERESTARTSYS;
+
+               if (ipvs->sync_state & IP_VS_STATE_MASTER) {
+                       d[0].state = IP_VS_STATE_MASTER;
+                       strlcpy(d[0].mcast_ifn, ipvs->master_mcast_ifn,
+                               sizeof(d[0].mcast_ifn));
+                       d[0].syncid = ipvs->master_syncid;
+               }
+               if (ipvs->sync_state & IP_VS_STATE_BACKUP) {
+                       d[1].state = IP_VS_STATE_BACKUP;
+                       strlcpy(d[1].mcast_ifn, ipvs->backup_mcast_ifn,
+                               sizeof(d[1].mcast_ifn));
+                       d[1].syncid = ipvs->backup_syncid;
+               }
+               if (copy_to_user(user, &d, sizeof(d)) != 0)
+                       ret = -EFAULT;
+               mutex_unlock(&ipvs->sync_mutex);
+               return ret;
+       }
 
        if (mutex_lock_interruptible(&__ip_vs_mutex))
                return -ERESTARTSYS;
@@ -2681,28 +2718,6 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
        }
        break;
 
-       case IP_VS_SO_GET_DAEMON:
-       {
-               struct ip_vs_daemon_user d[2];
-
-               memset(&d, 0, sizeof(d));
-               if (ipvs->sync_state & IP_VS_STATE_MASTER) {
-                       d[0].state = IP_VS_STATE_MASTER;
-                       strlcpy(d[0].mcast_ifn, ipvs->master_mcast_ifn,
-                               sizeof(d[0].mcast_ifn));
-                       d[0].syncid = ipvs->master_syncid;
-               }
-               if (ipvs->sync_state & IP_VS_STATE_BACKUP) {
-                       d[1].state = IP_VS_STATE_BACKUP;
-                       strlcpy(d[1].mcast_ifn, ipvs->backup_mcast_ifn,
-                               sizeof(d[1].mcast_ifn));
-                       d[1].syncid = ipvs->backup_syncid;
-               }
-               if (copy_to_user(user, &d, sizeof(d)) != 0)
-                       ret = -EFAULT;
-       }
-       break;
-
        default:
                ret = -EINVAL;
        }
@@ -3205,7 +3220,7 @@ static int ip_vs_genl_dump_daemons(struct sk_buff *skb,
        struct net *net = skb_sknet(skb);
        struct netns_ipvs *ipvs = net_ipvs(net);
 
-       mutex_lock(&__ip_vs_mutex);
+       mutex_lock(&ipvs->sync_mutex);
        if ((ipvs->sync_state & IP_VS_STATE_MASTER) && !cb->args[0]) {
                if (ip_vs_genl_dump_daemon(skb, IP_VS_STATE_MASTER,
                                           ipvs->master_mcast_ifn,
@@ -3225,7 +3240,7 @@ static int ip_vs_genl_dump_daemons(struct sk_buff *skb,
        }
 
 nla_put_failure:
-       mutex_unlock(&__ip_vs_mutex);
+       mutex_unlock(&ipvs->sync_mutex);
 
        return skb->len;
 }
@@ -3271,13 +3286,9 @@ static int ip_vs_genl_set_config(struct net *net, struct nlattr **attrs)
        return ip_vs_set_timeout(net, &t);
 }
 
-static int ip_vs_genl_set_cmd(struct sk_buff *skb, struct genl_info *info)
+static int ip_vs_genl_set_daemon(struct sk_buff *skb, struct genl_info *info)
 {
-       struct ip_vs_service *svc = NULL;
-       struct ip_vs_service_user_kern usvc;
-       struct ip_vs_dest_user_kern udest;
        int ret = 0, cmd;
-       int need_full_svc = 0, need_full_dest = 0;
        struct net *net;
        struct netns_ipvs *ipvs;
 
@@ -3285,19 +3296,10 @@ static int ip_vs_genl_set_cmd(struct sk_buff *skb, struct genl_info *info)
        ipvs = net_ipvs(net);
        cmd = info->genlhdr->cmd;
 
-       mutex_lock(&__ip_vs_mutex);
-
-       if (cmd == IPVS_CMD_FLUSH) {
-               ret = ip_vs_flush(net);
-               goto out;
-       } else if (cmd == IPVS_CMD_SET_CONFIG) {
-               ret = ip_vs_genl_set_config(net, info->attrs);
-               goto out;
-       } else if (cmd == IPVS_CMD_NEW_DAEMON ||
-                  cmd == IPVS_CMD_DEL_DAEMON) {
-
+       if (cmd == IPVS_CMD_NEW_DAEMON || cmd == IPVS_CMD_DEL_DAEMON) {
                struct nlattr *daemon_attrs[IPVS_DAEMON_ATTR_MAX + 1];
 
+               mutex_lock(&ipvs->sync_mutex);
                if (!info->attrs[IPVS_CMD_ATTR_DAEMON] ||
                    nla_parse_nested(daemon_attrs, IPVS_DAEMON_ATTR_MAX,
                                     info->attrs[IPVS_CMD_ATTR_DAEMON],
@@ -3310,6 +3312,33 @@ static int ip_vs_genl_set_cmd(struct sk_buff *skb, struct genl_info *info)
                        ret = ip_vs_genl_new_daemon(net, daemon_attrs);
                else
                        ret = ip_vs_genl_del_daemon(net, daemon_attrs);
+out:
+               mutex_unlock(&ipvs->sync_mutex);
+       }
+       return ret;
+}
+
+static int ip_vs_genl_set_cmd(struct sk_buff *skb, struct genl_info *info)
+{
+       struct ip_vs_service *svc = NULL;
+       struct ip_vs_service_user_kern usvc;
+       struct ip_vs_dest_user_kern udest;
+       int ret = 0, cmd;
+       int need_full_svc = 0, need_full_dest = 0;
+       struct net *net;
+       struct netns_ipvs *ipvs;
+
+       net = skb_sknet(skb);
+       ipvs = net_ipvs(net);
+       cmd = info->genlhdr->cmd;
+
+       mutex_lock(&__ip_vs_mutex);
+
+       if (cmd == IPVS_CMD_FLUSH) {
+               ret = ip_vs_flush(net);
+               goto out;
+       } else if (cmd == IPVS_CMD_SET_CONFIG) {
+               ret = ip_vs_genl_set_config(net, info->attrs);
                goto out;
        } else if (cmd == IPVS_CMD_ZERO &&
                   !info->attrs[IPVS_CMD_ATTR_SERVICE]) {
@@ -3536,13 +3565,13 @@ static struct genl_ops ip_vs_genl_ops[] __read_mostly = {
                .cmd    = IPVS_CMD_NEW_DAEMON,
                .flags  = GENL_ADMIN_PERM,
                .policy = ip_vs_cmd_policy,
-               .doit   = ip_vs_genl_set_cmd,
+               .doit   = ip_vs_genl_set_daemon,
        },
        {
                .cmd    = IPVS_CMD_DEL_DAEMON,
                .flags  = GENL_ADMIN_PERM,
                .policy = ip_vs_cmd_policy,
-               .doit   = ip_vs_genl_set_cmd,
+               .doit   = ip_vs_genl_set_daemon,
        },
        {
                .cmd    = IPVS_CMD_GET_DAEMON,
@@ -3679,7 +3708,7 @@ int __net_init ip_vs_control_net_init(struct net *net)
        int idx;
        struct netns_ipvs *ipvs = net_ipvs(net);
 
-       ipvs->rs_lock = __RW_LOCK_UNLOCKED(ipvs->rs_lock);
+       rwlock_init(&ipvs->rs_lock);
 
        /* Initialize rs_table */
        for (idx = 0; idx < IP_VS_RTAB_SIZE; idx++)
index 7ee7215b8ba048ffa94256a41b42b763b371fe71..3cdd479f9b5d179292182bb2711ec243b57736ee 100644 (file)
@@ -61,6 +61,7 @@
 
 #define SYNC_PROTO_VER  1              /* Protocol version in header */
 
+static struct lock_class_key __ipvs_sync_key;
 /*
  *     IPVS sync connection entry
  *     Version 0, i.e. original version.
@@ -1545,6 +1546,7 @@ int start_sync_thread(struct net *net, int state, char *mcast_ifn, __u8 syncid)
        IP_VS_DBG(7, "Each ip_vs_sync_conn entry needs %Zd bytes\n",
                  sizeof(struct ip_vs_sync_conn_v0));
 
+
        if (state == IP_VS_STATE_MASTER) {
                if (ipvs->master_thread)
                        return -EEXIST;
@@ -1667,6 +1669,7 @@ int __net_init ip_vs_sync_net_init(struct net *net)
 {
        struct netns_ipvs *ipvs = net_ipvs(net);
 
+       __mutex_init(&ipvs->sync_mutex, "ipvs->sync_mutex", &__ipvs_sync_key);
        INIT_LIST_HEAD(&ipvs->sync_queue);
        spin_lock_init(&ipvs->sync_lock);
        spin_lock_init(&ipvs->sync_buff_lock);
@@ -1680,7 +1683,9 @@ int __net_init ip_vs_sync_net_init(struct net *net)
 void ip_vs_sync_net_cleanup(struct net *net)
 {
        int retc;
+       struct netns_ipvs *ipvs = net_ipvs(net);
 
+       mutex_lock(&ipvs->sync_mutex);
        retc = stop_sync_thread(net, IP_VS_STATE_MASTER);
        if (retc && retc != -ESRCH)
                pr_err("Failed to stop Master Daemon\n");
@@ -1688,4 +1693,5 @@ void ip_vs_sync_net_cleanup(struct net *net)
        retc = stop_sync_thread(net, IP_VS_STATE_BACKUP);
        if (retc && retc != -ESRCH)
                pr_err("Failed to stop Backup Daemon\n");
+       mutex_unlock(&ipvs->sync_mutex);
 }
index cf616e55ca4193a54c6f949755428649306cfa5f..d69facdd9a7ac527cb947dfd2112b416aa41a19d 100644 (file)
@@ -241,8 +241,8 @@ static int gre_packet(struct nf_conn *ct,
                nf_ct_refresh_acct(ct, ctinfo, skb,
                                   ct->proto.gre.stream_timeout);
                /* Also, more likely to be important, and not a probe. */
-               set_bit(IPS_ASSURED_BIT, &ct->status);
-               nf_conntrack_event_cache(IPCT_ASSURED, ct);
+               if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
+                       nf_conntrack_event_cache(IPCT_ASSURED, ct);
        } else
                nf_ct_refresh_acct(ct, ctinfo, skb,
                                   ct->proto.gre.timeout);
index d30615419b4d77c1c375302f28c64034144b9385..5f03e4ea65bff5f137aebe122f843fb7e5c6a4ca 100644 (file)
@@ -91,7 +91,7 @@ int x25_parse_address_block(struct sk_buff *skb,
        int needed;
        int rc;
 
-       if (skb->len < 1) {
+       if (!pskb_may_pull(skb, 1)) {
                /* packet has no address block */
                rc = 0;
                goto empty;
@@ -100,7 +100,7 @@ int x25_parse_address_block(struct sk_buff *skb,
        len = *skb->data;
        needed = 1 + (len >> 4) + (len & 0x0f);
 
-       if (skb->len < needed) {
+       if (!pskb_may_pull(skb, needed)) {
                /* packet is too short to hold the addresses it claims
                   to hold */
                rc = -1;
@@ -295,7 +295,8 @@ static struct sock *x25_find_listener(struct x25_address *addr,
                         * Found a listening socket, now check the incoming
                         * call user data vs this sockets call user data
                         */
-                       if(skb->len > 0 && x25_sk(s)->cudmatchlength > 0) {
+                       if (x25_sk(s)->cudmatchlength > 0 &&
+                               skb->len >= x25_sk(s)->cudmatchlength) {
                                if((memcmp(x25_sk(s)->calluserdata.cuddata,
                                        skb->data,
                                        x25_sk(s)->cudmatchlength)) == 0) {
@@ -951,13 +952,26 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb,
         *
         *      Facilities length is mandatory in call request packets
         */
-       if (skb->len < 1)
+       if (!pskb_may_pull(skb, 1))
                goto out_clear_request;
        len = skb->data[0] + 1;
-       if (skb->len < len)
+       if (!pskb_may_pull(skb, len))
                goto out_clear_request;
        skb_pull(skb,len);
 
+       /*
+        *      Ensure that the amount of call user data is valid.
+        */
+       if (skb->len > X25_MAX_CUD_LEN)
+               goto out_clear_request;
+
+       /*
+        *      Get all the call user data so it can be used in
+        *      x25_find_listener and skb_copy_from_linear_data up ahead.
+        */
+       if (!pskb_may_pull(skb, skb->len))
+               goto out_clear_request;
+
        /*
         *      Find a listener for the particular address/cud pair.
         */
@@ -1166,6 +1180,9 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock,
         *      byte of the user data is the logical value of the Q Bit.
         */
        if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) {
+               if (!pskb_may_pull(skb, 1))
+                       goto out_kfree_skb;
+
                qbit = skb->data[0];
                skb_pull(skb, 1);
        }
@@ -1244,7 +1261,9 @@ static int x25_recvmsg(struct kiocb *iocb, struct socket *sock,
        struct x25_sock *x25 = x25_sk(sk);
        struct sockaddr_x25 *sx25 = (struct sockaddr_x25 *)msg->msg_name;
        size_t copied;
-       int qbit;
+       int qbit, header_len = x25->neighbour->extended ?
+               X25_EXT_MIN_LEN : X25_STD_MIN_LEN;
+
        struct sk_buff *skb;
        unsigned char *asmptr;
        int rc = -ENOTCONN;
@@ -1265,6 +1284,9 @@ static int x25_recvmsg(struct kiocb *iocb, struct socket *sock,
 
                skb = skb_dequeue(&x25->interrupt_in_queue);
 
+               if (!pskb_may_pull(skb, X25_STD_MIN_LEN))
+                       goto out_free_dgram;
+
                skb_pull(skb, X25_STD_MIN_LEN);
 
                /*
@@ -1285,10 +1307,12 @@ static int x25_recvmsg(struct kiocb *iocb, struct socket *sock,
                if (!skb)
                        goto out;
 
+               if (!pskb_may_pull(skb, header_len))
+                       goto out_free_dgram;
+
                qbit = (skb->data[0] & X25_Q_BIT) == X25_Q_BIT;
 
-               skb_pull(skb, x25->neighbour->extended ?
-                               X25_EXT_MIN_LEN : X25_STD_MIN_LEN);
+               skb_pull(skb, header_len);
 
                if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) {
                        asmptr  = skb_push(skb, 1);
index e547ca1578c39068042b9e2f8cfde15cfbeb9dbd..fa2b41888bd9a78b931ff6a6be418de56498fe6b 100644 (file)
@@ -32,6 +32,9 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb)
        unsigned short frametype;
        unsigned int lci;
 
+       if (!pskb_may_pull(skb, X25_STD_MIN_LEN))
+               return 0;
+
        frametype = skb->data[2];
        lci = ((skb->data[0] << 8) & 0xF00) + ((skb->data[1] << 0) & 0x0FF);
 
@@ -115,6 +118,9 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev,
                goto drop;
        }
 
+       if (!pskb_may_pull(skb, 1))
+               return 0;
+
        switch (skb->data[0]) {
 
        case X25_IFACE_DATA:
index f77e4e75f914b3a164e55ebf549ad32ec09f9b9c..36384a1fa9f28a3316dd28079b2bc04fce25a0fa 100644 (file)
@@ -44,7 +44,7 @@
 int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,
                struct x25_dte_facilities *dte_facs, unsigned long *vc_fac_mask)
 {
-       unsigned char *p = skb->data;
+       unsigned char *p;
        unsigned int len;
 
        *vc_fac_mask = 0;
@@ -60,14 +60,16 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,
        memset(dte_facs->called_ae, '\0', sizeof(dte_facs->called_ae));
        memset(dte_facs->calling_ae, '\0', sizeof(dte_facs->calling_ae));
 
-       if (skb->len < 1)
+       if (!pskb_may_pull(skb, 1))
                return 0;
 
-       len = *p++;
+       len = skb->data[0];
 
-       if (len >= skb->len)
+       if (!pskb_may_pull(skb, 1 + len))
                return -1;
 
+       p = skb->data + 1;
+
        while (len > 0) {
                switch (*p & X25_FAC_CLASS_MASK) {
                case X25_FAC_CLASS_A:
index 0b073b51b183a0b78fdd7e766ce015cf24043e1e..a49cd4ec551a58f7a6b8bdcdaeb2da273687196a 100644 (file)
@@ -107,6 +107,8 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp
                /*
                 *      Parse the data in the frame.
                 */
+               if (!pskb_may_pull(skb, X25_STD_MIN_LEN))
+                       goto out_clear;
                skb_pull(skb, X25_STD_MIN_LEN);
 
                len = x25_parse_address_block(skb, &source_addr,
@@ -127,9 +129,11 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp
                 *      Copy any Call User Data.
                 */
                if (skb->len > 0) {
-                       skb_copy_from_linear_data(skb,
-                                                 x25->calluserdata.cuddata,
-                                                 skb->len);
+                       if (skb->len > X25_MAX_CUD_LEN)
+                               goto out_clear;
+
+                       skb_copy_bits(skb, 0, x25->calluserdata.cuddata,
+                               skb->len);
                        x25->calluserdata.cudlength = skb->len;
                }
                if (!sock_flag(sk, SOCK_DEAD))
@@ -137,6 +141,9 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp
                break;
        }
        case X25_CLEAR_REQUEST:
+               if (!pskb_may_pull(skb, X25_STD_MIN_LEN + 2))
+                       goto out_clear;
+
                x25_write_internal(sk, X25_CLEAR_CONFIRMATION);
                x25_disconnect(sk, ECONNREFUSED, skb->data[3], skb->data[4]);
                break;
@@ -164,6 +171,9 @@ static int x25_state2_machine(struct sock *sk, struct sk_buff *skb, int frametyp
        switch (frametype) {
 
                case X25_CLEAR_REQUEST:
+                       if (!pskb_may_pull(skb, X25_STD_MIN_LEN + 2))
+                               goto out_clear;
+
                        x25_write_internal(sk, X25_CLEAR_CONFIRMATION);
                        x25_disconnect(sk, 0, skb->data[3], skb->data[4]);
                        break;
@@ -177,6 +187,11 @@ static int x25_state2_machine(struct sock *sk, struct sk_buff *skb, int frametyp
        }
 
        return 0;
+
+out_clear:
+       x25_write_internal(sk, X25_CLEAR_REQUEST);
+       x25_start_t23timer(sk);
+       return 0;
 }
 
 /*
@@ -206,6 +221,9 @@ static int x25_state3_machine(struct sock *sk, struct sk_buff *skb, int frametyp
                        break;
 
                case X25_CLEAR_REQUEST:
+                       if (!pskb_may_pull(skb, X25_STD_MIN_LEN + 2))
+                               goto out_clear;
+
                        x25_write_internal(sk, X25_CLEAR_CONFIRMATION);
                        x25_disconnect(sk, 0, skb->data[3], skb->data[4]);
                        break;
@@ -304,6 +322,12 @@ static int x25_state3_machine(struct sock *sk, struct sk_buff *skb, int frametyp
        }
 
        return queued;
+
+out_clear:
+       x25_write_internal(sk, X25_CLEAR_REQUEST);
+       x25->state = X25_STATE_2;
+       x25_start_t23timer(sk);
+       return 0;
 }
 
 /*
@@ -313,13 +337,13 @@ static int x25_state3_machine(struct sock *sk, struct sk_buff *skb, int frametyp
  */
 static int x25_state4_machine(struct sock *sk, struct sk_buff *skb, int frametype)
 {
+       struct x25_sock *x25 = x25_sk(sk);
+
        switch (frametype) {
 
                case X25_RESET_REQUEST:
                        x25_write_internal(sk, X25_RESET_CONFIRMATION);
                case X25_RESET_CONFIRMATION: {
-                       struct x25_sock *x25 = x25_sk(sk);
-
                        x25_stop_timer(sk);
                        x25->condition = 0x00;
                        x25->va        = 0;
@@ -331,6 +355,9 @@ static int x25_state4_machine(struct sock *sk, struct sk_buff *skb, int frametyp
                        break;
                }
                case X25_CLEAR_REQUEST:
+                       if (!pskb_may_pull(skb, X25_STD_MIN_LEN + 2))
+                               goto out_clear;
+
                        x25_write_internal(sk, X25_CLEAR_CONFIRMATION);
                        x25_disconnect(sk, 0, skb->data[3], skb->data[4]);
                        break;
@@ -340,6 +367,12 @@ static int x25_state4_machine(struct sock *sk, struct sk_buff *skb, int frametyp
        }
 
        return 0;
+
+out_clear:
+       x25_write_internal(sk, X25_CLEAR_REQUEST);
+       x25->state = X25_STATE_2;
+       x25_start_t23timer(sk);
+       return 0;
 }
 
 /* Higher level upcall for a LAPB frame */
index 037958ff8eeddad91ffee7040c457bd5ebb16475..4acacf3c6617b7f21930885930bae094abfcea14 100644 (file)
@@ -90,6 +90,9 @@ void x25_link_control(struct sk_buff *skb, struct x25_neigh *nb,
                break;
 
        case X25_DIAGNOSTIC:
+               if (!pskb_may_pull(skb, X25_STD_MIN_LEN + 4))
+                       break;
+
                printk(KERN_WARNING "x25: diagnostic #%d - %02X %02X %02X\n",
                       skb->data[3], skb->data[4],
                       skb->data[5], skb->data[6]);
index 24a342ebc7f5fe33be39d654c165f634634057ae..5170d52bfd96e1e045422ae8e3cb607af2d2f843 100644 (file)
@@ -269,7 +269,11 @@ int x25_decode(struct sock *sk, struct sk_buff *skb, int *ns, int *nr, int *q,
               int *d, int *m)
 {
        struct x25_sock *x25 = x25_sk(sk);
-       unsigned char *frame = skb->data;
+       unsigned char *frame;
+
+       if (!pskb_may_pull(skb, X25_STD_MIN_LEN))
+               return X25_ILLEGAL;
+       frame = skb->data;
 
        *ns = *nr = *q = *d = *m = 0;
 
@@ -294,6 +298,10 @@ int x25_decode(struct sock *sk, struct sk_buff *skb, int *ns, int *nr, int *q,
                if (frame[2] == X25_RR  ||
                    frame[2] == X25_RNR ||
                    frame[2] == X25_REJ) {
+                       if (!pskb_may_pull(skb, X25_EXT_MIN_LEN))
+                               return X25_ILLEGAL;
+                       frame = skb->data;
+
                        *nr = (frame[3] >> 1) & 0x7F;
                        return frame[2];
                }
@@ -308,6 +316,10 @@ int x25_decode(struct sock *sk, struct sk_buff *skb, int *ns, int *nr, int *q,
 
        if (x25->neighbour->extended) {
                if ((frame[2] & 0x01) == X25_DATA) {
+                       if (!pskb_may_pull(skb, X25_EXT_MIN_LEN))
+                               return X25_ILLEGAL;
+                       frame = skb->data;
+
                        *q  = (frame[0] & X25_Q_BIT) == X25_Q_BIT;
                        *d  = (frame[0] & X25_D_BIT) == X25_D_BIT;
                        *m  = (frame[3] & X25_EXT_M_BIT) == X25_EXT_M_BIT;
index 0e4fccfef12cb495fcf059a4dc964e3b45ee136c..d9e153390926336b1cfa3b787cf84d663f76de23 100644 (file)
@@ -1097,6 +1097,7 @@ void security_sk_clone(const struct sock *sk, struct sock *newsk)
 {
        security_ops->sk_clone_security(sk, newsk);
 }
+EXPORT_SYMBOL(security_sk_clone);
 
 void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
 {
index e9a2a8795d1bdce7c1cb6bb8a407fda12fc4afc3..191284a1c0ae0225dfea8f23c277a6390371af87 100644 (file)
@@ -2370,6 +2370,7 @@ static int azx_dev_free(struct snd_device *device)
 static struct snd_pci_quirk position_fix_list[] __devinitdata = {
        SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB),
        SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB),
+       SND_PCI_QUIRK(0x1028, 0x02c6, "Dell Inspiron 1010", POS_FIX_LPIB),
        SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB),
        SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB),
        SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB),
index 7696d05b935629f354c81866fdb89e43222f415f..76752d8ea73305b3bd0c15fa910319b6d3b9544e 100644 (file)
@@ -3110,6 +3110,7 @@ static const struct snd_pci_quirk cxt5066_cfg_tbl[] = {
        SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD),
        SND_PCI_QUIRK(0x17aa, 0x21c6, "Thinkpad Edge 13", CXT5066_ASUS),
        SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD),
+       SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520 & W520", CXT5066_AUTO),
        SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT5066_THINKPAD),
        SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT5066_THINKPAD),
        SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo U350", CXT5066_ASUS),